feat: add Spanish README and improve channel/playlist handling
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:
Jesus
2026-04-12 20:20:32 -05:00
parent 550457936a
commit c6c8030907
6 changed files with 378 additions and 130 deletions

View File

@@ -28,6 +28,32 @@ def playlist_ctoken(playlist_id, offset, include_shorts=True):
return base64.urlsafe_b64encode(pointless_nest).decode('ascii')
def get_playlist_metadata(playlist_id, report_text="Retrieved playlist metadata"):
"""Get playlist metadata (video_count, title, etc.) without fetching videos."""
key = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8'
url = f'https://www.youtube.com/youtubei/v1/browse?key={key}'
data = {
'context': {
'client': {
'hl': 'en',
'gl': 'US',
'clientName': 'WEB',
'clientVersion': '2.20240327.00.00',
},
},
'browseId': 'VL' + playlist_id,
}
content_type_header = (('Content-Type', 'application/json'),)
content = util.fetch_url(
url, util.desktop_xhr_headers + content_type_header,
data=json.dumps(data),
report_text=report_text, debug_name='playlist_metadata'
)
return json.loads(content.decode('utf-8'))
def playlist_first_page(playlist_id, report_text="Retrieved playlist",
use_mobile=False):
# Use innertube API (pbj=1 no longer works for many playlists)