aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/everything_else.py
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2024-01-22 05:21:12 +0800
committerAstound <kirito@disroot.org>2024-01-22 05:21:12 +0800
commitd591956baafa6a16b956f814b69ecbf1f5e23aba (patch)
tree200366bc4e2d8a5a55b21914c776cef1fe7670dd /youtube/yt_data_extract/everything_else.py
parent6011a08cdff6a42b7f0f5ce46a7631b0831fa098 (diff)
downloadyt-local-d591956baafa6a16b956f814b69ecbf1f5e23aba.tar.lz
yt-local-d591956baafa6a16b956f814b69ecbf1f5e23aba.tar.xz
yt-local-d591956baafa6a16b956f814b69ecbf1f5e23aba.zip
ylist: show 100 videos per page instead of 20
Also add an option to the internal playlist ctoken function for filtering out shorts, to be used in future anti-shorts features
Diffstat (limited to 'youtube/yt_data_extract/everything_else.py')
-rw-r--r--youtube/yt_data_extract/everything_else.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index 281bc03..7740c67 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -191,6 +191,19 @@ def extract_playlist_metadata(polymer_json):
elif 'updated' in text:
metadata['time_published'] = extract_date(text)
+ microformat = deep_get(response, 'microformat', 'microformatDataRenderer',
+ default={})
+ conservative_update(
+ metadata, 'title', extract_str(microformat.get('title'))
+ )
+ conservative_update(
+ metadata, 'description', extract_str(microformat.get('description'))
+ )
+ conservative_update(
+ metadata, 'thumbnail', deep_get(microformat, 'thumbnail',
+ 'thumbnails', -1, 'url')
+ )
+
return metadata
def extract_playlist_info(polymer_json):
@@ -198,13 +211,11 @@ def extract_playlist_info(polymer_json):
if err:
return {'error': err}
info = {'error': None}
- first_page = 'continuationContents' not in response
video_list, _ = extract_items(response)
info['items'] = [extract_item_info(renderer) for renderer in video_list]
- if first_page:
- info['metadata'] = extract_playlist_metadata(polymer_json)
+ info['metadata'] = extract_playlist_metadata(polymer_json)
return info