2016-12-13 03:50:41 +00:00
|
|
|
import bot
|
2016-12-07 06:11:09 +00:00
|
|
|
import os
|
2016-12-13 03:50:41 +00:00
|
|
|
import traceback
|
|
|
|
import ycdl
|
|
|
|
import ytapi
|
2017-05-21 20:59:07 +00:00
|
|
|
import ycdl_repl
|
2016-12-07 06:11:09 +00:00
|
|
|
from voussoirkit import downloady
|
|
|
|
|
2016-12-13 03:50:41 +00:00
|
|
|
youtube_core = ytapi.Youtube(bot.YOUTUBE_KEY)
|
|
|
|
youtube = ycdl.YCDL(youtube_core)
|
|
|
|
|
2017-05-21 20:59:07 +00:00
|
|
|
DIRECTORY = '.\\youtube thumbnails'
|
2016-12-07 06:11:09 +00:00
|
|
|
|
2016-12-13 03:50:41 +00:00
|
|
|
videos = ycdl_repl.youtube.get_videos()
|
2016-12-07 06:11:09 +00:00
|
|
|
for video in videos:
|
2016-12-13 03:50:41 +00:00
|
|
|
try:
|
|
|
|
thumbnail_path = os.path.join(DIRECTORY, video['id']) + '.jpg'
|
|
|
|
if os.path.exists(thumbnail_path):
|
|
|
|
continue
|
|
|
|
result = downloady.download_file(video['thumbnail'], thumbnail_path)
|
|
|
|
print(result)
|
|
|
|
except Exception as e:
|
|
|
|
traceback.print_exc()
|