ycdl/utilities/download_thumbnails.py
Ethan Dalool 2f5ec40b89 Big: Object-oriented channels & videos, match Etiquette structure.
- Channels and videos are now objects instead of just dictionaries.
- Copied Etiquette's use of cachemanager mixin to cache those objects.
- Copied Etiquette's use of sql_ methods.
- Copied Etiquette's use of namespaced javascript.
- Copied Etiquette's use of config file.
- Redid video_card css to use grid, better on mobile.
- Improved usage of URL parameters with class=merge_class.
- Wrote some actual content on readme.
2020-04-05 18:59:16 -07:00

25 lines
634 B
Python

import logging
logging.basicConfig(level=logging.WARNING)
import bot3 as bot
import os
import traceback
import ycdl
from voussoirkit import downloady
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
ycdldb = ycdl.ycdldb.YCDLDB(youtube_core)
DIRECTORY = '.\\youtube thumbnails'
videos = ycdldb.get_videos()
for video in videos:
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()