before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_iso8601,
traverse_obj,
)
class BeaconTvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
_TESTS = [{
'url': 'https://beacon.tv/content/welcome-to-beacon',
'md5': 'b3f593... | Don't match the IDs so broadly, otherwise things such as `#` or `?` might also be part of the id.
```suggestion
_VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>[\w-]+)'
``` | import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_iso8601,
traverse_obj,
)
class BeaconTvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://beacon.tv/content/welcome-to-beacon',
... | @@ -0,0 +1,102 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)' | yt_dlp/extractor/beacon.py | 10 | Python | 0.714 | suggestion | 191 | 35 | 35 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
class BeaconTvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
_TESTS = [{
'url': 'https://beacon.tv/content/welcome-to-beacon',
'md5': 'b3f5932d437f288e662f10f3bfc5bd04',
'info_dict': {
'id': 'welcome-to-beacon',
'ext': 'mp4',... | Since this data is mandatory, we might as well:
```suggestion
state = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['__APOLLO_STATE__']
``` | )
class BeaconTvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://beacon.tv/content/welcome-to-beacon',
'md5': 'b3f5932d437f288e662f10f3bfc5bd04',
'info_dict': {
'id': 'welcome-to-beacon',
'ext':... | @@ -0,0 +1,102 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
+
+ _TESTS = [{
+ 'url': 'https://beacon.tv/content/welcome-to-... | yt_dlp/extractor/beacon.py | 26 | Python | 0.714 | suggestion | 170 | 51 | 51 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
'info_dict': {
'id': 'welcome-to-beacon',
'ext': 'mp4',
'upload_date': '20240509',
'description': 'md5:ea2bd32e71acf3f9fca6937412cc3563',
'thumbnail': 'https://imagedelivery.net/_18WuG-hYMyVquF6KgU_xQ/critrole-beacon-staging-backend/beacon_trailer_thum... | Let's simplify
```suggestion
content_data = traverse_obj(state, (
lambda k, v: k.startswith('Content:') and v['slug'] == video_id, any))
``` | 'url': 'https://beacon.tv/content/welcome-to-beacon',
'md5': 'b3f5932d437f288e662f10f3bfc5bd04',
'info_dict': {
'id': 'welcome-to-beacon',
'ext': 'mp4',
'upload_date': '20240509',
'description': 'md5:ea2bd32e71acf3f9fca6937412cc3563',
'... | @@ -0,0 +1,102 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
+
+ _TESTS = [{
+ 'url': 'https://beacon.tv/content/welcome-to-... | yt_dlp/extractor/beacon.py | 26 | Python | 0.786 | refactor | 164 | 51 | 51 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
'title': 'Your home for Critical Role!',
'timestamp': 1715227200,
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
json_data_string = self._html_search_regex(r'<script id="__NEXT_DATA__" ty... | Why not combine the two? Comments are also only necessary when the code is difficult to understand without or there is something important to take note of.
```suggestion
if not content_data or not content_data.get('contentVideo'):
raise ExtractorError(
'Failed to extract video. E... | 'description': 'md5:ea2bd32e71acf3f9fca6937412cc3563',
'thumbnail': 'https://cdn.jwplayer.com/v2/media/I4CkkEvN/poster.jpg?width=720',
'title': 'Your home for Critical Role!',
'timestamp': 1715227200,
'duration': 105.494,
},
}, {
'url': 'ht... | @@ -0,0 +1,102 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
+
+ _TESTS = [{
+ 'url': 'https://beacon.tv/content/welcome-to-... | yt_dlp/extractor/beacon.py | 26 | Python | 1 | bug | 411 | 51 | 49 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
json_data_string = self._html_search_regex(r'<script id="__NEXT_DATA__" type="application/json">(.+)</script>', webpage, 'JSON Body')
json_data = self._parse_json(json_data_... | How about we just use the jwplayer data?
```suggestion
return self._parse_jwplayer_data(traverse_obj(
content_data, ('contentVideo', 'video', 'videoData', {json.loads})), video_id)
```
If you want to include some additional data from the page api you should merge the two info dicts rather t... | 'duration': 105.494,
},
}, {
'url': 'https://beacon.tv/content/re-slayers-take-trailer',
'md5': 'd879b091485dbed2245094c8152afd89',
'info_dict': {
'id': 're-slayers-take-trailer',
'ext': 'mp4',
'title': 'The Re-Slayer’s Take | Official ... | @@ -0,0 +1,102 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>.+)'
+
+ _TESTS = [{
+ 'url': 'https://beacon.tv/content/welcome-to-... | yt_dlp/extractor/beacon.py | 26 | Python | 0.857 | question | 358 | 51 | 45 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
'description': 'md5:ea2bd32e71acf3f9fca6937412cc3563',
'thumbnail': 'https://cdn.jwplayer.com/v2/media/I4CkkEvN/poster.jpg?width=720',
'title': 'Your home for Critical Role!',
'timestamp': 1715227200,
'duration': 105.494,
},
}]
def _real_extra... | I would inline this and also validate the returned data types with traverse_obj
```suggestion
return {
**self._parse_jwplayer_data(traverse_obj(
content_data, ('contentVideo', 'video', 'videoData', {json.loads})), video_id),
**traverse_obj(content_data, {
... | 'description': 'md5:ea2bd32e71acf3f9fca6937412cc3563',
'thumbnail': 'https://cdn.jwplayer.com/v2/media/I4CkkEvN/poster.jpg?width=720',
'title': 'Your home for Critical Role!',
'timestamp': 1715227200,
'duration': 105.494,
},
}, {
'url': 'ht... | @@ -0,0 +1,46 @@
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ parse_iso8601,
+ traverse_obj,
+)
+
+
+class BeaconTvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?beacon\.tv/content/(?P<id>[\w-]+)'
+
+ _TESTS = [{
+ 'url': 'https://beacon.tv/c... | yt_dlp/extractor/beacon.py | 26 | Python | 0.929 | suggestion | 505 | 27 | 49 | false | [ie/beacon] Add extractor for Beacon.tv | 9,901 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Deukhoofd |
'like_count': int,
'availability': 'public',
'playable_in_embed': True,
'thumbnail': 'https://i.ytimg.com/vi/BaW_jenozKc/maxresdefault.jpg',
'live_status': 'not_live',
'age_limit': 0,
'comment_count': int,
... | I don't understand why you wrap this in a Request object. Can't you do
```suggestion
video_data = self._download_json(
'https://ladigitale.dev/digiview/inc/recuperer_video.php', video_id,
data=urllib.parse.urlencode({'id': video_id}).encode())
``` | 'channel_url': 'https://www.youtube.com/channel/UCSMOQeBJ2RAnuFungnQOxLg',
'uploader_id': '@BlenderOfficial',
'description': 'md5:8f3ed18a53a1bb36cbb3b70a15782fd0',
'categories': ['Film & Animation'],
'channel_is_verified': True,
'heatmap': 'count:... | @@ -0,0 +1,112 @@
+import urllib.parse
+
+from yt_dlp.utils import int_or_none
+
+from .youtube import YoutubeIE
+from ..networking import Request
+
+
+class DigiviewIE(YoutubeIE):
+ IE_DESC = 'Digiview'
+ IE_NAME = 'digiview'
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
... | yt_dlp/extractor/digiview.py | 26 | Python | 0.786 | suggestion | 284 | 51 | 51 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
'live_status': 'not_live',
'age_limit': 0,
'comment_count': int,
'channel_follower_count': int,
'uploader': 'Philipp Hagemeister',
'uploader_url': 'https://www.youtube.com/@PhilippHagemeister',
'uploader_id':... | Don't extract inside an extractor, but instead use url results | 'channel_is_verified': True,
'heatmap': 'count:100',
'section_end': 10,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 5,
... | @@ -0,0 +1,112 @@
+import urllib.parse
+
+from yt_dlp.utils import int_or_none
+
+from .youtube import YoutubeIE
+from ..networking import Request
+
+
+class DigiviewIE(YoutubeIE):
+ IE_DESC = 'Digiview'
+ IE_NAME = 'digiview'
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
... | yt_dlp/extractor/digiview.py | 26 | Python | 0.286 | refactor | 62 | 48 | 51 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
)
youtube_ie = YoutubeIE()
youtube_ie.set_downloader(self._downloader)
info = youtube_ie._real_extract(webpage_data['videoId'])
# replace the YouTube metadata by the Digiview one
info['title'] = webpage_data.get('titre') or info['title']
info['description'] = we... | Instead of passing custom ffmpeg args, just return a `section_start` and `section_end` time. Something like this should work:
```suggestion
clip_id = video_data['videoId']
return {
'_type': 'url_transparent',
'url': f'https://www.youtube.com/watch?v={clip_id}',
... | 'view_count': int,
'comment_count': int,
'channel': 'Blender',
'license': 'Creative Commons Attribution license (reuse allowed)',
'like_count': int,
'tags': 'count:8',
'live_status': 'not_live',
'channel_id': 'UCSMOQeBJ2RAnu... | @@ -0,0 +1,112 @@
+import urllib.parse
+
+from yt_dlp.utils import int_or_none
+
+from .youtube import YoutubeIE
+from ..networking import Request
+
+
+class DigiviewIE(YoutubeIE):
+ IE_DESC = 'Digiview'
+ IE_NAME = 'digiview'
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
... | yt_dlp/extractor/digiview.py | 26 | Python | 1 | suggestion | 790 | 27 | 45 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
import urllib.parse
from yt_dlp.utils import int_or_none
from .youtube import YoutubeIE
from ..networking import Request
class DigiviewIE(YoutubeIE):
IE_DESC = 'Digiview'
IE_NAME = 'digiview'
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [
{
... | imo. not needed if they are just repeats
```suggestion
``` | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | @@ -0,0 +1,112 @@
+import urllib.parse
+
+from yt_dlp.utils import int_or_none
+
+from .youtube import YoutubeIE
+from ..networking import Request
+
+
+class DigiviewIE(YoutubeIE):
+ IE_DESC = 'Digiview'
+ IE_NAME = 'digiview' | yt_dlp/extractor/digiview.py | 11 | Python | 0.571 | suggestion | 60 | 36 | 36 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
import urllib.parse
from yt_dlp.utils import int_or_none
from .youtube import YoutubeIE
from ..networking import Request
class DigiviewIE(YoutubeIE):
IE_DESC = 'Digiview'
IE_NAME = 'digiview'
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [
{
... | This video has since been removed from YouTube. Could you please update the tests? | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | @@ -0,0 +1,112 @@
+import urllib.parse
+
+from yt_dlp.utils import int_or_none
+
+from .youtube import YoutubeIE
+from ..networking import Request
+
+
+class DigiviewIE(YoutubeIE):
+ IE_DESC = 'Digiview'
+ IE_NAME = 'digiview'
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
... | yt_dlp/extractor/digiview.py | 15 | Python | 0.286 | question | 82 | 40 | 40 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(YoutubeIE):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [
{
# normal video
'url': 'https://l... | Don't subclass from a concrete extractor
```suggestion
class DigiviewIE(InfoExtractor):
```
Needs `from .common import InfoExtractor` as well | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | @@ -0,0 +1,51 @@
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(YoutubeIE): | yt_dlp/extractor/digiview.py | 5 | Python | 0.786 | refactor | 145 | 30 | 30 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(YoutubeIE):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [
{
# normal video
'url': 'https://l... | These tests are incomplete. Please actually run them.
You should also merge master in to your branch. | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | @@ -0,0 +1,51 @@
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(YoutubeIE):
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
+ _TESTS = [
+ {
+ # normal video
+ ... | yt_dlp/extractor/digiview.py | 12 | Python | 0.429 | suggestion | 102 | 37 | 37 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | lfavole |
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | ```suggestion
'tags': 'count:8',
``` | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
class DigiviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
_TESTS = [{
# normal video
... | @@ -0,0 +1,130 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
+ _TESTS = [{
+... | yt_dlp/extractor/digiview.py | 24 | Python | 0.571 | suggestion | 50 | 49 | 49 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | lfavole |
'heatmap': 'count:100',
'section_end': 635,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 0,
'availability': 'public',
},... | ```suggestion
'tags': 'count:8',
``` | 'heatmap': 'count:100',
'section_end': 635,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 0,
'availability': 'public',
},... | @@ -0,0 +1,130 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
+ _TESTS = [{
+... | yt_dlp/extractor/digiview.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | lfavole |
'heatmap': 'count:100',
'section_end': 10,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 5,
'availability': 'public',
},
... | ```suggestion
'tags': 'count:8',
``` | 'heatmap': 'count:100',
'section_end': 10,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 5,
'availability': 'public',
},
... | @@ -0,0 +1,130 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
+ _TESTS = [{
+... | yt_dlp/extractor/digiview.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | lfavole |
'channel_is_verified': True,
'heatmap': 'count:100',
'section_end': 15,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 10,
... | I saw a few empty string descriptions in the tests; would be better to `filter` to get the resolving extractor's description instead IMO
```suggestion
'description': ('description', {clean_html}, filter),
``` | 'channel_is_verified': True,
'heatmap': 'count:100',
'section_end': 15,
'uploader': 'Blender',
'timestamp': 1415628355,
'uploader_url': 'https://www.youtube.com/@BlenderOfficial',
'age_limit': 0,
'section_start': 10,
... | @@ -0,0 +1,130 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import clean_html, int_or_none, traverse_obj, url_or_none, urlencode_postdata
+
+
+class DigiviewIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?ladigitale\.dev/digiview/#/v/(?P<id>[0-9a-f]+)'
+ _TESTS = [{
+... | yt_dlp/extractor/digiview.py | 26 | Python | 0.857 | refactor | 227 | 32 | 32 | false | [ie/Digiview] Add extractor | 9,902 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | lfavole |
@pytest.mark.parametrize('params,extensions', [
({'timeout': sys.float_info.min}, {}),
({}, {'timeout': sys.float_info.min}),
])
def test_read_timeout(self, handler, params, extensions):
with handler(**params) as rh:
with pytest.raises(TransportError):
ws_... | maybe this is more readable / cleaner?
```suggestion
def test_connect_timeout(self, handler):
# nothing should be listening on this port
connect_timeout_url = 'ws://10.255.255.255'
with handler(timeout=0.01) as rh, pytest.raises(TransportError):
now = time.time()
... | @pytest.mark.parametrize('params,extensions', [
({'timeout': sys.float_info.min}, {}),
({}, {'timeout': sys.float_info.min}),
])
def test_read_timeout(self, handler, params, extensions):
with handler(**params) as rh:
with pytest.raises(TransportError):
ws_... | @@ -202,11 +203,29 @@ def test_raise_http_error(self, handler, status):
({'timeout': sys.float_info.min}, {}),
({}, {'timeout': sys.float_info.min}),
])
- def test_timeout(self, handler, params, extensions):
+ def test_read_timeout(self, handler, params, extensions):
with handler(*... | test/test_websockets.py | 26 | Python | 1 | suggestion | 770 | 51 | 51 | false | [test] Fix connect timeout test | 9,906 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
'243': 'webm',
'244': 'webm',
'245': 'webm',
'246': 'webm',
'247': 'webm',
'248': 'webm',
'271': 'webm',
# itag 272 videos are either 3840x2160 (e.g. RtoitU2A-3E) or 7680x4320 (sLprVF6d7Ug)
'272': 'webm',
'302': 'webm',
'303': 'webm... | Don't think we need `_rtmp` since it doesn't have an `ext`
Why don't we *actually* import these from the youtube extractor:
```py
from .youtube import YoutubeIE
```
and
```py
_FORMATS_EXT = {
**{k: v['ext'] for k, v in YoutubeIE._formats.items() if v.get('ext')},
'50': 'mp3',
} | 'kind': '',
}
if origin_lang_code is not None:
query.update({'tlang': caption_lang_code})
caption_format_data.append({
'url': update_url_query(self._BASE_URL_CAPTIONS, query),
'ext': caption_f... | @@ -66,14 +66,106 @@ class GoogleDriveIE(InfoExtractor):
'22': 'mp4',
'34': 'flv',
'35': 'flv',
+ # itag 36 videos are either 320x180 (BaW_jenozKc) or 320x240 (__2ABJjxzNo), abr varies as well
'36': '3gp',
'37': 'mp4',
'38': 'mp4',
'43': 'webm',
... | yt_dlp/extractor/googledrive.py | 26 | Python | 0.857 | refactor | 314 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
'only_matching': True,
}, {
'url': 'https://drive.google.com/uc?id=0B2fjwgkl1A_CX083Tkowdmt6d28',
'only_matching': True,
}, {
'url': 'https://drive.usercontent.google.com/download?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
'only_matching': True,
}]
_FORMATS_EXT = {
... | Are you sure that `50` == `mp3` ? In the linked issue, two users said that `50` was `m4a` (and that `140` was `mp3`, but that seems wrong).
Can you add tests with example URLs for formats 50 and 140? | 'thumbnail': 'https://drive.google.com/thumbnail?id=1IP0o8dHcQrIHGgVyp0Ofvx2cGfLzyO1x',
},
}, {
# video can't be watched anonymously due to view count limit reached,
# but can be downloaded (see https://github.com/ytdl-org/youtube-dl/issues/14046)
'url': 'https://drive.go... | @@ -66,14 +66,106 @@ class GoogleDriveIE(InfoExtractor):
'22': 'mp4',
'34': 'flv',
'35': 'flv',
+ # itag 36 videos are either 320x180 (BaW_jenozKc) or 320x240 (__2ABJjxzNo), abr varies as well
'36': '3gp',
'37': 'mp4',
'38': 'mp4',
'43': 'webm',
... | yt_dlp/extractor/googledrive.py | 26 | Python | 0.643 | bug | 202 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
import re
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
determine_ext,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
int_or_none,
lowercase_escape,
try_get,
update_url_query,
)
from .youtube import Yo... | sort this under `from .common` | import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
bug_reports_message,
determine_ext,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
int_or_none,
lowercase_escape,
... | @@ -13,6 +13,7 @@
try_get,
update_url_query,
)
+from .youtube import YoutubeIE | yt_dlp/extractor/googledrive.py | 16 | Python | 0.214 | style | 30 | 41 | 41 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
}
}, {
# video can't be watched anonymously due to view count limit reached,
# but can be downloaded (see https://github.com/ytdl-org/youtube-dl/issues/14046)
'url': 'https://drive.google.com/file/d/0B-vUyvmDLdWDcEt4WjBqcmI2XzQ/view',
'only_matching': True,
}, {
#... | can we make this a full/proper test instead of `only_matching`? | 'thumbnail': 'https://drive.google.com/thumbnail?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
}
}, {
# has itag 50 which is not in YoutubeIE._formats (royalty Free music from 1922)
'url': 'https://drive.google.com/uc?id=1IP0o8dHcQrIHGgVyp0Ofvx2cGfLzyO1x',
'md5': '322db8d63dd19788c04... | @@ -56,24 +57,20 @@ class GoogleDriveIE(InfoExtractor):
}, {
'url': 'https://drive.usercontent.google.com/download?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
'only_matching': True,
+ }, {
+ 'url': 'https://drive.usercontent.google.com/download?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
+ 'only_mat... | yt_dlp/extractor/googledrive.py | 26 | Python | 0.429 | question | 63 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
import re
from .common import InfoExtractor
from ..compat import compat_parse_qs
from .youtube import YoutubeIE
from ..utils import (
ExtractorError,
determine_ext,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
int_or_none,
lowercase_escape,
try_get,
update_url_q... | ```suggestion
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import compat_parse_qs
``` | import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
bug_reports_message,
determine_ext,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
int_or_none,
lowercase_escape,
... | @@ -2,6 +2,7 @@
from .common import InfoExtractor
from ..compat import compat_parse_qs
+from .youtube import YoutubeIE | yt_dlp/extractor/googledrive.py | 4 | Python | 0.786 | refactor | 123 | 29 | 29 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
}
}, {
# video can't be watched anonymously due to view count limit reached,
# but can be downloaded (see https://github.com/ytdl-org/youtube-dl/issues/14046)
'url': 'https://drive.google.com/file/d/0B-vUyvmDLdWDcEt4WjBqcmI2XzQ/view',
'only_matching': True,
}, {
#... | please actually run the test and add in the required fields | 'thumbnail': 'https://drive.google.com/thumbnail?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
}
}, {
# has itag 50 which is not in YoutubeIE._formats (royalty Free music from 1922)
'url': 'https://drive.google.com/uc?id=1IP0o8dHcQrIHGgVyp0Ofvx2cGfLzyO1x',
'md5': '322db8d63dd19788c04... | @@ -56,24 +57,17 @@ class GoogleDriveIE(InfoExtractor):
}, {
'url': 'https://drive.usercontent.google.com/download?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
'only_matching': True,
+ }, {
+ # mp3 (format 50) tests
+ # Royalty Free music from 1922
+ # My Buddy by Henry Burr; Gus Kah... | yt_dlp/extractor/googledrive.py | 26 | Python | 0.214 | suggestion | 59 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
'title': 'My Buddy - Henry Burr - Gus Kahn - Walter Donaldson.mp3',
'duration': 184,
'thumbnail': 'https://drive.google.com/thumbnail?id=1IP0o8dHcQrIHGgVyp0Ofvx2cGfLzyO1x',
},
}, {
# video can't be watched anonymously due to view count limit reached,
# but... | ```suggestion
'50': 'm4a',
``` | 'ext': 'mp3',
'title': 'My Buddy - Henry Burr - Gus Kahn - Walter Donaldson.mp3',
'duration': 184,
'thumbnail': 'https://drive.google.com/thumbnail?id=1IP0o8dHcQrIHGgVyp0Ofvx2cGfLzyO1x',
},
}, {
# video can't be watched anonymously due to view count li... | @@ -58,22 +70,8 @@ class GoogleDriveIE(InfoExtractor):
'only_matching': True,
}]
_FORMATS_EXT = {
- '5': 'flv',
- '6': 'flv',
- '13': '3gp',
- '17': '3gp',
- '18': 'mp4',
- '22': 'mp4',
- '34': 'flv',
- '35': 'flv',
- '36': '3gp',
- ... | yt_dlp/extractor/googledrive.py | 26 | Python | 0.429 | suggestion | 40 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
class GoogleDriveIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:
(?:docs|drive|drive\.usercontent)\.google\.com/
(?:
(?:uc|open|download)\?.*?id=|
... | ```suggestion
# has itag 50 which is not in YoutubeIE._formats (royalty Free music from 1922)
``` |
class GoogleDriveIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:
(?:docs|drive|drive\.usercontent)\.google\.com/
(?:
(?:uc|open|download)\?.*?id=|
... | @@ -38,6 +39,17 @@ class GoogleDriveIE(InfoExtractor):
'duration': 45,
'thumbnail': 'https://drive.google.com/thumbnail?id=0ByeS4oOUV-49Zzh4R1J6R09zazQ',
}
+ }, {
+ # mp3 (format 50) - Royalty Free music from 1922 | yt_dlp/extractor/googledrive.py | 26 | Python | 0.714 | suggestion | 107 | 51 | 51 | false | [extractor/GoogleDrive] Add more supported types | 9,908 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WyohKnott |
}, {
# Age-restricted without vfilm redirection
'url': 'https://www.cda.pl/video/17028157b8',
'md5': 'c1fe5ff4582bace95d4f0ce0fbd0f992',
'info_dict': {
'id': '17028157b8',
'ext': 'mp4',
'title': 'STENDUPY MICHAŁ OGIŃSKI',
'description':... | ```suggestion
data, content_type = multipart_encode({'age_confirm': ''})
``` | }, {
# Age-restricted without vfilm redirection
'url': 'https://www.cda.pl/video/17028157b8',
'md5': 'c1fe5ff4582bace95d4f0ce0fbd0f992',
'info_dict': {
'id': '17028157b8',
'ext': 'mp4',
'title': 'STENDUPY MICHAŁ OGIŃSKI',
'description':... | @@ -63,38 +62,58 @@ class CDAIE(InfoExtractor):
'description': 'md5:60d76b71186dcce4e0ba6d4bbdb13e1a',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'crash404',
- 'view_count': int,
'average_rating': float,
'duration': 137,
'a... | yt_dlp/extractor/cda.py | 26 | Python | 0.714 | suggestion | 86 | 51 | 51 | false | [extractor/cda] Fix age restriction | 9,939 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Podiumnoche |
formats = [{
'url': quality['file'],
'format': quality.get('title'),
'resolution': quality.get('name'),
'height': try_call(lambda: int(quality['name'][:-1])),
'filesize': quality.get('length'),
} for quality in meta['qualities'] if quality.get(... | We aren't using the `url` param anymore since we are constructing a new one. Then we'd need to remove it from all method calls as well
```suggestion
def _web_extract(self, video_id):
``` | 'url': quality['file'],
'format': quality.get('title'),
'resolution': quality.get('name'),
'height': try_call(lambda: int(quality['name'][:-1])),
'filesize': quality.get('length'),
} for quality in meta['qualities'] if quality.get('file')]
if ... | @@ -199,17 +218,20 @@ def _api_extract(self, video_id):
def _web_extract(self, video_id, url): | yt_dlp/extractor/cda.py | 26 | Python | 0.786 | refactor | 193 | 51 | 51 | false | [extractor/cda] Fix age restriction | 9,939 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Podiumnoche |
raise ExtractorError(
'Video requires CDA Premium - subscription needed', expected=True)
return {
'id': video_id,
'title': meta.get('title'),
'description': meta.get('description'),
'uploader': None if uploader == 'anonim' else uploade... | Searching the html for this seems a bit odd. Does dirkf's suggestion [here](https://github.com/yt-dlp/yt-dlp/pull/6638#issuecomment-1666840370) not work? (after changing `urlh.geturl()` to `urlh.url`) | 'Video requires CDA Premium - subscription needed', expected=True)
return {
'id': video_id,
'title': meta.get('title'),
'description': meta.get('description'),
'uploader': None if uploader == 'anonim' else uploader,
'average_rating': f... | @@ -199,17 +218,20 @@ def _api_extract(self, video_id):
def _web_extract(self, video_id, url):
self._set_cookie('cda.pl', 'cda.player', 'html5')
- webpage = self._download_webpage(
- f'{self._BASE_URL}/video/{video_id}/vfilm', video_id)
+ url = f'{self._BASE_URL}/video/{video_id... | yt_dlp/extractor/cda.py | 26 | Python | 0.571 | suggestion | 200 | 51 | 51 | false | [extractor/cda] Fix age restriction | 9,939 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Podiumnoche |
'AT', 'BL', 'CH', 'DE', 'FR', 'GF', 'GP', 'LI',
'MC', 'MF', 'MQ', 'NC', 'PF', 'PM', 'RE', 'WF',
'YT',
),
'SAT': (
'AD', 'AT', 'AX', 'BG', 'BL', 'CH', 'CY', 'CZ',
'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GF',
'GR', 'HR', 'HU', 'IE'... | ```suggestion
for fmt in sub_formats:
url = fmt.get('url') or ''
suffix = ('acc' if url.endswith('-MAL.m3u8')
else 'partial' if '_VO' not in url
else None)
updated_subs.setdefault(join_nonempty(lang, su... | (?P<has_sub>-ST)
(?P<sdh_sub>M?)
(?P<sub_lang>[FA]|E\[[A-Z]+\]|EU)
)?
''')
# all obtained by exhaustive testing
_COUNTRIES_MAP = {
'DE_FR': (
'BL', 'DE', 'FR', 'GF', 'GP', 'MF', 'MQ', 'NC',
'PF', 'PM', 'RE', 'WF', 'YT',
),
... | @@ -142,17 +116,21 @@ class ArteTVIE(ArteTVBaseIE):
def _fix_accessible_subs_locale(subs):
updated_subs = {}
for lang, sub_formats in subs.items():
- for fmt in sub_formats:
- if fmt.get('url', '').endswith('-MAL.m3u8'):
- lang += '-acc'
- ... | yt_dlp/extractor/arte.py | 26 | Python | 0.786 | suggestion | 350 | 51 | 51 | false | [ie/ArteTV] Separate forced subtitle tracks | 9,945 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | vtexier |
'url': 'https://www.arte.tv/fr/videos/109067-000-A/la-loi-de-teheran/',
'info_dict': {
'id': '109067-000-A',
'ext': 'mp4',
'description': 'md5:d2ca367b8ecee028dddaa8bd1aebc739',
'timestamp': 1713927600,
'thumbnail': 'https://api-cdn.arte.tv/img... | Don't remove this test unless you can add another age-restricted test video | 'url': 'https://www.arte.tv/fr/videos/109067-000-A/la-loi-de-teheran/',
'info_dict': {
'id': '109067-000-A',
'ext': 'mp4',
'description': 'md5:d2ca367b8ecee028dddaa8bd1aebc739',
'timestamp': 1713927600,
'thumbnail': 'https://api-cdn.arte.tv/img... | @@ -59,33 +46,21 @@ class ArteTVIE(ArteTVBaseIE):
'url': 'https://www.arte.tv/de/videos/110203-006-A/zaz/',
'only_matching': True,
}, {
- 'note': 'age-restricted',
- 'url': 'https://www.arte.tv/de/videos/006785-000-A/the-element-of-crime/',
- 'info_dict': {
- 'id':... | yt_dlp/extractor/arte.py | 26 | Python | 0.286 | refactor | 75 | 51 | 51 | false | [ie/ArteTV] Separate forced subtitle tracks | 9,945 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | vtexier |
'url': 'https://www.arte.tv/en/videos/088501-000-A/mexico-stealing-petrol-to-survive/',
'only_matching': True,
}, {
'note': 'No alt_title',
'url': 'https://www.arte.tv/fr/videos/110371-000-A/la-chaleur-supplice-des-arbres-de-rue/',
'only_matching': True,
}, {
'url... | If the correct expected value is `None`, it doesn't need to be in the test. If not, put the correct value here and let the test fail
```suggestion
``` | 'url': 'https://www.arte.tv/en/videos/088501-000-A/mexico-stealing-petrol-to-survive/',
'only_matching': True,
}, {
'note': 'No alt_title',
'url': 'https://www.arte.tv/fr/videos/110371-000-A/la-chaleur-supplice-des-arbres-de-rue/',
'only_matching': True,
}, {
'url... | @@ -59,33 +46,21 @@ class ArteTVIE(ArteTVBaseIE):
'url': 'https://www.arte.tv/de/videos/110203-006-A/zaz/',
'only_matching': True,
}, {
- 'note': 'age-restricted',
- 'url': 'https://www.arte.tv/de/videos/006785-000-A/the-element-of-crime/',
- 'info_dict': {
- 'id':... | yt_dlp/extractor/arte.py | 26 | Python | 0.714 | bug | 152 | 51 | 51 | false | [ie/ArteTV] Separate forced subtitle tracks | 9,945 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | vtexier |
from .common import InfoExtractor
from ..utils import (
determine_ext,
KNOWN_EXTENSIONS,
str_to_int,
)
class HearThisAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?'
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
_TESTS = [{... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w-]+)'
``` | from .common import InfoExtractor
from ..utils import (
determine_ext,
KNOWN_EXTENSIONS,
str_to_int,
)
class HearThisAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w.-]+)'
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
_TESTS = [{
... | @@ -7,7 +7,7 @@
class HearThisAtIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?$'
+ _VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?' | yt_dlp/extractor/hearthisat.py | 10 | Python | 0.714 | suggestion | 109 | 35 | 35 | false | [ie/HearThisAt] Improve `_VALID_URL` | 9,949 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bohwaz |
determine_ext,
KNOWN_EXTENSIONS,
str_to_int,
)
class HearThisAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w.-]+)'
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
_TESTS = [{
'url': 'https://hearthis.at/moofi/dr-kreep',
'... | ```suggestion
'genres': ['Experimental'],
},
``` | determine_ext,
KNOWN_EXTENSIONS,
str_to_int,
)
class HearThisAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w.-]+)'
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
_TESTS = [{
'url': 'https://hearthis.at/moofi/dr-kreep',
'... | @@ -7,29 +7,32 @@
class HearThisAtIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?$'
+ _VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w.-]+)'
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
_TESTS = ... | yt_dlp/extractor/hearthisat.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | [ie/HearThisAt] Improve `_VALID_URL` | 9,949 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bohwaz |
# unique "install id"
'iid': None,
# TikTok (KR/PH/TW/TH/VN) = trill, TikTok (rest of world) = musical_ly, Douyin = aweme
'app_name': 'musical_ly',
'app_version': '34.1.2',
'manifest_app_version': '2023401020',
# "app id": aweme = 1128, trill = 1180, musical_ly = ... | using lower case makes more semantic sense, no? | _APP_INFO_DEFAULTS = {
# unique "install id"
'iid': None,
# TikTok (KR/PH/TW/TH/VN) = trill, TikTok (rest of world) = musical_ly, Douyin = aweme
'app_name': 'musical_ly',
'app_version': '34.1.2',
'manifest_app_version': '2023401020',
# "app id": aweme = 1128, ... | @@ -51,7 +51,17 @@ class TikTokBaseIE(InfoExtractor):
@property
def _KNOWN_APP_INFO(self):
- return self._configuration_arg('app_info', ie_key=TikTokIE)
+ # If we have a genuine device ID, we may not need any IID
+ default = [''] if self._KNOWN_DEVICE_ID else []
+ return self._co... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.071 | question | 47 | 51 | 51 | false | [ie/tiktok] Add `device_id` extractor-arg | 9,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'ac2': 'wifi5g',
'uoo': '1',
'carrier_region': 'US',
'op_region': 'US',
'build_number': self._APP_INFO['app_version'],
'region': 'US',
'ts': int(time.time()),
'iid': self._APP_INFO.get('iid'),
'device_id': self._... | It'll still show in the verbose head. So what's the point? | 'locale': 'en',
'ac2': 'wifi5g',
'uoo': '1',
'carrier_region': 'US',
'op_region': 'US',
'build_number': self._APP_INFO['app_version'],
'region': 'US',
'ts': int(time.time()),
'iid': self._APP_INFO.get('iid'),
... | @@ -173,8 +183,9 @@ def _call_api(self, ep, query, video_id, fatal=True,
max_tries = len(self._APP_INFO_POOL) + 1 # _APP_INFO_POOL + _APP_INFO
for count in itertools.count(1):
- self.write_debug(str(self._APP_INFO))
real_query = self._build_api_query(query)
+ devi... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.214 | question | 58 | 51 | 51 | false | [ie/tiktok] Add `device_id` extractor-arg | 9,951 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'uoo': '1',
'carrier_region': 'US',
'op_region': 'US',
'build_number': self._APP_INFO['app_version'],
'region': 'US',
'ts': int(time.time()),
'iid': self._APP_INFO.get('iid'),
'device_id': self._DEVICE_ID,
'openu... | ```suggestion
self.write_debug(str(self._APP_INFO))
real_query = self._build_api_query(query)
``` | 'ac2': 'wifi5g',
'uoo': '1',
'carrier_region': 'US',
'op_region': 'US',
'build_number': self._APP_INFO['app_version'],
'region': 'US',
'ts': int(time.time()),
'iid': self._APP_INFO.get('iid'),
'device_id': self._... | @@ -173,8 +183,9 @@ def _call_api(self, ep, query, video_id, fatal=True,
max_tries = len(self._APP_INFO_POOL) + 1 # _APP_INFO_POOL + _APP_INFO
for count in itertools.count(1):
- self.write_debug(str(self._APP_INFO))
real_query = self._build_api_query(query)
+ devi... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | bug | 124 | 51 | 51 | false | [ie/tiktok] Add `device_id` extractor-arg | 9,951 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
def watermark_info(url):
no_watermark = 'unwatermarked' in url
return {
'format_note': None if no_watermark else 'watermarked',
'source_preference': -1 if no_watermark else -2,
}
for play_url in traverse_obj(video_info, ('playAddr', (... | I suggest removing these width and height. `width` and `height` are the size of playAddr. The video of downloadAddr may has different resolution which size is not provided in `video_info` | height = int_or_none(video_info.get('height'))
ratio = try_call(lambda: width / height) or 0.5625
COMMON_FORMAT_INFO = {
'ext': 'mp4',
'vcodec': 'h264',
'acodec': 'aac',
}
for bitrate_info in traverse_obj(video_info, ('bitrateInfo', lambda _, ... | @@ -431,13 +441,32 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
formats.append({
+ **watermark_info(download_url),
'format_id': 'down... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.5 | suggestion | 187 | 51 | 51 | false | [ie/tiktok] Extract all web formats | 9,960 | yt-dlp/yt-dlp | 132,642 | Python | kclauhk | bashonly |
'format_id': 'play',
'url': self._proto_relative_url(play_url),
'ext': 'mp4',
'width': width,
'height': height,
})
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
... | can we calculate the ratio by `width` / `height`?
tiktok actually have videos in different aspect ratio:
https://www.tiktok.com/@awilern/video/7357655658960801031
~https://www.tiktok.com/@seventeen17_official/video/7365107718765513985~
https://www.tiktok.com/@htetwaiyanphyo777/video/7345404524338629909
https://www... | # bytevc2 is bytedance's own custom h266/vvc codec, as-of-yet unplayable
is_bytevc2 = format_info.get('vcodec') == 'bytevc2'
format_info.update({
'format_note': 'UNPLAYABLE' if is_bytevc2 else None,
'preference': -100 if is_bytevc2 else -1,
... | @@ -431,13 +441,32 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
formats.append({
+ **watermark_info(download_url),
'format_id': 'down... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.571 | question | 373 | 51 | 51 | false | [ie/tiktok] Extract all web formats | 9,960 | yt-dlp/yt-dlp | 132,642 | Python | kclauhk | bashonly |
'source_preference': -1 if no_watermark else -2,
}
for play_url in traverse_obj(video_info, ('playAddr', ((..., 'src'), None), {url_or_none})):
formats.append({
**watermark_info(play_url),
'format_id': 'play',
'url': self._... | can we use a portion of the UrlKey as the format_id so that it yields similar format id as before, e.g. bytevc1_540p_xxxxxxx?
we can use the same function `parse_url_key` in `_parse_aweme_video_app` to obtain such id. | 'acodec': 'aac',
}
for bitrate_info in traverse_obj(video_info, ('bitrateInfo', lambda _, v: v['PlayAddr']['UrlList'])):
format_info, res = self._parse_url_key(
traverse_obj(bitrate_info, ('PlayAddr', 'UrlKey', {str})) or '')
# bytevc2 is bytedance's ... | @@ -431,13 +441,32 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url, video_id):
for download_url in traverse_obj(video_info, (('downloadAddr', ('download', 'url')), {url_or_none})):
formats.append({
+ **watermark_info(download_url),
'format_id': 'down... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.643 | question | 218 | 51 | 51 | false | [ie/tiktok] Extract all web formats | 9,960 | yt-dlp/yt-dlp | 132,642 | Python | kclauhk | bashonly |
try:
return self._call_api_impl(ep, real_query, video_id, fatal, note, errnote)
except ExtractorError as e:
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
message = str(e.cause or e.msg)
if not self._get_... | ```suggestion
webpage = self._download_webpage(url, video_id, headers={'User-Agent': 'Mozilla/5.0'}, fatal=fatal) or ''
``` | try:
return self._call_api_impl(ep, real_query, video_id, fatal, note, errnote)
except ExtractorError as e:
if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
message = str(e.cause or e.msg)
if not self._get_... | @@ -212,7 +212,31 @@ def _extract_aweme_app(self, aweme_id):
raise ExtractorError('Unable to find video in feed', video_id=aweme_id)
return self._parse_aweme_video_app(aweme_detail)
- def _get_subtitles(self, aweme_detail, aweme_id):
+ def _extract_web_data_and_status(self, url, video_id, ... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | suggestion | 133 | 51 | 51 | false | [ie/tiktok] Fix subtitles extraction | 9,961 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
}]
_API_BASE_URL = 'https://www.tiktok.com/api/collection/item_list/'
_PAGE_COUNT = 30
def _build_web_query(self, collection_id, cursor):
return {
'aid': '1988',
'collectionId': collection_id,
'count': self._PAGE_COUNT,
'cursor': cursor,
... | note to self: fix this after merging #9661 | 'expected_warnings': ['Retrying']
}, {
'url': 'https://tiktok.com/tag/fypシ?is_copy_url=0&is_from_webapp=v1',
'only_matching': True
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id, headers={
... | @@ -1083,6 +1083,63 @@ def _real_extract(self, url):
return self.playlist_result(self._entries(tag_id, display_id), tag_id, display_id)
+class TikTokCollectionIE(TikTokBaseIE):
+ IE_NAME = 'tiktok:collection'
+ _VALID_URL = r'https?://www\.tiktok\.com/@(?P<user_id>[\w.-]+)/collection/(?P<title>[^/?#]... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.071 | suggestion | 42 | 51 | 51 | false | Add Tiktok collection support | 9,986 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | imanoreotwe |
def init_poolmanager(self, *args, **kwargs):
return super().init_poolmanager(*args, **kwargs, **self._pm_args)
def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs = {}
if not proxy.lower().startswith('socks') and self._proxy_ssl_context:
extra_kwargs['proxy_ssl... | Technically we already validate all this already, so only need to use our select_proxy
Up to you though | def init_poolmanager(self, *args, **kwargs):
return super().init_poolmanager(*args, **kwargs, **self._pm_args)
def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs = {}
if not proxy.lower().startswith('socks') and self._proxy_ssl_context:
extra_kwargs['proxy_ssl_... | @@ -180,14 +182,27 @@ def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs['proxy_ssl_context'] = self._proxy_ssl_context
return super().proxy_manager_for(proxy, **proxy_kwargs, **self._pm_args, **extra_kwargs)
+ # Skip `requests` internal verification; we use our own SSLContext
+... | yt_dlp/networking/_requests.py | 26 | Python | 0.429 | suggestion | 104 | 51 | 51 | false | [rh:requests] Patch support for `requests` 2.31+, 2.32.2+ | 9,992 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | Grub4K |
super().__init__(**kwargs)
def init_poolmanager(self, *args, **kwargs):
return super().init_poolmanager(*args, **kwargs, **self._pm_args)
def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs = {}
if not proxy.lower().startswith('socks') and self._proxy_ssl_context:
... | Should this also be used for the proxy manager connection from URL above? | super().__init__(**kwargs)
def init_poolmanager(self, *args, **kwargs):
return super().init_poolmanager(*args, **kwargs, **self._pm_args)
def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs = {}
if not proxy.lower().startswith('socks') and self._proxy_ssl_context:
... | @@ -180,14 +181,23 @@ def proxy_manager_for(self, proxy, **proxy_kwargs):
extra_kwargs['proxy_ssl_context'] = self._proxy_ssl_context
return super().proxy_manager_for(proxy, **proxy_kwargs, **self._pm_args, **extra_kwargs)
+ # Skip `requests` internal verification; we use our own SSLContext
+... | yt_dlp/networking/_requests.py | 26 | Python | 0.286 | question | 73 | 51 | 51 | false | [rh:requests] Patch support for `requests` 2.31+, 2.32.2+ | 9,992 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | Grub4K |
import base64
import json
from .common import InfoExtractor
from ..utils import (
mimetype2ext,
traverse_obj,
url_or_none,
)
class VidflexIE(InfoExtractor):
_VALID_URL = r'https?://(?:[^/]+)/[a-z]{2}(?:-[a-z]{2})?/c/[\w-]+\.(?P<id>\d+)'
_TESTS = [{
'url': 'https://video.hockeycanada.ca/en... | We should not match such a generic regex. Since a embed extractor is also not really viable, we need to hardcode the supported domains.
I was thinking something like this (untested)
```py
_DOMAINS = [
'video.hockeycanada.ca',
'www.figureitoutbaseball.com',
'videos.telusworldofscienceed... | import base64
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
join_nonempty,
mimetype2ext,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidflexIE(InfoExtractor):
_DOMAINS_RE = [
r'[^.]+\.vidflex\.tv',
r'(?:www\.)?acactv\.ca',
... | @@ -0,0 +1,124 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ mimetype2ext,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class VidflexIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[^/]+)/[a-z]{2}(?:-[a-z]{2})?/c/[\w-]+\.(?P<id>\d+)' | yt_dlp/extractor/vidflex.py | 13 | Python | 0.857 | security | 650 | 38 | 38 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pzhlkj6612 |
}, {
'url': 'https://www.figureitoutbaseball.com/en/c/fiob-podcast-14-dan-bertolini-ncaa-d1-head-coach-recorded-11-29-2018.1367',
'only_matching': True,
}, {
'url': 'https://videos.telusworldofscienceedmonton.ca/en/c/the-aurora-project-timelapse-4.577',
'only_matching': True,
... | ```suggestion
r'content_api:\s*(["\'])(?P<url>https?://(?:(?!\1).)+)\1', webpage, 'content api url', group='url')
``` | 'url': 'https://myfbcgreenville.vidflex.tv/en/c/may-12th-2024.658',
'only_matching': True,
}, {
'url': 'https://www.figureitoutbaseball.com/en/c/fiob-podcast-14-dan-bertolini-ncaa-d1-head-coach-recorded-11-29-2018.1367',
'only_matching': True,
}, {
'url': 'https://videos.... | @@ -0,0 +1,150 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ mimetype2ext,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ r'(?:www\.)?acactv\.ca',
+ r'(?:www\.)?albertalac... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.714 | suggestion | 131 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
r'[^.]+\.vidflex\.tv',
r'(?:www\.)?acactv\.ca',
r'(?:www\.)?albertalacrossetv\.com',
r'(?:www\.)?cjfltv\.com',
r'(?:www\.)?figureitoutbaseball\.com',
r'(?:www\.)?ocaalive\.com',
r'(?:www\.)?pegasussports\.tv',
r'(?:www\.)?praxisseries\.ca',
r'(?:ww... | ```suggestion
_VALID_URL = rf'https?://(?:{"|".join(_DOMAINS_RE)})/[a-z]{{2}}(?:-[a-z]{{2}})?/c/[\w-]+\.(?P<id>\d+)'
``` | class VidflexIE(InfoExtractor):
_DOMAINS_RE = [
r'[^.]+\.vidflex\.tv',
r'(?:www\.)?acactv\.ca',
r'(?:www\.)?albertalacrossetv\.com',
r'(?:www\.)?cjfltv\.com',
r'(?:www\.)?figureitoutbaseball\.com',
r'(?:www\.)?ocaalive\.com',
r'(?:www\.)?pegasussports\.tv',
... | @@ -0,0 +1,150 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ mimetype2ext,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ r'(?:www\.)?acactv\.ca',
+ r'(?:www\.)?albertalac... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.714 | suggestion | 126 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
return {
'id': video_id,
'formats': [*self._yield_formats(media_config, video_id)],
**self._search_json_ld(
webpage.replace('/*<![CDATA[*/', '').replace('/*]]>*/', ''), video_id),
}
def _yield_formats(self, media_config, video_id):
for med... | ```suggestion
elif media_type == 'mp4':
bitrate = self._search_regex(r'_(\d+)k\.mp4', media_url, 'bitrate', default=None)
yield {
'format_id': join_nonempty('http', bitrate),
'url': media_url,
'ext': 'mp4',
... | ('config', {base64.b64decode}, {bytes.decode}, {json.loads}, {dict}))
return {
'id': video_id,
'formats': list(self._yield_formats(media_config, video_id)),
**self._search_json_ld(
webpage.replace('/*<![CDATA[*/', '').replace('/*]]>*/', ''), video... | @@ -0,0 +1,150 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ mimetype2ext,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ r'(?:www\.)?acactv\.ca',
+ r'(?:www\.)?albertalac... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.929 | suggestion | 390 | 32 | 30 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
}, {
# m3u8 + https
'url': 'https://video.hockeycanada.ca/en-us/c/nwt-micd-up-with-jamie-lee-rattray.107486',
'info_dict': {
'id': '107486',
'title': 'NWT: Mic’d up with Jamie Lee Rattray',
'ext': 'mp4',
'duration': 115,
'timestamp'... | ```suggestion
'description': r're:.+Canada’s National Men’s Team.+',
``` | }, {
# m3u8 + https
'url': 'https://video.hockeycanada.ca/en-us/c/nwt-micd-up-with-jamie-lee-rattray.107486',
'info_dict': {
'id': '107486',
'title': 'NWT: Mic’d up with Jamie Lee Rattray',
'ext': 'mp4',
'duration': 115,
'timestamp'... | @@ -0,0 +1,148 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ join_nonempty,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ ... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.571 | suggestion | 86 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
r'video\.hockeycanada\.ca',
r'video\.huuayaht\.org',
r'video\.turningpointensemble\.ca',
r'videos\.livingworks\.net',
r'videos\.telusworldofscienceedmonton\.ca',
r'watch\.binghamtonbulldogs\.com',
r'watch\.rekindle\.tv',
r'watch\.wpca\.com',
]
_VAL... | ```suggestion
'thumbnail': r're:^https?://wpmedia01-a\.akamaihd\.net/en/asset/public/image/.+',
``` | r'video\.hockeycanada\.ca',
r'video\.huuayaht\.org',
r'video\.turningpointensemble\.ca',
r'videos\.livingworks\.net',
r'videos\.telusworldofscienceedmonton\.ca',
r'watch\.binghamtonbulldogs\.com',
r'watch\.rekindle\.tv',
r'watch\.wpca\.com',
]
_VAL... | @@ -0,0 +1,148 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ join_nonempty,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ ... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
# m3u8 + https
'url': 'https://video.hockeycanada.ca/en-us/c/nwt-micd-up-with-jamie-lee-rattray.107486',
'info_dict': {
'id': '107486',
'title': 'NWT: Mic’d up with Jamie Lee Rattray',
'ext': 'mp4',
'duration': 115,
'timestamp': 1634310... | ```suggestion
'thumbnail': r're:^https?://wpmedia01-a\.akamaihd\.net/en/asset/public/image/.+',
``` | # m3u8 + https
'url': 'https://video.hockeycanada.ca/en-us/c/nwt-micd-up-with-jamie-lee-rattray.107486',
'info_dict': {
'id': '107486',
'title': 'NWT: Mic’d up with Jamie Lee Rattray',
'ext': 'mp4',
'duration': 115,
'timestamp': 1634310... | @@ -0,0 +1,148 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ join_nonempty,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ ... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'url': 'https://video.hockeycanada.ca/en/c/mwc-remembering-the-wild-ride-in-riga.112307',
'info_dict': {
'id': '112307',
'title': 'MWC: Remembering the wild ride in Riga',
'ext': 'mp4',
'duration': 322,
'timestamp': 1716235607,
'upl... | ```suggestion
'thumbnail': r're:^https?://wpmedia01-a\.akamaihd\.net/en/asset/public/image/.+',
``` | 'url': 'https://video.hockeycanada.ca/en/c/mwc-remembering-the-wild-ride-in-riga.112307',
'info_dict': {
'id': '112307',
'title': 'MWC: Remembering the wild ride in Riga',
'ext': 'mp4',
'duration': 322,
'timestamp': 1716235607,
'upl... | @@ -0,0 +1,148 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ join_nonempty,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ ... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.714 | suggestion | 113 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'url': 'https://www.tuffhedemantv.com/en/c/2022-tuff-hedeman-tour-hobbs-nm-january-22.227',
'only_matching': True,
}, {
'url': 'https://www.albertalacrossetv.com/en/c/up-floor-ground-balls-one-more.3449',
'only_matching': True,
}, {
'url': 'https://www.silenticetv.com/en/... | ```suggestion
'formats': list(self._yield_formats(media_config, video_id)),
``` | 'url': 'https://www.tuffhedemantv.com/en/c/2022-tuff-hedeman-tour-hobbs-nm-january-22.227',
'only_matching': True,
}, {
'url': 'https://www.albertalacrossetv.com/en/c/up-floor-ground-balls-one-more.3449',
'only_matching': True,
}, {
'url': 'https://www.silenticetv.com/en/... | @@ -0,0 +1,148 @@
+import base64
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ join_nonempty,
+ mimetype2ext,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class VidflexIE(InfoExtractor):
+ _DOMAINS_RE = [
+ r'[^.]+\.vidflex\.tv',
+ ... | yt_dlp/extractor/vidflex.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [ie/Vidflex] Add extractor | 10,002 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'display_id': video_id,
'formats': formats,
**info,
})
if entries:
return self.playlist_result(entries, video_id, info.get('title'))
raise ExtractorError('No media found', expected=True)
... | use `parse_qs` and `update_url_query`, and move the `caption_url` assignment down below where we use it
```suggestion
hls_playlist_url = playlist_urls[1] or f'https://v.redd.it/{video_id}/HLSPlaylist.m3u8'
qs = traverse_obj(parse_qs(hls_playlist_url), {
'f': ('f', 0, {lambda ... | formats = []
if media.get('hlsUrl'):
formats.extend(self._extract_m3u8_formats(
unescapeHTML(media['hlsUrl']), video_id, 'mp4', m3u8_id='hls', fatal=False))
if media.get('dashUrl'):
formats.extend(self._extra... | @@ -306,7 +349,8 @@ def add_thumbnail(src):
'video_id', default=display_id)
dash_playlist_url = playlist_urls[0] or f'https://v.redd.it/{video_id}/DASHPlaylist.mpd'
- hls_playlist_url = playlist_urls[1] or f'https://v.redd.it/{video_id}/HLSPlaylist.m3u8'
+ hls_playl... | yt_dlp/extractor/reddit.py | 26 | Python | 0.857 | suggestion | 465 | 51 | 51 | false | [ie/reddit] Fix subtitle extraction | 10,006 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
r'https?://v\.redd\.it/(?P<id>[^/?#&]+)', reddit_video['fallback_url'],
'video_id', default=display_id)
dash_playlist_url = playlist_urls[0] or f'https://v.redd.it/{video_id}/DASHPlaylist.mpd'
hls_playlist_url = re.sub(r'(f=[^&]+)', r'\1%2CsubsAll', playlist_urls... | `caption_url` can go here
```suggestion
caption_url = f'https://v.redd.it/{video_id}/wh_ben_en.vtt'
if not subtitles and self._is_valid_url(caption_url, video_id, item='subtitle'):
``` | (None, ('crosspost_parent_list', ...)), ('secure_media', 'media'), 'reddit_video'), get_all=False)
if reddit_video:
playlist_urls = [
try_get(reddit_video, lambda x: unescapeHTML(x[y]))
for y in ('dash_url', 'hls_url')
]
# Update v... | @@ -326,6 +370,8 @@ def add_thumbnail(src):
dash_playlist_url, display_id, mpd_id='dash', fatal=False)
formats.extend(dash_fmts)
self._merge_subtitles(dash_subs, target=subtitles)
+ if not subtitles and self._is_valid_url(caption_url, video_id, item='subtitle'): | yt_dlp/extractor/reddit.py | 26 | Python | 0.786 | suggestion | 212 | 51 | 51 | false | [ie/reddit] Fix subtitle extraction | 10,006 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'video_id', default=display_id)
dash_playlist_url = playlist_urls[0] or f'https://v.redd.it/{video_id}/DASHPlaylist.mpd'
hls_playlist_url = re.sub(r'(f=[^&]+)', r'\1%2CsubsAll', playlist_urls[1]) or f'https://v.redd.it/{video_id}/HLSPlaylist.m3u8?f=hd%2CsubsAll'
capt... | if `subtitles` is falsy then there's nothing to merge:
```suggestion
subtitles = {'en': [{'url': caption_url}]}
``` | if reddit_video:
playlist_urls = [
try_get(reddit_video, lambda x: unescapeHTML(x[y]))
for y in ('dash_url', 'hls_url')
]
# Update video_id
display_id = video_id
video_id = self._search_regex(
r'https?:/... | @@ -326,6 +370,8 @@ def add_thumbnail(src):
dash_playlist_url, display_id, mpd_id='dash', fatal=False)
formats.extend(dash_fmts)
self._merge_subtitles(dash_subs, target=subtitles)
+ if not subtitles and self._is_valid_url(caption_url, video_id, item='subtitle'):
+ ... | yt_dlp/extractor/reddit.py | 26 | Python | 0.714 | suggestion | 134 | 51 | 51 | false | [ie/reddit] Fix subtitle extraction | 10,006 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kclauhk |
'id': '13875948',
'ext': 'mp4',
'title': 'md5:660df5481fd418bc3bbb0d070e6fdb5a',
'thumbnail': 'https://photos.tf1.fr/1280/720/presidentielle-2022-marine-le-pen-et-emmanuel-macron-invites-de-lci-ce-vendredi-9c0e73-e1a036-0@1x.jpg',
'upload_d... | How about:
```suggestion
wat_id = traverse_obj(next_data, (
'props', 'pageProps', 'page', 'tms', 'videos', {dict.keys}, ..., {int_or_none}, any))
if not wat_id:
raise ExtractorError('Could not find wat_id')
return self.url_result(f'wat:{wat_id}', WatIE, wat_id)
... | 'id': '13875948',
'ext': 'mp4',
'title': 'md5:660df5481fd418bc3bbb0d070e6fdb5a',
'thumbnail': 'https://photos.tf1.fr/1280/720/presidentielle-2022-marine-le-pen-et-emmanuel-macron-invites-de-lci-ce-vendredi-9c0e73-e1a036-0@1x.jpg',
'upload_date': '20220422',
... | @@ -1,28 +1,50 @@
from .common import InfoExtractor
+from ..utils.traversal import traverse_obj
+
class LCIIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/[^/]+/[\w-]+-(?P<id>\d+)\.html'
- _TESTS = [{
- 'url': 'https://www.tf1info.fr/politique/election-presidentielle-2022-s... | yt_dlp/extractor/lci.py | 26 | Python | 1 | refactor | 422 | 27 | 26 | false | [ie/LCI] Fix extractor | 10,025 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ocococococ |
from .common import InfoExtractor
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr(?:/[^/]+)+/[\w-]+-(?P<id>\d+)\.html'
_TESTS = [
{
'url': 'https://www.tf1info.fr/replay-lci/videos/video-24h-pujadas-du-vendredi-2... | ```suggestion
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
``` | from .common import InfoExtractor
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/(?:[^/?#]+/)+[\w-]+-(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.t... | @@ -1,28 +1,50 @@
from .common import InfoExtractor
+from ..utils.traversal import traverse_obj | yt_dlp/extractor/lci.py | 3 | Python | 0.929 | refactor | 135 | 28 | 28 | false | [ie/LCI] Fix extractor | 10,025 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ocococococ |
from .common import InfoExtractor
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr(?:/[^/]+)+/[\w-]+-(?P<id>\d+)\.html'
_TESTS = [
{
'url': 'ht... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/(?:[^/?#]+/)+[\w-]+-(?P<id>\d+)\.html'
``` | from .common import InfoExtractor
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/(?:[^/?#]+/)+[\w-]+-(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.t... | @@ -1,28 +1,53 @@
from .common import InfoExtractor
+from .wat import WatIE
+from ..utils import ExtractorError, int_or_none
+from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/[^/]+/[\w-]+-(?P<id>\d+)\.html'
- _TESTS = [{
- ... | yt_dlp/extractor/lci.py | 8 | Python | 0.714 | suggestion | 116 | 33 | 33 | false | [ie/LCI] Fix extractor | 10,025 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ocococococ |
'id': '13875948',
'ext': 'mp4',
'title': 'md5:660df5481fd418bc3bbb0d070e6fdb5a',
'thumbnail': 'https://photos.tf1.fr/1280/720/presidentielle-2022-marine-le-pen-et-emmanuel-macron-invites-de-lci-ce-vendredi-9c0e73-e1a036-0@1x.jpg',
'upload_d... | ```suggestion
next_data = self._search_nextjs_data(webpage, video_id)
wat_id = traverse_obj(next_data, (
'props', 'pageProps', 'page', 'tms', 'videos', {dict.keys}, ..., {int_or_none}, any))
if wat_id is None:
raise ExtractorError('Could not find wat_id')
``` | from .common import InfoExtractor
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/(?:[^/?#]+/)+[\w-]+-(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.t... | @@ -1,28 +1,53 @@
from .common import InfoExtractor
+from .wat import WatIE
+from ..utils import ExtractorError, int_or_none
+from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/[^/]+/[\w-]+-(?P<id>\d+)\.html'
- _TESTS = [{
- ... | yt_dlp/extractor/lci.py | 26 | Python | 1 | refactor | 313 | 29 | 50 | false | [ie/LCI] Fix extractor | 10,025 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ocococococ |
'title': 'md5:660df5481fd418bc3bbb0d070e6fdb5a',
'thumbnail': 'https://photos.tf1.fr/1280/720/presidentielle-2022-marine-le-pen-et-emmanuel-macron-invites-de-lci-ce-vendredi-9c0e73-e1a036-0@1x.jpg',
'upload_date': '20220422',
'duration': 33,
},... | ```suggestion
return self.url_result(f'wat:{wat_id}', WatIE, str(wat_id))
``` | from .common import InfoExtractor
from .wat import WatIE
from ..utils import ExtractorError, int_or_none
from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/(?:[^/?#]+/)+[\w-]+-(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.t... | @@ -1,28 +1,53 @@
from .common import InfoExtractor
+from .wat import WatIE
+from ..utils import ExtractorError, int_or_none
+from ..utils.traversal import traverse_obj
class LCIIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?(?:lci|tf1info)\.fr/[^/]+/[\w-]+-(?P<id>\d+)\.html'
- _TESTS = [{
- ... | yt_dlp/extractor/lci.py | 26 | Python | 0.571 | suggestion | 87 | 27 | 50 | false | [ie/LCI] Fix extractor | 10,025 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ocococococ |
return traverse_obj(api_json, {
'id': ('id', {int}, {str_or_none}),
'age_limit': ('age_classification', {parse_age_limit}),
'duration': ('exact_duration', {functools.partial(float_or_none, scale=1000)}),
'title': (('title', 'headline'), {str}),
'descri... | Surely a sensible set of short names for `functools` expressions like these can be agreed by now? | # Video with multiple segments, but with combined version
'url': 'https://on.orf.at/video/14228172',
'info_dict': {
'id': '14228172',
'ext': 'mp4',
'duration': 3294.878,
'thumbnail': 'https://api-tvthek.orf.at/assets/segments/0176/17/thumb_17516455... | @@ -418,18 +424,65 @@ class ORFONIE(InfoExtractor):
'media_type': 'episode',
'timestamp': 52916400,
'upload_date': '19710905',
+ 'release_timestamp': 52916400,
+ 'release_date': '19710905',
+ 'modified_timestamp': 1498536049,
+ 'modified... | yt_dlp/extractor/orf.py | 26 | Python | 0.357 | question | 100 | 51 | 51 | false | [ie/orf:on] Support segmented episodes | 10,053 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | seproDev |
from .common import InfoExtractor
from .vimeo import VimeoIE
class LaracastsPlaylistIE(InfoExtractor):
IE_NAME = 'laracasts:series'
_VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<series>[^/?#]+)'
_TESTS = [{
'url': 'https://laracasts.com/series/30-days-to-learn-laravel-11',
'i... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<series>[^/?#]+)/?(?:$|[?#])'
``` | import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | @@ -0,0 +1,56 @@
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+
+
+class LaracastsPlaylistIE(InfoExtractor):
+ IE_NAME = 'laracasts:series'
+ _VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<series>[^/?#]+)' | yt_dlp/extractor/laracasts.py | 7 | Python | 0.857 | suggestion | 112 | 32 | 32 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
IE_NAME = 'laracasts:series'
_VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<series>[^/?#]+)/?(?:$|[?#])'
_TESTS = [{
'url': 'https://laracasts.com/series/30-days-to-learn-laravel-11',
'info_dict': {
'title': '30 Days to Learn Laravel',
'id': 210,
... | ```suggestion
return self.playlist_result(self._entries(display_id, episode_count), playlist_id, playlist_title)
class LaracastsIE(InfoExtractor):
``` | clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LaracastsBaseIE(InfoExtractor):
def _get_prop_data(self, url, display_id):
webpage... | @@ -0,0 +1,56 @@
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+
+
+class LaracastsPlaylistIE(InfoExtractor):
+ IE_NAME = 'laracasts:series'
+ _VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<series>[^/?#]+)/?(?:$|[?#])'
+ _TESTS = [{
+ 'url': 'https://laracasts.com/series/30... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.929 | refactor | 165 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
'description': 'md5:27c260a1668a450984e8f901579912dd',
'categories': ['Frameworks'],
'tags': ['Laravel'],
'display_id': '30-days-to-learn-laravel-11',
},
'playlist_count': 30,
}]
def _entries(self, series, episode_count):
for current_episo... | ```suggestion
'categories': ('taxonomy', 'name', {str}, {lambda x: x and [x]}),
``` | 'duration': 30600.0,
'modified_date': '20240511',
'description': 'md5:27c260a1668a450984e8f901579912dd',
'categories': ['Frameworks'],
'tags': ['Laravel'],
'display_id': '30-days-to-learn-laravel-11',
},
'playlist_count': 30,
}]... | @@ -0,0 +1,117 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.714 | suggestion | 101 | 34 | 31 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | ASertacAkkaya |
import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | private methods
```suggestion
def _get_prop_data(self, url, display_id):
webpage = self._download_webpage(url, display_id)
return traverse_obj(
get_element_html_by_id('app', webpage), ({extract_attributes}, 'data-page', {json.loads}, 'props'))
def _parse_episode(self, episode... | import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | @@ -0,0 +1,117 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 25 | Python | 0.857 | refactor | 327 | 50 | 50 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LaracastsBaseIE(InfoExtractor):
def _get_... | ```suggestion
VimeoIE._smuggle_referrer(
f'https://player.vimeo.com/video/{episode["vimeoId"]}', 'https://laracasts.com/'),
``` | from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LaracastsBaseIE(InfoExtractor):
def _get_... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.857 | suggestion | 158 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | ```suggestion
if not traverse_obj(episode, 'vimeoId'):
``` | import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | ```suggestion
get_element_html_by_id('app', webpage),
({extract_attributes}, 'data-page', {json.loads}, 'props'))
``` | import json
from .common import InfoExtractor
from .vimeo import VimeoIE
from ..utils import (
clean_html,
extract_attributes,
get_element_html_by_id,
int_or_none,
parse_duration,
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
clas... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 23 | Python | 0.786 | refactor | 144 | 48 | 48 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LaracastsBaseIE(InfoExtractor):
def _get_prop_data(self, url, display_id):
webpage = self._download_webpage(url, display_id)
return traverse_obj(
get_element_html_by_i... | ```suggestion
'season_number': ('chapter', {int_or_none}),
'episode_number': ('position', {int_or_none}),
``` | str_or_none,
unified_strdate,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class LaracastsBaseIE(InfoExtractor):
def _get_prop_data(self, url, display_id):
webpage = self._download_webpage(url, display_id)
return traverse_obj(
get_element_html_by_i... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
webpage = self._download_webpage(url, display_id)
return traverse_obj(
get_element_html_by_id('app', webpage), ({extract_attributes}, 'data-page', {json.loads}, 'props'))
def _parse_episode(self, episode):
if not episode.get('vimeoId'):
self.raise_login_required('Thi... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<id>[\w-]+/episodes/\d+)/?(?:[?#]|$)'
``` | webpage = self._download_webpage(url, display_id)
return traverse_obj(
get_element_html_by_id('app', webpage),
({extract_attributes}, 'data-page', {json.loads}, 'props'))
def _parse_episode(self, episode):
if not traverse_obj(episode, 'vimeoId'):
self.rai... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.857 | suggestion | 120 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
'id': '922040563',
'title': 'Hello, Laravel',
'ext': 'mp4',
'duration': 519,
'date': '20240312',
'thumbnail': 'https://laracasts.s3.amazonaws.com/videos/thumbnails/youtube/30-days-to-learn-laravel-11-1.png',
'description': 'md5:ddd658bb... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?laracasts\.com/series/(?P<id>[\w-]+)/?(?:[?#]|$)'
``` | 'md5': 'c8f5e7b02ad0e438ef9280a08c8493dc',
'info_dict': {
'id': '922040563',
'title': 'Hello, Laravel',
'ext': 'mp4',
'duration': 519,
'date': '20240312',
'thumbnail': 'https://laracasts.s3.amazonaws.com/videos/thumbnails/youtube/30... | @@ -0,0 +1,112 @@
+import json
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ get_element_html_by_id,
+ int_or_none,
+ parse_duration,
+ str_or_none,
+ unified_strdate,
+ url_or_none,
+ urljoin,
+)
+from ..utils.tr... | yt_dlp/extractor/laracasts.py | 26 | Python | 0.857 | suggestion | 107 | 51 | 51 | false | [ie/laracasts] Add extractors | 10,055 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ASertacAkkaya |
metadata['title'] += format_field(selected_tab, 'expandedText', ' - %s')
return self.playlist_result(
self._entries(
selected_tab, metadata['id'], ytcfg,
self._extract_account_syncid(ytcfg, data),
self._extract_visitor_data(data, ytcfg)),
... | ```suggestion
# pageHeaderViewModel slow rollout began April 2024
``` |
return self.playlist_result(
self._entries(
selected_tab, metadata['id'], ytcfg,
self._extract_account_syncid(ytcfg, data),
self._extract_visitor_data(data, ytcfg)),
**metadata)
def _extract_metadata_from_tabs(self, item_id, data):
... | @@ -5125,6 +5125,10 @@ def _extract_metadata_from_tabs(self, item_id, data):
else:
metadata_renderer = traverse_obj(data, ('metadata', 'playlistMetadataRenderer'), expected_type=dict)
+ # pageHeaderViewModel slow rollout started May 2024 | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | performance | 79 | 51 | 51 | false | [ie/youtube:tab] Fix channel metadata extraction | 10,071 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate import ImpersonateRequestHandler, ImpersonateTarget
from ..dependencies import curl_cffi, certifi
from ..utils import int_or_none
if curl_cffi is None:
rais... | ```suggestion
```
debug leftover | from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate import ImpersonateRequestHandler, ImpersonateTarget
from ..dependencies import curl_cffi, certifi
from ..utils import int_or_none
if curl_cffi is None:
rais... | @@ -27,11 +28,19 @@
if curl_cffi is None:
raise ImportError('curl_cffi is not installed')
-curl_cffi_version = tuple(int_or_none(x, default=0) for x in curl_cffi.__version__.split('.'))
-if curl_cffi_version != (0, 5, 10):
+def group_or_none(n):
+ r = re.match(r'\d+', n)
+ if r:
+ return r.group(... | yt_dlp/networking/_curlcffi.py | 26 | Python | 0.571 | bug | 34 | 51 | 51 | false | [rh:curl_cffi] Support curl-cffi 0.7.X | 10,093 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
register_preference,
register_rh,
)
from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate import ImpersonateRequestHandler, ImpersonateTarget
from ..dependencies import curl_cffi, certifi
from ..utils import... | If the input string was not numeric, a match object with a pattern of `r'(\d+)?'` will return an empty string when `group()` is called, then `int_or_none` will default to `0`
```suggestion
curl_cffi_version = tuple(int_or_none(re.match(r'(\d+)?', n).group(), default=0) for n in curl_cffi.__version__.split('.'))
``` | register_preference,
register_rh,
)
from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate import ImpersonateRequestHandler, ImpersonateTarget
from ..dependencies import curl_cffi, certifi
from ..utils import... | @@ -27,11 +28,19 @@
if curl_cffi is None:
raise ImportError('curl_cffi is not installed')
-curl_cffi_version = tuple(int_or_none(x, default=0) for x in curl_cffi.__version__.split('.'))
-if curl_cffi_version != (0, 5, 10):
+def group_or_none(n):
+ r = re.match(r'\d+', n)
+ if r:
+ return r.group(... | yt_dlp/networking/_curlcffi.py | 26 | Python | 0.786 | suggestion | 319 | 51 | 51 | false | [rh:curl_cffi] Support curl-cffi 0.7.X | 10,093 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
from ._helper import InstanceStoreMixin, select_proxy
from .common import (
Features,
Request,
Response,
register_preference,
register_rh,
)
from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate... | ```suggestion
curl_cffi_version = tuple(map(int, re.split(r'[^\d]+', curl_cffi.__version__)[:3]))
``` |
from ._helper import InstanceStoreMixin, select_proxy
from .common import (
Features,
Request,
Response,
register_preference,
register_rh,
)
from .exceptions import (
CertificateVerifyError,
HTTPError,
IncompleteRead,
ProxyError,
SSLError,
TransportError,
)
from .impersonate... | @@ -27,11 +28,12 @@
if curl_cffi is None:
raise ImportError('curl_cffi is not installed')
-curl_cffi_version = tuple(int_or_none(x, default=0) for x in curl_cffi.__version__.split('.'))
-if curl_cffi_version != (0, 5, 10):
+curl_cffi_version = tuple(int_or_none(re.match(r'(\d+)?', n).group(), default=0) for n... | yt_dlp/networking/_curlcffi.py | 26 | Python | 0.714 | suggestion | 103 | 51 | 51 | false | [rh:curl_cffi] Support curl-cffi 0.7.X | 10,093 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
player_page = self._download_webpage(
stream_meta['stream-access']['video_source'], video_id,
'Downloading player page', headers={'referer': 'https://zaiko.io/'})
player_meta = self._parse_vue_element_attr('player', player_page, video_id)
initial_event_info = player_meta... | don't need the traversal here if it's otherwise fatal
```suggestion
stream_url = self._download_json(
initial_event_info['jwt_token_url'], video_id, 'Downloading JWT-protected stream URL',
'Failed to download JWT-protected stream URL')['playback_url']
``` |
player_page = self._download_webpage(
stream_meta['stream-access']['video_source'], video_id,
'Downloading player page', headers={'referer': 'https://zaiko.io/'})
player_meta = self._parse_vue_element_attr('player', player_page, video_id)
initial_event_info = traverse_ob... | @@ -80,14 +82,21 @@ def _real_extract(self, url):
'cancelled': ('not_live', 'Event has been cancelled', True),
}.get(status) or ('not_live', f'Unknown event status "{status}"', False)
- stream_url = traverse_obj(player_meta, ('initial_event_info', 'endpoint', {url_or_none}))
+ if t... | yt_dlp/extractor/zaiko.py | 26 | Python | 0.786 | bug | 304 | 51 | 51 | false | [ie/zaiko] Add support jwt-protected video urls | 10,130 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'title': 'ZAIKO STREAMING TEST',
'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)',
'uploader_id': '454',
'uploader': 'ZAIKO ZERO',
'release_timestamp': 1583809200,
'thumbnail': r're:^https://[\w.-]+/\w+/\w+',
'thumbnail... | The rest of the extractor seemed to be written to be non-fatal all the way down to the expected `raise_no_formats` call. Will making this line fatal have any ill effect? (I'm just asking a question, not requesting a change here) | 'title': 'ZAIKO STREAMING TEST',
'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)',
'uploader_id': '454',
'uploader': 'ZAIKO ZERO',
'release_timestamp': 1583809200,
'thumbnail': r're:^https://[\w.-]+/\w+/\w+',
'thumbnail... | @@ -66,7 +66,9 @@ def _real_extract(self, url):
stream_meta['stream-access']['video_source'], video_id,
'Downloading player page', headers={'referer': 'https://zaiko.io/'})
player_meta = self._parse_vue_element_attr('player', player_page, video_id)
- status = traverse_obj(playe... | yt_dlp/extractor/zaiko.py | 26 | Python | 0.643 | refactor | 228 | 51 | 51 | false | [ie/zaiko] Add support jwt-protected video urls | 10,130 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pzhlkj6612 |
'episode_number': ('episode', {int_or_none}),
'timestamp': ('uploadTime', {int_or_none}),
'release_date': ('telecastDate', {str}),
'age_limit': ('ageNemonic', {parse_age_limit}),
'duration': ('duration', {float_or_none}),
'g... | ```suggestion
'title': 'mtv-splitsvilla-x5',
``` | 'episode_number': ('episode', {int_or_none}),
'timestamp': ('uploadTime', {int_or_none}),
'release_date': ('telecastDate', {str}),
'age_limit': ('ageNemonic', {parse_age_limit}),
'duration': ('duration', {float_or_none}),
'g... | @@ -364,20 +364,25 @@ class JioCinemaSeriesIE(JioCinemaBaseIE):
'title': 'naagin',
},
'playlist_mincount': 120,
+ }, {
+ 'url': 'https://www.jiocinema.com/tv-shows/mtv-splitsvilla-x5/3499820',
+ 'info_dict': {
+ 'id': '3499820',
+ 'title': 'MTV Split... | yt_dlp/extractor/jiocinema.py | 26 | Python | 0.571 | suggestion | 62 | 51 | 51 | false | [ie/jiocinema:series] Fix extraction | 10,139 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | varunchopra |
'description': item.get('short_description') or stream_info.get('short_description'),
**kwargs,
'chapters': [{
'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
... | ```suggestion
api_type = 'concert' if type_ == 'work' else type_
``` | 'duration': item.get('duration_total'),
'timestamp': traverse_obj(item, ('date', 'published')),
'description': item.get('short_description') or stream_info.get('short_description'),
**kwargs,
'chapters': [{
'start_time':... | @@ -131,14 +141,21 @@ def _real_extract(self, url):
**parse_resolution(thumbnail_url)
}]
+ url = f'https://api.digitalconcerthall.com/v2/{type_}/{video_id}'
+ if type_ == 'work':
+ url = f'https://api.digitalconcerthall.com/v2/concert/{video_id}'
+ | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.714 | suggestion | 78 | 46 | 42 | false | [ie/digitalconcerthall] Rework extractor | 10,152 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | tippfehlr |
'chapters': [{
'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
'title': chapter.get('text'),
} for chapter in item['cuepoints']] if item.get('cuepoints') and type_ == 'concer... | ```suggestion
f'https://api.digitalconcerthall.com/v2/{api_type}/{video_id}', video_id, headers={
``` | 'description': item.get('short_description') or stream_info.get('short_description'),
**kwargs,
'chapters': [{
'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
... | @@ -131,14 +141,21 @@ def _real_extract(self, url):
**parse_resolution(thumbnail_url)
}]
+ url = f'https://api.digitalconcerthall.com/v2/{type_}/{video_id}'
+ if type_ == 'work':
+ url = f'https://api.digitalconcerthall.com/v2/concert/{video_id}'
+
vid_info = se... | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.857 | suggestion | 115 | 44 | 40 | false | [ie/digitalconcerthall] Rework extractor | 10,152 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | tippfehlr |
'info_dict': {
'id': '53785',
'album_artist': 'Berliner Philharmoniker / Kirill Petrenko',
'title': 'Kirill Petrenko conducts Mendelssohn and Shostakovich',
},
'params': {'skip_download': 'm3u8'},
'playlist_count': 3,
}, {
'url': 'https://w... | ```suggestion
'album_artists': ['Berliner Philharmoniker / Kirill Petrenko'],
``` | 'url': 'https://www.digitalconcerthall.com/en/concert/53785',
'info_dict': {
'id': '53785',
'album_artists': ['Berliner Philharmoniker', 'Kirill Petrenko'],
'title': 'Kirill Petrenko conducts Mendelssohn and Shostakovich',
'thumbnail': r're:^https?://image... | @@ -52,6 +52,16 @@ class DigitalConcertHallIE(InfoExtractor):
'album_artist': 'Frank Peter Zimmermann / Benedikt von Bernstorff / Jakob von Bernstorff',
},
'params': {'skip_download': 'm3u8'},
+ }, {
+ 'note': 'Concert with several works and an interview',
+ 'url': 'https... | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.571 | suggestion | 95 | 51 | 51 | false | [ie/digitalconcerthall] Rework extractor | 10,152 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | tippfehlr |
def _real_extract(self, url):
language, type_, video_id, part = self._match_valid_url(url).group('language', 'type', 'id', 'part')
if not language:
language = 'en'
api_type = 'concert' if type_ == 'work' else type_
vid_info = self._download_json(
f'https://ap... | ```suggestion
'entries': self._entries(
videos, language, type_, thumbnail=thumbnail, album_artists=album_artists),
``` | def _real_extract(self, url):
language, type_, video_id, part = self._match_valid_url(url).group('language', 'type', 'id', 'part')
if not language:
language = 'en'
api_type = 'concert' if type_ == 'work' else type_
vid_info = self._download_json(
f'https://ap... | @@ -119,31 +131,31 @@ def _entries(self, items, language, type_, **kwargs):
}
def _real_extract(self, url):
- language, type_, video_id = self._match_valid_url(url).group('language', 'type', 'id')
+ language, type_, video_id, part = self._match_valid_url(url).group('language', 'type', ... | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.857 | suggestion | 150 | 30 | 31 | false | [ie/digitalconcerthall] Rework extractor | 10,152 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tippfehlr |
'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
'title': chapter.get('text'),
} for chapter in item['cuepoints']] if item.get('cuepoints') and type_ == 'concert' else None,
}
... | use `self._proto_relative_url`
```suggestion
'image', ..., {self._proto_relative_url}, {url_or_none},
{lambda x: x.replace('{width}x{height}', '0x0')}, any)) # NB: 0x0 is the original size
```
also could do this, but it might not be as obvious what we're doing
```suggestion
... | 'start_time': chapter.get('time'),
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
'title': chapter.get('text'),
} for chapter in item['cuepoints']] if item.get('cuepoints') and type_ == 'concert' else None,
}
... | @@ -119,31 +131,31 @@ def _entries(self, items, language, type_, **kwargs):
}
def _real_extract(self, url):
- language, type_, video_id = self._match_valid_url(url).group('language', 'type', 'id')
+ language, type_, video_id, part = self._match_valid_url(url).group('language', 'type', ... | yt_dlp/extractor/digitalconcerthall.py | 26 | Python | 0.857 | suggestion | 479 | 36 | 37 | false | [ie/digitalconcerthall] Rework extractor | 10,152 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tippfehlr |
from .common import InfoExtractor
from ..utils import extract_attributes, get_element_html_by_class, remove_start
class VTVGoIE(InfoExtractor):
_VALID_URL = [
r'(?:https://)?(?:www\.)?vtvgo\.vn/(kho-video|tin-tuc)/[\w.-]*?(?P<id>\d+)(?:\.[a-z]+|/)?(?:$|[?#])',
r'(?:https://)?(?:www\.)?vtvgo\.vn/di... | ```suggestion
r'https?://(?:www\.)?vtvgo\.vn/(kho-video|tin-tuc)/[\w.-]*?(?P<id>\d+)(?:\.[a-z]+|/)?(?:$|[?#])',
r'https?://(?:www\.)?vtvgo\.vn/digital/detail\.php\?(?:[^#]+&)?content_id=(?P<id>\d+)',
``` | from .common import InfoExtractor
from ..utils import extract_attributes, get_element_html_by_class, remove_start
class VTVGoIE(InfoExtractor):
_VALID_URL = [
r'https?://(?:www\.)?vtvgo\.vn/(kho-video|tin-tuc)/[\w.-]*?(?P<id>\d+)(?:\.[a-z]+|/)?(?:$|[?#])',
r'https?://(?:www\.)?vtvgo\.vn/digital/de... | @@ -0,0 +1,108 @@
+from .common import InfoExtractor
+from ..utils import extract_attributes, get_element_html_by_class, remove_start
+
+
+class VTVGoIE(InfoExtractor):
+ _VALID_URL = [
+ r'(?:https://)?(?:www\.)?vtvgo\.vn/(kho-video|tin-tuc)/[\w.-]*?(?P<id>\d+)(?:\.[a-z]+|/)?(?:$|[?#])',
+ r'(?:https:... | yt_dlp/extractor/vtv.py | 8 | Python | 0.786 | suggestion | 222 | 33 | 33 | false | [ie/vtv] Add extractors | 10,173 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DinhHuy2010 |
'ext': 'mp4',
'title': 'Chúng ta của 8 năm sau | Tập 45 | Dương có bằng chứng, nhân chứng vạch mặt ông Khiêm',
'description': 'md5:16ff5208cac6585137f554472a4677f3',
'thumbnail': 'https://vtvgo-images.vtvdigital.vn/images/20240221/550deff9-7736-4a0e-8b5d-33274d97cd7d.jpg'... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?vtv\.vn/video/[\w-]*?(?P<id>\d+)\.htm'
``` | 'ext': 'mp4',
'title': 'Chúng ta của 8 năm sau | Tập 45 | Dương có bằng chứng, nhân chứng vạch mặt ông Khiêm',
'description': 'md5:16ff5208cac6585137f554472a4677f3',
'thumbnail': 'https://vtvgo-images.vtvdigital.vn/images/20240221/550deff9-7736-4a0e-8b5d-33274d97cd7d.jpg'... | @@ -0,0 +1,108 @@
+from .common import InfoExtractor
+from ..utils import extract_attributes, get_element_html_by_class, remove_start
+
+
+class VTVGoIE(InfoExtractor):
+ _VALID_URL = [
+ r'(?:https://)?(?:www\.)?vtvgo\.vn/(kho-video|tin-tuc)/[\w.-]*?(?P<id>\d+)(?:\.[a-z]+|/)?(?:$|[?#])',
+ r'(?:https:... | yt_dlp/extractor/vtv.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [ie/vtv] Add extractors | 10,173 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | DinhHuy2010 |
'id': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'ext': 'mp4',
'direct': True,
'title': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'timestamp': 1718158370.0,
'upload_date': '20240612... | In my opinion, we can use `self._json_ld` to get the url. So something like this:
```suggestion
cnn_url = self._search_json_ld(webpage, url_basename(url)).get('url')
if (cnn_url):
return self.url_result(cnn_url, 'Generic')
return self.url_result(url, CNNIE)
``` | 'modified_timestamp': 1729194706,
'modified_date': '20241017',
},
'params': {'format': 'direct'},
}, {
'md5': '11604ab4af83b650826753f1ccb8ecff',
'info_dict': {
'id': 'med04507d8ca3da827001f63d22af321ec29c7d97b',
... | @@ -99,48 +99,48 @@ def _real_extract(self, url):
})
-class CNNBlogsIE(InfoExtractor):
- _VALID_URL = r'https?://[^\.]+\.blogs\.cnn\.com/.+'
- _TEST = {
- 'url': 'http://reliablesources.blogs.cnn.com/2014/02/09/criminalizing-journalism/',
- 'md5': '3e56f97b0b6ffb4b79f4ea0749551084',... | yt_dlp/extractor/cnn.py | 26 | Python | 0.857 | suggestion | 304 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | kylegustavo |
},
}, {
'url': 'https://edition.cnn.com/2024/06/11/politics/video/inmates-vote-jail-nevada-murray-dnt-ac360-digvid',
'info_dict': {
'id': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'ext': 'mp4',
'direct': True,
... | If there's no result this can raise: give it a default:
```suggestion
cnn_url = self._search_json_ld(webpage, url_basename(url), default={}).get('url')
``` | 'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/harris-20241016234916617.jpg?c=original',
'duration': 173.0,
'timestamp': 1729122182,
'upload_date': '20241016',
'modified_timestamp': 1729194706,
'modified_date... | @@ -99,48 +99,47 @@ def _real_extract(self, url):
})
-class CNNBlogsIE(InfoExtractor):
- _VALID_URL = r'https?://[^\.]+\.blogs\.cnn\.com/.+'
- _TEST = {
- 'url': 'http://reliablesources.blogs.cnn.com/2014/02/09/criminalizing-journalism/',
- 'md5': '3e56f97b0b6ffb4b79f4ea0749551084',... | yt_dlp/extractor/cnn.py | 26 | Python | 0.714 | suggestion | 166 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | kylegustavo |
'info_dict': {
'id': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'ext': 'mp4',
'direct': True,
'title': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'timestamp': 1718158370.0,
'... | Surely this can't work? The URL didn't match `CNNIE._VALID_URL` or it wouldn't be in here, so trying to force it back there will just crash. The original code constructed a new URL that was expected to be `CNNIE.suitable()`, which was fine. | 'upload_date': '20241016',
'modified_timestamp': 1729194706,
'modified_date': '20241017',
},
'params': {'format': 'direct'},
}, {
'md5': '11604ab4af83b650826753f1ccb8ecff',
'info_dict': {
'id': 'med04... | @@ -99,48 +99,47 @@ def _real_extract(self, url):
})
-class CNNBlogsIE(InfoExtractor):
- _VALID_URL = r'https?://[^\.]+\.blogs\.cnn\.com/.+'
- _TEST = {
- 'url': 'http://reliablesources.blogs.cnn.com/2014/02/09/criminalizing-journalism/',
- 'md5': '3e56f97b0b6ffb4b79f4ea0749551084',... | yt_dlp/extractor/cnn.py | 26 | Python | 0.571 | bug | 240 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | kylegustavo |
'upload_date': '20240531',
},
}, {
'url': 'https://edition.cnn.com/2024/06/11/politics/video/inmates-vote-jail-nevada-murray-dnt-ac360-digvid',
'info_dict': {
'id': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'ext': 'mp4',
... | An explicit `video_id` is clearer:
```suggestion
video_id = url_basename(url)
webpage = self._download_webpage(url, video_id)
```
etc.
`self._generic_id(url)` might be a better expression for what at a guess will be the same value. | 'description': 'md5:e7dd3d1a04df916062230b60ca419a0a',
'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/harris-20241016234916617.jpg?c=original',
'duration': 173.0,
'timestamp': 1729122182,
'upload_date': '20241016',
... | @@ -99,48 +99,47 @@ def _real_extract(self, url):
})
-class CNNBlogsIE(InfoExtractor):
- _VALID_URL = r'https?://[^\.]+\.blogs\.cnn\.com/.+'
- _TEST = {
- 'url': 'http://reliablesources.blogs.cnn.com/2014/02/09/criminalizing-journalism/',
- 'md5': '3e56f97b0b6ffb4b79f4ea0749551084',... | yt_dlp/extractor/cnn.py | 26 | Python | 0.857 | suggestion | 256 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | kylegustavo |
from .common import InfoExtractor
from ..utils import extract_attributes, merge_dicts, try_call, url_or_none
from ..utils.traversal import find_element, traverse_obj
class CNNIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:edition|www|money)\.)?cnn\.com/(?!audio)(?P<display_id>[^?#]+?)(?:[?#]|$|/index\.html)'
... | ```suggestion
_VALID_URL = r'https?://(?:(?:edition|www|money)\.)?cnn\.com/(?!audio/)(?P<display_id>[^?#]+?)(?:[?#]|$|/index\.html)'
``` | import functools
import json
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
extract_attributes,
int_or_none,
merge_dicts,
parse_duration,
parse_iso8601,
parse_resolution,
try_call,
update_url,
url_or_none,
)
from ..utils.traversal import find_eleme... | @@ -1,146 +1,98 @@
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import extract_attributes, merge_dicts, try_call, url_or_none
+from ..utils.traversal import find_element, traverse_obj
-class CNNIE(TurnerBaseIE):
- _VAL... | yt_dlp/extractor/cnn.py | 7 | Python | 0.714 | suggestion | 142 | 32 | 32 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kylegustavo |
'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/221205163510-robin-meade-sign-off.jpg?c=original',
'duration': 158.0,
'title': 'Robin Meade signs off after HLN\'s last broadcast',
'description': 'md5:9f28e46df86b7eb1efe36a7d1cd46f2c',
'upload_da... | Get the ld+json `VideoObject` for the headline video:
```suggestion
json_ld = traverse_obj([
variadic(x) for x in self._yield_json_ld(webpage, display_id, fatal=False)],
(..., ((..., 'video'), None), lambda _, v: v['@type'] == 'VideoObject'))
json_ld.sort(key=lambda v: v.get... | }, {
'url': 'https://edition.cnn.com/2024/06/11/style/king-charles-portrait-vandalized/index.html',
'info_dict': {
'id': 'mef5f52b9e1fe28b1ad192afcbc9206ae984894b68',
'display_id': '2024/06/11/style/king-charles-portrait-vandalized',
'ext': 'mp4',
'thu... | @@ -1,146 +1,111 @@
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import extract_attributes, merge_dicts, try_call, url_or_none
+from ..utils.traversal import find_element, traverse_obj
-class CNNIE(TurnerBaseIE):
- _VA... | yt_dlp/extractor/cnn.py | 26 | Python | 0.929 | suggestion | 504 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | kylegustavo |
'description': 'md5:9f28e46df86b7eb1efe36a7d1cd46f2c',
'upload_date': '20221205',
'timestamp': 1670284296,
},
}, {
'url': 'https://cnnespanol.cnn.com/video/ataque-misil-israel-beirut-libano-octubre-trax',
'info_dict': {
'id': 'me484a43722642aa0... | Similarly, pick the headline video. If there might be no video with `data-canonical-url`, there could be a 2-stage process as above, but the tests pass as is.
```suggestion
media_id = traverse_obj(webpage, (
{find_elements(tag='div', attr='data-component-name', value='video-player', html=True)},
... | 'id': 'mef5f52b9e1fe28b1ad192afcbc9206ae984894b68',
'display_id': '2024/06/11/style/king-charles-portrait-vandalized',
'ext': 'mp4',
'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/still-20701257-8846-816-still.jpg?c=original',
'description': 'm... | @@ -1,146 +1,111 @@
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import extract_attributes, merge_dicts, try_call, url_or_none
+from ..utils.traversal import find_element, traverse_obj
-class CNNIE(TurnerBaseIE):
- _VA... | yt_dlp/extractor/cnn.py | 26 | Python | 0.857 | refactor | 624 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | kylegustavo |
'display_id': 'pete-buttigieg-harris-fox-newssrc-digvid',
'description': 'md5:602a8a7e853ed5e574acd3159428c98e',
'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/buttigieg-20241017040412074.jpg?c=original',
'duration': 145.0,
... | not a necessary change, but maybe we want to remove the filter for `parent_uri` here, since we could still have m3u8 formats with only the `media_id`?
```suggestion
..., {extract_attributes}, all, lambda _, v: v['data-media-id'])):
media_id = player_data['data-media-id']
pare... | 'description': 'md5:602a8a7e853ed5e574acd3159428c98e',
'thumbnail': 'https://media.cnn.com/api/v1/images/stellar/prod/buttigieg-20241017040412074.jpg?c=original',
'duration': 145.0,
'timestamp': 1729137765,
'upload_date': '20241017',
... | @@ -1,146 +1,225 @@
+import functools
+import json
+import re
+
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ float_or_none,
+ int_or_none,
+ merge_dicts,
+ pars... | yt_dlp/extractor/cnn.py | 26 | Python | 0.857 | refactor | 383 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kylegustavo |
'duration': 145.0,
'timestamp': 1729137765.846,
'upload_date': '20241017',
'modified_timestamp': 1729138184.891,
'modified_date': '20241017',
},
'params': {'format': 'direct'},
}],
}]
def _real_extra... | then we'd have to indent all of this, which is making me dislike my own idea
```suggestion
if parent_uri:
video_data = self._download_json(
``` | 'timestamp': 1729137765,
'upload_date': '20241017',
'modified_timestamp': 1729138184,
'modified_date': '20241017',
},
'params': {'format': 'direct'},
}],
}]
def _real_extract(self, url):
display_id = self._m... | @@ -1,146 +1,225 @@
+import functools
+import json
+import re
+
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ float_or_none,
+ int_or_none,
+ merge_dicts,
+ pars... | yt_dlp/extractor/cnn.py | 26 | Python | 0.714 | suggestion | 175 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kylegustavo |
f'https://medium.ngtv.io/v2/media/{media_id}/desktop', media_id, fatal=False,
query={'appId': app_id})
m3u8_url = traverse_obj(media_data, (
'media', 'desktop', 'unprotected', 'unencrypted', 'url', {url_or_none}))
if m3u8_url:
... | I'd use `int_or_none` for the timestamps here to stay consistent with the fallback values
```suggestion
'timestamp': ('dateCreated', 'uts', {int_or_none(scale=1000)}),
'description': ('description', {clean_html}),
'title': ('headline', {str}),
... | media_data = self._download_json(
f'https://medium.ngtv.io/v2/media/{media_id}/desktop', media_id, fatal=False,
query={'appId': app_id})
m3u8_url = traverse_obj(media_data, (
'media', 'desktop', 'unprotected', 'unencrypted', 'ur... | @@ -1,146 +1,225 @@
+import functools
+import json
+import re
+
from .common import InfoExtractor
-from .turner import TurnerBaseIE
-from ..utils import merge_dicts, try_call, url_basename
+from ..utils import (
+ clean_html,
+ extract_attributes,
+ float_or_none,
+ int_or_none,
+ merge_dicts,
+ pars... | yt_dlp/extractor/cnn.py | 26 | Python | 0.857 | suggestion | 407 | 51 | 51 | false | [ie/CNN] Fix extractor | 10,185 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | kylegustavo |
from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'matchtv-live',
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-\... | You are missing a new line after your imports.
```suggestion
```
You can also run ruff locally to automatically fix these things. | from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'ma... | @@ -1,48 +1,27 @@
-import random
-
from .common import InfoExtractor
-from ..utils import xpath_text
-
| yt_dlp/extractor/matchtv.py | 2 | Python | 0.714 | suggestion | 136 | 27 | 27 | false | [ie/matchtv] Fix extractor | 10,190 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | megumintyan |
from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'matchtv-live',
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-... | ```suggestion
webpage = self._download_webpage('https://video.matchtv.ru/iframe/channel/106', video_id)
``` | from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'ma... | @@ -1,48 +1,28 @@
-import random
-
from .common import InfoExtractor
-from ..utils import xpath_text
class MatchTVIE(InfoExtractor):
- _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)'
+ _VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
- 'url': 'http://matchtv.ru/#live-player... | yt_dlp/extractor/matchtv.py | 22 | Python | 0.714 | suggestion | 117 | 32 | 36 | false | [ie/matchtv] Fix extractor | 10,190 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | megumintyan |
from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'matchtv-live',
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-... | I would inline this below and set `live=True`
```suggestion
```
```python
return {
'id': video_id,
'title': 'Матч ТВ - Прямой эфир',
'is_live': True,
'formats': self._extract_m3u8_formats(video_url, video_id, 'mp4', live=True),
}
``` | from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'ma... | @@ -1,48 +1,28 @@
-import random
-
from .common import InfoExtractor
-from ..utils import xpath_text
class MatchTVIE(InfoExtractor):
- _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)'
+ _VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
- 'url': 'http://matchtv.ru/#live-player... | yt_dlp/extractor/matchtv.py | 25 | Python | 0.857 | refactor | 307 | 32 | 36 | false | [ie/matchtv] Fix extractor | 10,190 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | megumintyan |
from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'matchtv-live',
'ext': 'mp4',
'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-... | ```suggestion
'live_status': 'is_live',
``` | from .common import InfoExtractor
class MatchTVIE(InfoExtractor):
_VALID_URL = [
r'https?://matchtv\.ru/on-air/?(?:$|[?#])',
r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])',
]
_TESTS = [{
'url': 'http://matchtv.ru/on-air/',
'info_dict': {
'id': 'ma... | @@ -1,48 +1,28 @@
-import random
-
from .common import InfoExtractor
-from ..utils import xpath_text
class MatchTVIE(InfoExtractor):
- _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)'
+ _VALID_URL = r'https?://matchtv\.ru/on-air'
_TESTS = [{
- 'url': 'http://matchtv.ru/#live-player... | yt_dlp/extractor/matchtv.py | 12 | Python | 0.571 | suggestion | 57 | 32 | 36 | false | [ie/matchtv] Fix extractor | 10,190 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | megumintyan |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.