-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
36 lines (29 loc) · 1.01 KB
/
main.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
from yt import *
# MAIN
try:
with open('api.txt') as f:
api = f.read()
if api:
while True:
key_word = input('\nEnter the key word: ')
if key_word:
limit = input('Number of pages to scrape: ')
if limit:
while int(limit) > 50:
print('\nNumber of pages could not be more than 50.')
limit = input('Try another number: ')
else:
limit = 1
print('Creating client...')
yt = YoutubeStat(api, key_word, int(limit))
yt.get_channel_video_data()
print('Data fetched!\nSaving data in files...')
yt.dump()
else:
print('Empty input!')
else:
print('API key not found!')
except OSError:
print("Could not open api.txt file.")
input('Press any key to exit...')
# DEVELOPED by [email protected]