Upgrade yt_dlp and download script

This commit is contained in:
2025-05-02 16:11:08 -05:00
parent 3a2e8eeb08
commit d68d9ce4f9
1194 changed files with 60099 additions and 44436 deletions

View File

@@ -1,13 +1,14 @@
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
parse_count,
unified_timestamp,
remove_end,
determine_ext,
)
import re
import random
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
determine_ext,
parse_count,
remove_end,
unified_timestamp,
)
class NitterIE(InfoExtractor):
@@ -264,13 +265,33 @@ class NitterIE(InfoExtractor):
'like_count': int,
'repost_count': int,
'comment_count': int,
}
}
},
}, { # no OpenGraph title
'url': f'https://{current_instance}/LocalBateman/status/1678455464038735895#m',
'info_dict': {
'id': '1678455464038735895',
'ext': 'mp4',
'title': 'Your Typical Local Man - Local man, what did Romanians ever do to you?',
'description': 'Local man, what did Romanians ever do to you?',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'Your Typical Local Man',
'uploader_id': 'LocalBateman',
'uploader_url': f'https://{current_instance}/LocalBateman',
'upload_date': '20230710',
'timestamp': 1689009900,
'view_count': int,
'like_count': int,
'repost_count': int,
'comment_count': int,
},
'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'],
'params': {'skip_download': 'm3u8'},
},
]
def _real_extract(self, url):
video_id, uploader_id = self._match_valid_url(url).group('id', 'uploader_id')
parsed_url = compat_urlparse.urlparse(url)
parsed_url = urllib.parse.urlparse(url)
base_url = f'{parsed_url.scheme}://{parsed_url.netloc}'
self._set_cookie(parsed_url.netloc, 'hlsPlayback', 'on')
@@ -280,7 +301,7 @@ class NitterIE(InfoExtractor):
if main_tweet_start > 0:
webpage = full_webpage[main_tweet_start:]
video_url = '%s%s' % (base_url, self._html_search_regex(
video_url = '{}{}'.format(base_url, self._html_search_regex(
r'(?:<video[^>]+data-url|<source[^>]+src)="([^"]+)"', webpage, 'video url'))
ext = determine_ext(video_url)
@@ -289,10 +310,10 @@ class NitterIE(InfoExtractor):
else:
formats = [{
'url': video_url,
'ext': ext
'ext': ext,
}]
title = description = self._og_search_description(full_webpage) or self._html_search_regex(
title = description = self._og_search_description(full_webpage, default=None) or self._html_search_regex(
r'<div class="tweet-content[^>]+>([^<]+)</div>', webpage, 'title', fatal=False)
uploader_id = self._html_search_regex(
@@ -313,12 +334,12 @@ class NitterIE(InfoExtractor):
thumbnail = (
self._html_search_meta('og:image', full_webpage, 'thumbnail url')
or remove_end('%s%s' % (base_url, self._html_search_regex(
or remove_end('{}{}'.format(base_url, self._html_search_regex(
r'<video[^>]+poster="([^"]+)"', webpage, 'thumbnail url', fatal=False)), '%3Asmall'))
thumbnails = [
{'id': id, 'url': f'{thumbnail}%3A{id}'}
for id in ('thumb', 'small', 'large', 'medium', 'orig')
{'id': id_, 'url': f'{thumbnail}%3A{id_}'}
for id_ in ('thumb', 'small', 'large', 'medium', 'orig')
]
date = self._html_search_regex(