add thumbnail extraction to channel playlist scraper

This commit is contained in:
simon 2021-11-11 21:17:04 +07:00
parent 3485f9b1c8
commit 44e1720aab
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -201,7 +201,7 @@ def subscribe_to(url_str):
)
@shared_task()
@shared_task
def index_channel_playlists(channel_id):
"""add all playlists of channel to index"""
channel_handler = YoutubeChannel(channel_id)
@ -210,4 +210,10 @@ def index_channel_playlists(channel_id):
for playlist_id, playlist_title in all_playlists:
print("add playlist: " + playlist_title)
playlist_handler = YoutubePlaylist(playlist_id)
playlist_handler.get_playlist_dict()
playlist_handler.upload_to_es()
if all_playlists:
handler = ThumbManager()
missing_playlists = handler.get_missing_playlists()
handler.download_playlist(missing_playlists)