2018-12-18 03:17:53 +00:00
|
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
|
|
|
|
import bot3 as bot
|
2016-12-07 06:11:09 +00:00
|
|
|
import os
|
2016-12-13 03:50:41 +00:00
|
|
|
import traceback
|
|
|
|
import ycdl
|
2017-05-21 20:59:07 +00:00
|
|
|
import ycdl_repl
|
2016-12-07 06:11:09 +00:00
|
|
|
from voussoirkit import downloady
|
|
|
|
|
2018-12-18 03:17:53 +00:00
|
|
|
|
2020-01-07 06:01:23 +00:00
|
|
|
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
|
2016-12-13 03:50:41 +00:00
|
|
|
youtube = ycdl.YCDL(youtube_core)
|
|
|
|
|
2017-05-21 20:59:07 +00:00
|
|
|
DIRECTORY = '.\\youtube thumbnails'
|
2016-12-07 06:11:09 +00:00
|
|
|
|
2020-01-07 06:01:23 +00:00
|
|
|
videos = ycdl_repl.ydl.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()
|