feat: add Spanish README and improve channel/playlist handling
All checks were successful
CI / test (push) Successful in 52s
All checks were successful
CI / test (push) Successful in 52s
* Add complete Spanish translation (README.es.md) * Restructure English README for clarity and conciseness * Filter out YouTube Shorts from channel video listings (sort=4) * Add fallback for video count using playlist metadata when API returns zero * Add get_playlist_metadata() to fetch metadata without full video list * Add is_short() utility to detect YouTube Shorts by duration, badges, and type * Export is_short from yt_data_extract for use across modules
This commit is contained in:
@@ -475,6 +475,27 @@ def get_channel_page_general_url(base_url, tab, request, channel_id=None):
|
||||
pl_info = yt_data_extract.extract_playlist_info(pl_json)
|
||||
number_of_videos = tasks[2].value
|
||||
|
||||
# Filter out shorts locally if sort=4 (YouTube may not honor API filter)
|
||||
if sort == '4' and pl_info.get('items'):
|
||||
pl_info['items'] = [
|
||||
item for item in pl_info['items']
|
||||
if not yt_data_extract.is_short(item)
|
||||
]
|
||||
|
||||
# If channel API count is missing/zero, get from playlist metadata
|
||||
if not number_of_videos or number_of_videos == 0:
|
||||
try:
|
||||
metadata_json = playlist.get_playlist_metadata(
|
||||
'UU' + channel_id[2:],
|
||||
report_text='Retrieved playlist metadata'
|
||||
)
|
||||
metadata_info = yt_data_extract.extract_playlist_info(metadata_json)
|
||||
metadata_video_count = metadata_info['metadata'].get('video_count')
|
||||
if metadata_video_count:
|
||||
number_of_videos = metadata_video_count
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
info = pl_info
|
||||
info['channel_id'] = channel_id
|
||||
info['current_tab'] = 'videos'
|
||||
|
||||
Reference in New Issue
Block a user