This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
/
search.py
65 lines (47 loc) 路 1.97 KB
/
search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from youtubesearchpython.__future__ import *
import asyncio
async def main():
search = Search('NoCopyrightSounds', limit = 1, language = 'en', region = 'US')
result = await search.next()
print(result)
videosSearch = VideosSearch('NoCopyrightSounds', limit = 10, language = 'en', region = 'US')
videosResult = await videosSearch.next()
print(videosResult)
channelsSearch = ChannelsSearch('NoCopyrightSounds', limit = 1, language = 'en', region = 'US')
channelsResult = await channelsSearch.next()
print(channelsResult)
playlistsSearch = PlaylistsSearch('NoCopyrightSounds', limit = 1, language = 'en', region = 'US')
playlistsResult = await playlistsSearch.next()
print(playlistsResult)
customSearch = CustomSearch('NoCopyrightSounds', VideoSortOrder.uploadDate, language = 'en', region = 'US')
customResult = await customSearch.next()
print(customResult)
search = ChannelSearch('Watermelon Sugar', "UCZFWPqqPkFlNwIxcpsLOwew")
result = await search.next()
print(result)
channel = ChannelSearch('The Beatles - Topic', 'UC2XdaAVUannpujzv32jcouQ')
result = await channel.next()
print(result)
"""
channel = ChannelPlaylistSearch('PewDiePie', 'UC-lHJZR3Gqxm24_Vd_AJ5Yw')
result = await channel.next()
print(result)
channel = ChannelPlaylistSearch('The Beatles - Topic', 'UC2XdaAVUannpujzv32jcouQ')
result = await channel.next()
print(result)
"""
search = VideosSearch('NoCopyrightSounds')
index = 0
result = await search.next()
for video in result['result']:
index += 1
print(f'{index} - {video["title"]}')
result = await search.next()
for video in result['result']:
index += 1
print(f'{index} - {video["title"]}')
result = await search.next()
for video in result['result']:
index += 1
print(f'{index} - {video["title"]}')
asyncio.run(main())