renamedquery/youtube-dl-server

[Improvement] Improve subscription-daemon.py by adding a flag to youtube-dl object

nguyenhung opened this issue · 0 comments

Subscription-daemon.py uses youtube_dl.extract_info to get all the videos info in a playlist. The data is redundant for downloaded videos.

https://github.com/katznboyz1/youtube-dl-server/blob/1b958d63afd82c4aa29539540b35a0d37c12ee24/subscription-daemon.py#L81

We can improve the process by adding 'extract_flat': True flag to the youtube-dl options
https://github.com/l1ving/youtube-dl/blob/ab6ade71e5ef7060db209dd89a139f655fcfa328/youtube_dl/YoutubeDL.py#L226

import youtube_dl
ydl_opts = {
    'default_search':'youtube',
    'extract_flat': True,
}
youtubeDLObject = youtube_dl.YoutubeDL(ydl_opts)
playlistOrChannelData = youtubeDLObject.extract_info('https://www.youtube.com/playlist?list=PLOJU8YJjFwGOeOx32q45CjrAq4hAOpxBk', download=False)
print(playlistOrChannelData)