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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def _entries(self, playlist_type, playlist_id):
playlist_url = f'https://www.bitchute.com/{playlist_type}/{playlist_id}/'
def fetch_entries(page_num):
data = self._download_json(
'%sextend/' % playlist_url, playlist_id,
'Downloading %s page %d' % (playli... | This gives `/video/None` in the second test case | @staticmethod
def _make_url(playlist_id, playlist_type):
return f'https://www.bitchute.com/{playlist_type}/{playlist_id}/'
def _fetch_page(self, playlist_id, playlist_type, page_num):
playlist_url = self._make_url(playlist_id, playlist_type)
data = self._download_json(
f... | @@ -109,51 +113,106 @@ def _real_extract(self, url):
class BitChuteChannelIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
- _TEST = {
- 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
- 'playlist_mincount': 185,
+ _VALID_URL = r'https?... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.214 | suggestion | 48 | 49 | 46 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
'query': '''{
viewer {
mediaToken(anvack: "%s", id: %s) {
token
}
}
}''' % (anvack, mcp_id),
}).encode(), headers={
'Authorization': auth_token,
'Content-Type': 'application/json',
}, note='Fetching NFL API token')
return ... | this is not caching correctly.
```py
def _server_time(self, access_key, video_id):
self._SERVER_TIME = self._SERVER_TIME or int_or_none(self._download_json(
f'{self._API_BASE_URL}/server_time', video_id, query={'anvack': access_key},
note='Fetching server time', fatal=False).get... | token
}
}
}''' % (anvack, mcp_id),
}).encode(), headers={
'Authorization': auth_token,
'Content-Type': 'application/json',
}, note='Fetching NFL API token')
return traverse_obj(response, ('data', 'viewer', 'mediaToken', 'token'))
_TOKEN_GE... | @@ -202,86 +244,79 @@ class AnvatoIE(InfoExtractor):
'telemundo': 'anvato_mcp_telemundo_web_prod_c5278d51ad46fda4b6ca3d0ea44a7846a054f582'
}
- _TOKEN_GENERATORS = {
- 'GXvEgwyJeWem8KCYXfeoHWknwP48Mboj': NFLTokenGenerator,
+ def _generate_nfl_token(self, anvack, mcp_id):
+ reroute = s... | yt_dlp/extractor/anvato.py | 26 | Python | 0.786 | suggestion | 397 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
import json
import random
import re
import time
from .common import InfoExtractor
from ..aes import aes_encrypt
from ..utils import (
ExtractorError,
bytes_to_intlist,
determine_ext,
intlist_to_bytes,
int_or_none,
join_nonempty,
strip_jsonp,
smuggle_url,
traverse_obj,
unescapeHT... | ```suggestion
return hashlib.md5(str(s).encode()).hexdigest()
``` | import json
import random
import re
import time
from .common import InfoExtractor
from ..aes import aes_encrypt
from ..utils import (
bytes_to_intlist,
determine_ext,
intlist_to_bytes,
int_or_none,
join_nonempty,
strip_jsonp,
smuggle_url,
traverse_obj,
unescapeHTML,
unsmuggle_ur... | @@ -5,31 +5,73 @@
import re
import time
-from .anvato_token_generator import NFLTokenGenerator
from .common import InfoExtractor
from ..aes import aes_encrypt
-from ..compat import compat_str
from ..utils import (
+ ExtractorError,
bytes_to_intlist,
determine_ext,
intlist_to_bytes,
int_or_... | yt_dlp/extractor/anvato.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
formats = []
for published_url in video_data['published_urls']:
video_url = published_url.get('embed_url')
if not video_url:
continue
media_format = published_url.get('format')
ext = determine_ext(video_url)
if ext == 'smil' o... | ```suggestion
if media_format == 'vtt': # There are no formats
_, vtt_subs = self._extract_m3u8_formats_and_subtitles(
video_url, video_id, m3u8_id='vtt', fatal=False)
continue
``` |
if ext == 'smil' or media_format == 'smil':
formats.extend(self._extract_smil_formats(video_url, video_id))
continue
tbr = int_or_none(published_url.get('kbps'))
a_format = {
'url': video_url,
'format_id': join_nonempt... | @@ -296,15 +331,32 @@ def _get_anvato_videos(self, access_key, video_id):
'tbr': tbr or None,
}
- if media_format == 'm3u8' and tbr is not None:
+ vtt_subs, hls_subs = {}, {}
+ if media_format == 'vtt':
+ no_fmt, vtt_subs = self._extract_m3... | yt_dlp/extractor/anvato.py | 26 | Python | 0.857 | refactor | 250 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
tbr = int_or_none(published_url.get('kbps'))
a_format = {
'url': video_url,
'format_id': join_nonempty('http', published_url.get('cdn_name')).lower(),
'tbr': tbr or None,
}
vtt_subs, hls_subs = {}, {}
if media_f... | ```suggestion
manifest_json = self._download_json(
video_url, video_id, note='Downloading manifest JSON', errnote=False)
if manifest_json:
``` | if media_format == 'vtt':
_, vtt_subs = self._extract_m3u8_formats_and_subtitles(
video_url, video_id, m3u8_id='vtt', fatal=False)
continue
elif media_format == 'm3u8' and tbr is not None:
a_format.update({
'... | @@ -296,15 +331,32 @@ def _get_anvato_videos(self, access_key, video_id):
'tbr': tbr or None,
}
- if media_format == 'm3u8' and tbr is not None:
+ vtt_subs, hls_subs = {}, {}
+ if media_format == 'vtt':
+ no_fmt, vtt_subs = self._extract_m3... | yt_dlp/extractor/anvato.py | 26 | Python | 0.714 | suggestion | 198 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
vtt_subs, hls_subs = {}, {}
if media_format == 'vtt':
no_fmt, vtt_subs = self._extract_m3u8_formats_and_subtitles(
video_url, video_id, ext='vtt', entry_protocol='m3u8_native',
m3u8_id='vtt', fatal=False)
continue
... | ```suggestion
video_url, video_id, ext='mp4', m3u8_id='hls', fatal=False)
``` | 'format_id': join_nonempty('hls', tbr),
'ext': 'mp4',
})
elif media_format == 'm3u8-variant' or ext == 'm3u8':
# For some videos the initial m3u8 URL returns JSON instead
manifest_json = self._download_json(
... | @@ -296,15 +331,32 @@ def _get_anvato_videos(self, access_key, video_id):
'tbr': tbr or None,
}
- if media_format == 'm3u8' and tbr is not None:
+ vtt_subs, hls_subs = {}, {}
+ if media_format == 'vtt':
+ no_fmt, vtt_subs = self._extract_m3... | yt_dlp/extractor/anvato.py | 26 | Python | 0.571 | suggestion | 99 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
headers={'X-Domain-Id': 100}, note='Fetching token info')
token_type = reroute.get('token_type') or 'Bearer'
auth_token = f'{token_type} {reroute["access_token"]}'
response = self._download_json(
'https://api.nfl.com/v3/shield/', mcp_id, data=json.dumps({
... | ```suggestion
return int_or_none(traverse_obj(self._download_json(
f'{self._API_BASE_URL}/server_time', video_id, query={'anvack': access_key},
note='Fetching server time', fatal=False), 'server_time')) or int(time.time())
``` | headers={'X-Domain-Id': 100}, note='Fetching token info')
token_type = reroute.get('token_type') or 'Bearer'
auth_token = f'{token_type} {reroute["access_token"]}'
response = self._download_json(
'https://api.nfl.com/v3/shield/', mcp_id, data=json.dumps({
... | @@ -202,86 +241,74 @@ class AnvatoIE(InfoExtractor):
'telemundo': 'anvato_mcp_telemundo_web_prod_c5278d51ad46fda4b6ca3d0ea44a7846a054f582'
}
- _TOKEN_GENERATORS = {
- 'GXvEgwyJeWem8KCYXfeoHWknwP48Mboj': NFLTokenGenerator,
+ def _generate_nfl_token(self, anvack, mcp_id):
+ reroute = s... | yt_dlp/extractor/anvato.py | 26 | Python | 0.786 | suggestion | 262 | 51 | 51 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
return {
'id': video_id,
'formats': formats,
'title': video_data.get('def_title'),
'description': video_data.get('def_description'),
'tags': video_data.get('def_tags', '').split(','),
'categories': video_data.get('categories'),
... | ```suggestion
if anvplayer_data.get('token'):
``` | return {
'id': video_id,
'formats': formats,
'title': video_data.get('def_title'),
'description': video_data.get('def_description'),
'tags': video_data.get('def_tags', '').split(','),
'categories': video_data.get('categories'),
... | @@ -349,25 +389,26 @@ def _extract_from_webpage(cls, url, webpage):
access_key = cls._MCP_TO_ACCESS_KEY_TABLE.get((anvplayer_data.get('mcp') or '').lower())
if not (video_id or '').isdigit() or not access_key:
continue
- yield cls.url_result(f'anvato:{access_key... | yt_dlp/extractor/anvato.py | 26 | Python | 0.571 | suggestion | 63 | 48 | 48 | false | [extractor/anvato] Fix extractor | 5,074 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'title': 'Huracán complica que televidente de Tucson reciba reembolso',
'description': 'md5:af298dc73aab74d4fca6abfb12acb6cf',
'timestamp': 1660886507,
'upload_date': '20220819',
'uploader': 'Telemundo Arizona',
'uploader_id': 'KTAZ',
'... | ```suggestion
video_data = variadic(video_data)[0]
```
is this not enough? | 'title': 'Huracán complica que televidente de Tucson reciba reembolso',
'description': 'md5:af298dc73aab74d4fca6abfb12acb6cf',
'timestamp': 1660886507,
'upload_date': '20220819',
'uploader': 'Telemundo Arizona',
'uploader_id': 'KTAZ',
'... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.571 | question | 85 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'manifest': 'm3u',
'Tracking': 'true',
'Embedded': 'true',
'formats': 'MPEG4',
}
info = {
'description': description,
'upload_date': str_or_none(unified_strdate(date_string)),
'timesta... | Giving protocol is legacy. yt-dlp now automatically determines it depending on `live` | }
info = {
'title': video_data.get('title') or traverse_obj(
nbc_data, ('dataLayer', 'contenttitle'), ('dataLayer', 'title'),
('dataLayer', 'adobe', 'prop22'), ('dataLayer', 'id')),
'description': traverse_obj(video_data, 's... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.357 | suggestion | 85 | 40 | 38 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'pprofile': 'ots_desktop_html',
'sensitive': 'false',
'w': '1920',
'h': '1080',
'rnd': '1660303',
'mode': 'LIVE',
'format': 'SMIL',
'tracking': 'true',
'formats': 'M3U+none,MPE... | ```suggestion
title = video_data.get('title') or traverse_obj(
nbc_data, ('dataLayer', 'contenttitle'), ('dataLayer', 'title'),
('dataLayer', 'adobe', 'prop22'), ('dataLayer', 'id'))
``` | 'assetTypes': 'LegacyRelease',
'fwsitesection': fw_ssid,
'fwNetworkID': fw_network_id,
'pprofile': 'ots_desktop_html',
'sensitive': 'false',
'w': '1920',
'h': '1080',
'rnd': '1660303',
... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.786 | suggestion | 234 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
else:
live = False
player_id = traverse_obj(
video_data, ('video', 'meta', 'pid_streaming_web_high'), 'pid_streaming_web_high',
('video', 'meta', 'mpx_pid'), 'mpx_pid')
title = video_data.get('title')
if not title:
... | it should perhaps be a class var | 'SDK': 'PDK+6.1.3',
}
info = {
'title': f'{channel} livestream',
}
else:
live = False
player_id = traverse_obj(
video_data, ('video', 'meta', 'pid_streaming_web_high'), 'pid_streaming_web_high',
... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.143 | suggestion | 32 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
video_url = traverse_obj(video_data, ('video', 'meta', 'mp4_url'), 'mp4_url')
if video_url:
resolutions = {'1080': '1920', '720': '1280', '540': '960', '360': '640', '234': '416'}
height = url_basename(video_url).split('-')[1].split('p')[0]
formats... | ```suggestion
'description': traverse_obj(video_data, 'summary', 'excerpt', 'video_hero_text'),
``` | height = url_basename(video_url).split('-')[1].split('p')[0]
formats.append({
'url': video_url,
'ext': 'mp4',
'width': int_or_none(self._RESOLUTIONS.get(height)),
'height': int_or_none(height),
... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.714 | suggestion | 117 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
if video_data.get('mpx_is_livestream') == '1':
live = True
player_id = traverse_obj(
video_data, 'mpx_m3upid', ('video', 'meta', 'mpx_m3upid'), 'mpx_pid',
('video', 'meta', 'mpx_pid'), 'pid_streaming_web_medium')
title = f'{channel} livestream'... | Why not
```suggestion
info = {
'title': f'{channel} livestream'
}
```
same below | video_data.update(self._parse_json(self._html_search_regex(
r'data-meta="([^"]*)"', webpage, 'metadata', default='{}'), video_id))
formats = []
if video_data.get('mpx_is_livestream') == '1':
live = True
player_id = traverse_obj(
video_data, '... | @@ -584,3 +589,172 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.714 | suggestion | 126 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
)['akamai'][0]['tokenizedUrl']
formats = self._extract_m3u8_formats(source_url, pid, 'mp4', live=is_live)
for f in formats:
# -http_seekable requires ffmpeg 4.3+ but it doesnt seem possible to
# download with ffmpeg without this option
f['downloader_optio... | ```suggestion
_DOMAIN_RE = '|'.join(map(re.escape, (
'nbcbayarea', 'nbcboston', 'nbcchicago', 'nbcconnecticut', 'nbcdfw', 'nbclosangeles',
'nbcmiami', 'nbcnewyork', 'nbcphiladelphia', 'nbcsandiego', 'nbcwashington',
'necn', 'telemundo52', 'telemundoarizona', 'telemundochicago', 'telemund... | )['akamai'][0]['tokenizedUrl']
formats = self._extract_m3u8_formats(source_url, pid, 'mp4', live=is_live)
for f in formats:
# -http_seekable requires ffmpeg 4.3+ but it doesnt seem possible to
# download with ffmpeg without this option
f['downloader_optio... | @@ -584,3 +590,170 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.786 | security | 462 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
},
}]
_RESOLUTIONS = {
'1080': '1920',
'720': '1280',
'540': '960',
'360': '640',
'234': '416',
}
def _real_extract(self, url):
channel, video_id = self._match_valid_url(url).group('site', 'id')
webpage = self._download_webpage(url, video... | ```suggestion
r'data-videos="([^"]*)"', webpage, 'video data', fdefault='{}'), video_id)
video_data = variadic(video_data)[0]
video_data.update(self._parse_json(self._html_search_regex(
r'data-meta="([^"]*)"', webpage, 'metadata', default='{}'), video_id))
```
default impli... | }]
_RESOLUTIONS = {
'1080': '1920',
'720': '1280',
'540': '960',
'360': '640',
'234': '416',
}
def _real_extract(self, url):
channel, video_id = self._match_valid_url(url).group('site', 'id')
webpage = self._download_webpage(url, video_id)
... | @@ -584,3 +590,170 @@ def _real_extract(self, url):
'formats': formats,
'is_live': is_live,
}
+
+
+class NBCStationsIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?(?P<site>
+ nbcbayarea|nbcboston|nbcchicago|nbccon... | yt_dlp/extractor/nbc.py | 26 | Python | 0.786 | suggestion | 332 | 51 | 51 | false | [extractor/nbc] Add NBCStationsIE | 5,077 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
int_or_none,
)
from collections import OrderedDict
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'ur... | We only support 3.7+ So dicts are already ordered | from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict | yt_dlp/extractor/microsoftembed.py | 7 | Python | 0.071 | suggestion | 49 | 32 | 32 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
int_or_none,
)
from collections import OrderedDict
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'ur... | Fill this out fully till the download test passes | from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 19 | Python | 0.071 | suggestion | 49 | 44 | 44 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
from ..utils import (
traverse_obj,
unified_timestamp,
int_or_none,
)
from collections import OrderedDict
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/en-... | ```suggestion
metadata = self._download_json(self._API_URL + video_id, video_id)
```
Make sure to read our coding conventions | from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/en-us/videoplayer/embed/RWL07e',
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
formats = []
for source_type, source in metadata['streams'].items():
stream_url = source['url']
if source_type == 'smoothStreaming':
formats.extend(self._extract_ism_formats(stream_url, video_id, 'mss'))
elif source_type == 'apple_HTTP_Live_Streaming... | these can be inlined in the return | video_id = self._match_id(url)
metadata = self._download_json(self._API_URL + video_id, video_id)
formats = []
for source_type, source in metadata['streams'].items():
if source_type == 'smooth_Streaming':
formats.extend(self._extract_ism_formats(source['url']... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.071 | suggestion | 34 | 51 | 44 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
'width': source.get('widthPixels')
})
self._sort_formats(formats)
timestamp = traverse_obj(
metadata, ('snippet', 'activeStartDate'))
age_limit = int_or_none(
traverse_obj(metadata, ('snippet', 'minimumAge'))) or 0
subtitles... | ```suggestion
subtitles = {
lang: [{
'url': data.get('url'),
'ext': 'vtt'
}] for lang, data in traverse_obj(metadata, 'captions', default={}).items()
}
thumbnails = [{
'url': data.get('url'),
'http_headers... | 'width': source.get('widthPixels'),
})
self._sort_formats(formats)
subtitles = {
lang: [{
'url': data.get('url'),
'ext': 'vtt',
}] for lang, data in traverse_obj(metadata, 'captions', default={}).items()
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.786 | suggestion | 454 | 38 | 28 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
self._sort_formats(formats)
timestamp = traverse_obj(
metadata, ('snippet', 'activeStartDate'))
age_limit = int_or_none(
traverse_obj(metadata, ('snippet', 'minimumAge'))) or 0
subtitles = OrderedDict()
for lang, data in (traverse_obj(metadata, 'capti... | ```suggestion
return {
``` | self._sort_formats(formats)
subtitles = {
lang: [{
'url': data.get('url'),
'ext': 'vtt',
}] for lang, data in traverse_obj(metadata, 'captions', default={}).items()
}
thumbnails = [{
'url': thumb.get('url'),
... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.429 | suggestion | 36 | 36 | 26 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
formats = []
for source_type, source in metadata['streams'].items():
stream_url = source['url']
if source_type == 'smoothStreaming':
formats.extend(self._extract_ism_formats(stream_url, video_id, 'mss'))
elif source_type == 'apple_HTTP_Live_Streaming... | You could use the builtin functionality of `traverse_obj` for a result type:
```suggestion
age_limit = traverse_obj(metadata, ('snippet', 'minimumAge'), expected_type=int_or_none, default=0))
``` | video_id = self._match_id(url)
metadata = self._download_json(self._API_URL + video_id, video_id)
formats = []
for source_type, source in metadata['streams'].items():
if source_type == 'smooth_Streaming':
formats.extend(self._extract_ism_formats(source['url']... | @@ -0,0 +1,80 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+from collections import OrderedDict
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 1 | suggestion | 206 | 51 | 44 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | DoubleCouponDay |
elif source_type == 'mPEG_DASH':
formats.extend(self._extract_mpd_formats(stream_url, video_id))
else:
formats.append({
'format_id': source_type,
'url': stream_url,
'height': source.get('heightPixels'),
... | This could be a simplified `traverse_obj` query as well:
```suggestion
thumbnails = traverse_obj(metadata, ('snippet', 'thumbnails', ..., {
'url': 'url',
'http_headers': 'link'
}))
``` | if source_type == 'smooth_Streaming':
formats.extend(self._extract_ism_formats(source['url'], video_id, 'mss'))
elif source_type == 'apple_HTTP_Live_Streaming':
formats.extend(self._extract_m3u8_formats(source['url'], video_id, 'mp4'))
elif source_type... | @@ -45,21 +45,17 @@ def _real_extract(self, url):
timestamp = traverse_obj(
metadata, ('snippet', 'activeStartDate'))
- subtitles = {}
-
- for lang, data in (traverse_obj(metadata, 'captions') or {}).items():
- subtitles[lang] = [{
+ subtitles = {
+ lan... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.857 | suggestion | 230 | 37 | 39 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | DoubleCouponDay |
from .common import InfoExtractor
from ..utils import (
traverse_obj,
unified_timestamp,
int_or_none,
)
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/en-us... | The language tag is not required and should probably be optional, while also accepting other languages.
```suggestion
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
``` | from .common import InfoExtractor
from ..utils import (
int_or_none,
traverse_obj,
unified_timestamp,
)
class MicrosoftEmbedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
_TESTS = [{
'url': 'https://www.microsoft.com/... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)' | yt_dlp/extractor/microsoftembed.py | 10 | Python | 0.857 | suggestion | 228 | 35 | 35 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | DoubleCouponDay |
def _real_extract(self, url):
video_id = self._match_id(url)
metadata = self._download_json(self._API_URL + video_id, video_id)
formats = []
for source_type, source in metadata['streams'].items():
stream_url = source['url']
if source_type == 'smoothStreaming... | This could use `expected_type` as well. | }]
_API_URL = 'https://prod-video-cms-rt-microsoft-com.akamaized.net/vhs/api/videos/'
def _real_extract(self, url):
video_id = self._match_id(url)
metadata = self._download_json(self._API_URL + video_id, video_id)
formats = []
for source_type, source in metadata['streams'].... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
+
+ _TESTS = [{
+ 'url': 'h... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.429 | suggestion | 39 | 49 | 48 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | DoubleCouponDay |
_TESTS = [{
'url': 'https://www.microsoft.com/en-us/videoplayer/embed/RWL07e',
'md5': '69a3bff81349094e91b303ff51393de2 Microsoft for Public Health and Social Services [RWL07e].mp4',
'info_dict': {
'id': 'RWL07e',
'title': '...',
'ext': 'mp4',
... | typo? or is it actually small `m`? | _TESTS = [{
'url': 'https://www.microsoft.com/en-us/videoplayer/embed/RWL07e',
'md5': 'eb0ae9007f9b305f9acd0a03e74cb1a9',
'info_dict': {
'id': 'RWL07e',
'title': 'Microsoft for Public Health and Social Services',
'ext': 'mp4',
'thumbnail': 'htt... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import (
+ traverse_obj,
+ unified_timestamp,
+ int_or_none,
+)
+
+
+class MicrosoftEmbedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?microsoft\.com/en-us/videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
+
+ _TESTS = [{
+ 'url': 'h... | yt_dlp/extractor/microsoftembed.py | 26 | Python | 0.214 | question | 34 | 51 | 51 | false | Extractor for Microsoft embedded videos | 5,082 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
'timestamp': float,
'upload_date': str,
'thumbnail': 'https://www.estudiords.com.br/wp-content/uploads/2021/03/LOGO-TEMAS.png',
'description': 'md5:ab24d6a7ed0312ad2d466e721679f5a0',
},
'playlist_mincount': 30
}]
def _extract_from_webpage(self, ur... | We could add an optional `tag` parameter to `get_elements_text_and_html_by_attribute` | 'upload_date': str,
'thumbnail': 'https://www.estudiords.com.br/wp-content/uploads/2021/03/LOGO-TEMAS.png',
'description': 'md5:ab24d6a7ed0312ad2d466e721679f5a0',
},
'playlist_mincount': 30
}]
def _extract_from_webpage(self, url, webpage):
# Common fu... | @@ -67,3 +72,87 @@ def _extract_from_webpage(self, url, webpage):
'width': int_or_none(traverse_obj(track, ('dimensions', 'original', 'width'))),
} for track in traverse_obj(playlist_json, ('tracks', ...), expected_type=dict)]
yield self.playlist_result(entries, self._generic_... | yt_dlp/extractor/wordpress.py | 26 | Python | 0.429 | suggestion | 85 | 39 | 35 | false | [extractor/wordpress:mb.miniAudioPlayer] Add generic embed extractor | 5,087 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
def get_elements_by_class(class_name, html, **kargs):
"""Return the content of all tags with the specified class in the passed HTML document as a list"""
return get_elements_by_attribute(
'class', r'[^\'"]*(?<=[\'"\s])%s(?=[\'"\s])[^\'"]*' % re.escape(class_name),
html, escape_value=False)
de... | I know u just moved this code, but it should really be
```suggestion
def get_elements_text_and_html_by_attribute(attribute, value, html, *, tag=r'[\w:.-]+', escape_value=True):
```
Also, maybe `tag` should obey `escape_value`? |
def get_elements_by_class(class_name, html, **kargs):
"""Return the content of all tags with the specified class in the passed HTML document as a list"""
return get_elements_by_attribute(
'class', r'[^\'"]*(?<=[\'"\s])%s(?=[\'"\s])[^\'"]*' % re.escape(class_name),
html, escape_value=False)
de... | @@ -408,7 +408,7 @@ def get_elements_html_by_attribute(*args, **kwargs):
return [whole for _, whole in get_elements_text_and_html_by_attribute(*args, **kwargs)]
-def get_elements_text_and_html_by_attribute(attribute, value, html, escape_value=True):
+def get_elements_text_and_html_by_attribute(attribute, value... | yt_dlp/utils.py | 26 | Python | 0.857 | security | 232 | 51 | 51 | false | [extractor/wordpress:mb.miniAudioPlayer] Add generic embed extractor | 5,087 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'categories': ['Sports'],
'duration': 222,
'description': 'md5:8874410e5740ed1d8fd0df839f849813',
'availability': 'public',
'playable_in_embed': True,
'live_status': 'not_live',
}
}, {
# 2 Bri... | ```suggestion
fusion_metadata = self._search_json(r'Fusion\.globalContent\s*=', webpage, 'fusion metadata', display_id)
``` | 'tags': 'count:12',
'uploader': 'Re: News',
'upload_date': '20211215',
'uploader_id': 'UC2BQ3U9IxoYIJyulv0bN5PQ',
'uploader_url': 'http://www.youtube.com/channel/UC2BQ3U9IxoYIJyulv0bN5PQ',
'channel_id... | @@ -0,0 +1,95 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ ExtractorError,
+ traverse_obj
+)
+
+
+class OneNewsNZIE(InfoExtractor):
+ IE_NAME = '1News'
+ IE_DESC = '1news.co.nz article videos'
+ _VALID_URL = r'https?://(?:www\.)?(?:1|one)news\.co\.nz/\d+/\d+/\d+/(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/onenewsnz.py | 26 | Python | 0.714 | suggestion | 133 | 48 | 51 | false | [extractor/onenewsnz] Add extractor | 5,088 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'id': 'raw-videos-capture-hurricane-ians-fury-as-it-slams-florida',
},
'playlist_mincount': 2,
}, {
'url': 'https://www.onenews.co.nz/2022/09/29/cows-painted-green-on-parliament-lawn-in-climate-protest/',
'only_matching': True,
}]
BRIG... | Would prefer if u import the IE and do
```suggestion
entries.append(self.url_result(brightcove_url, BrightcoveNewIE))
```
This makes it easier to refactor if the ie name ever changes. For youtube/generic, string's fine since we'll probably never change them | 'categories': ['Sports'],
'duration': 222,
'description': 'md5:8874410e5740ed1d8fd0df839f849813',
'availability': 'public',
'playable_in_embed': True,
'live_status': 'not_live',
}
... | @@ -0,0 +1,95 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ ExtractorError,
+ traverse_obj
+)
+
+
+class OneNewsNZIE(InfoExtractor):
+ IE_NAME = '1News'
+ IE_DESC = '1news.co.nz article videos'
+ _VALID_URL = r'https?://(?:www\.)?(?:1|one)news\.co\.nz/\d+/\d+/\d+/(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/onenewsnz.py | 26 | Python | 0.857 | refactor | 277 | 37 | 51 | false | [extractor/onenewsnz] Add extractor | 5,088 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'only_matching': True,
}]
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/0xpHIR6IB_default/index.html?videoId=%s'
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
fusion_metadata = self._s... | ```suggestion
if video_id_or_url:
entries.append(self.url_result(video_id_or_url, ie='Youtube'))
``` | 'live_status': 'not_live',
}
}]
}, {
# 2 Brightcove videos
'url': 'https://www.1news.co.nz/2022/09/29/raw-videos-capture-hurricane-ians-fury-as-it-slams-florida/',
'info_dict': {
'id': 'raw-videos-capture-hurrica... | @@ -0,0 +1,95 @@
+from .common import InfoExtractor
+
+from ..utils import (
+ ExtractorError,
+ traverse_obj
+)
+
+
+class OneNewsNZIE(InfoExtractor):
+ IE_NAME = '1News'
+ IE_DESC = '1news.co.nz article videos'
+ _VALID_URL = r'https?://(?:www\.)?(?:1|one)news\.co\.nz/\d+/\d+/\d+/(?P<id>[^/?#&]+)'
+ ... | yt_dlp/extractor/onenewsnz.py | 26 | Python | 0.714 | suggestion | 139 | 32 | 49 | false | [extractor/onenewsnz] Add extractor | 5,088 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'description': 'md5:b7325a3d00c7596337dc3ae37e32d35c',
'channel': 'The Rubin Report',
'channel_follower_count': int,
'comment_count': int,
'categories': ['News & Politics'],
'like_count': int,
'uploader_url': 'http://www.youtube.com/use... | ```suggestion
video_json = self._download_json(f'https://www.israelnationalnews.com/Generic/NewAPI/Item?type=0&Item={video_id}', video_id)
```
| 'info_dict': {
'id': 'jA84wQhVvg8',
'title': 'Even CNN Host Is Shocked by How Bad Biden\'s Approval Ratings Have Gotten | DM CLIPS | Rubin Report',
'ext': 'mp4',
'description': 'md5:b7325a3d00c7596337dc3ae37e32d35c',
'channel': ... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.israelnationalnews.com/news/354520',
+ ... | yt_dlp/extractor/israelnationalnews.py | 26 | Python | 0.857 | suggestion | 154 | 34 | 39 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
'like_count': int,
'uploader_url': 'http://www.youtube.com/user/RubinReport',
'uploader_id': 'RubinReport',
'availability': 'public',
'view_count': int,
'duration': 240,
'thumbnail': 'https://i.ytimg.com/vi_webp/jA84wQhVvg8/maxresdefaul... | shouldn't this have `expected=True`? | 'channel': 'The Rubin Report',
'channel_follower_count': int,
'comment_count': int,
'categories': ['News & Politics'],
'like_count': int,
'uploader_url': 'http://www.youtube.com/user/RubinReport',
'uploader_i... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.israelnationalnews.com/news/354520',
+ ... | yt_dlp/extractor/israelnationalnews.py | 26 | Python | 0.286 | question | 36 | 29 | 34 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
'channel_follower_count': int,
'comment_count': int,
'categories': ['News & Politics'],
'like_count': int,
'uploader_url': 'http://www.youtube.com/user/RubinReport',
'uploader_id': 'RubinReport',
'availability': 'public',
'v... | Are you sure there cannot be multiple embeds? | 'title': 'Even CNN Host Is Shocked by How Bad Biden\'s Approval Ratings Have Gotten | DM CLIPS | Rubin Report',
'ext': 'mp4',
'description': 'md5:b7325a3d00c7596337dc3ae37e32d35c',
'channel': 'The Rubin Report',
'channel_follower_count': in... | @@ -0,0 +1,45 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.israelnationalnews.com/news/354520',
+ ... | yt_dlp/extractor/israelnationalnews.py | 26 | Python | 0.071 | question | 45 | 32 | 37 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
from .infoq import InfoQIE
from .instagram import (
InstagramIE,
InstagramIOSIE,
InstagramUserIE,
InstagramTagIE,
InstagramStoryIE,
)
from .internazionale import InternazionaleIE
from .internetvideoarchive import InternetVideoArchiveIE
from .iprima import (
IPrimaIE,
IPrimaCNNIE
)
from .iqiy... | ```suggestion
from .israelnationalnews import IsraelNationalNewsIE
```
is the convention | from .infoq import InfoQIE
from .instagram import (
InstagramIE,
InstagramIOSIE,
InstagramUserIE,
InstagramTagIE,
InstagramStoryIE,
)
from .internazionale import InternazionaleIE
from .internetvideoarchive import InternetVideoArchiveIE
from .iprima import (
IPrimaIE,
IPrimaCNNIE
)
from .iqiy... | @@ -753,6 +753,9 @@
IslamChannelIE,
IslamChannelSeriesIE,
)
+from .israelnationalnews import (
+ IsraelNationalNewsIE
+) | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | suggestion | 91 | 51 | 51 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class IsraelNationalNewsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://www.israelnationalnews.com/news/354520',
'info_dict': {
... | Since u changed it to playlist, test needs to be updated accordingly | from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class IsraelNationalNewsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.israelnationalnews.com/news/354520',
'info_dict': {
... | @@ -0,0 +1,47 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
+ _TESTS = [{ | yt_dlp/extractor/israelnationalnews.py | 7 | Python | 0.286 | suggestion | 68 | 32 | 32 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
'view_count': int,
'duration': 240,
'thumbnail': 'https://i.ytimg.com/vi_webp/jA84wQhVvg8/maxresdefault.webp',
'live_status': 'not_live',
'playable_in_embed': True,
'age_limit': 0,
'tags': 'count:29',
'channel_id': 'UCJdKr0B... | ```suggestion
news_article_id = self._match_id(url)
article_json = self._download_json(
f'https://www.israelnationalnews.com/Generic/NewAPI/Item?type=0&Item={news_article_id}', news_article_id)
urls = traverse_obj(article_json, ('Content2', ..., 'content', ..., 'attrs', 'src'))... | 'like_count': int,
'uploader_url': 'http://www.youtube.com/user/RubinReport',
'uploader_id': 'RubinReport',
'availability': 'public',
'view_count': int,
'duration': 240,
'thumbnail': 'https://i.ytimg.com/vi_w... | @@ -0,0 +1,47 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https://www.israelnationalnews.com/news/354520',
+ ... | yt_dlp/extractor/israelnationalnews.py | 26 | Python | 1 | refactor | 519 | 27 | 30 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class IsraelNationalNewsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://www.israelnationalnews.com/news/354520',
'info_dict': {
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class IsraelNationalNewsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.israelnationalnews.com/news/354520',
'info_dict': {
... | @@ -0,0 +1,50 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class IsraelNationalNewsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?israelnationalnews\.com/news/(?P<id>[0-9]+)' | yt_dlp/extractor/israelnationalnews.py | 6 | Python | 0.571 | suggestion | 99 | 31 | 31 | false | Add Israel National News extractor | 5,089 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bobscorn |
master_ytcfg = self.extract_ytcfg(video_id, webpage) or self._get_default_ytcfg()
player_responses, player_url = self._extract_player_responses(
self._get_requested_clients(url, smuggled_data),
video_id, webpage, master_ytcfg, smuggled_data)
return webpage, master_ytcf... | ```suggestion
else None if None in (is_live, is_upcoming, live_content)
else 'was_live' if live_content else 'not_live')
``` |
master_ytcfg = self.extract_ytcfg(video_id, webpage) or self._get_default_ytcfg()
player_responses, player_url = self._extract_player_responses(
self._get_requested_clients(url, smuggled_data),
video_id, webpage, master_ytcfg, smuggled_data)
return webpage, master_ytcf... | @@ -3652,11 +3679,23 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
is_live = get_first(video_details, 'isLive')
if is_live is None:
is_live = get_first(live_broadcast_details, 'isLiveNow')
+ live_content = get_first(video_details, 'isLiveConten... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 173 | 51 | 51 | false | [extractor/youtube] Download manifestless post-live videos from the start | 5,091 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
from ..utils import NO_DEFAULT, determine_protocol
def get_suitable_downloader(info_dict, params={}, default=NO_DEFAULT, protocol=None, to_stdout=False):
info_dict['protocol'] = determine_protocol(info_dict)
info_copy = info_dict.copy()
info_copy['to_stdout'] = to_stdout
protocols = (protocol or info... | ```suggestion
and set(protocols) == {'http_dash_segments_generator'}):
``` | from ..utils import NO_DEFAULT, determine_protocol
def get_suitable_downloader(info_dict, params={}, default=NO_DEFAULT, protocol=None, to_stdout=False):
info_dict['protocol'] = determine_protocol(info_dict)
info_copy = info_dict.copy()
info_copy['to_stdout'] = to_stdout
protocols = (protocol or info... | @@ -13,7 +13,8 @@ def get_suitable_downloader(info_dict, params={}, default=NO_DEFAULT, protocol=N
return FFmpegFD
elif (set(downloaders) == {DashSegmentsFD}
and not (to_stdout and len(protocols) > 1)
- and set(protocols) == {'http_dash_segments_generator'}):
+ and set(protoco... | yt_dlp/downloader/__init__.py | 17 | Python | 0.571 | suggestion | 86 | 42 | 42 | false | [extractor/youtube] Download manifestless post-live videos from the start | 5,091 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
webpage, master_ytcfg, player_responses, player_url = self._download_player_responses(url, smuggled_data, video_id, webpage_url)
playability_statuses = traverse_obj(
player_responses, (..., 'playabilityStatus'), expected_type=dict, default=[])
trailer_video_id = get_first(
... | would appreciate if someone can double check this logic |
master_ytcfg = self.extract_ytcfg(video_id, webpage) or self._get_default_ytcfg()
player_responses, player_url = self._extract_player_responses(
self._get_requested_clients(url, smuggled_data),
video_id, webpage, master_ytcfg, smuggled_data)
return webpage, master_ytcf... | @@ -3652,11 +3679,23 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
is_live = get_first(video_details, 'isLive')
if is_live is None:
is_live = get_first(live_broadcast_details, 'isLiveNow')
+ live_content = get_first(video_details, 'isLiveConten... | yt_dlp/extractor/youtube.py | 26 | Python | 0.214 | suggestion | 55 | 51 | 51 | false | [extractor/youtube] Download manifestless post-live videos from the start | 5,091 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
from .common import InfoExtractor
from .jwplatform import JWPlatformIE
class BundesligaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos\?vid=(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.bundesliga.com/en/bundesliga/videos?vid=bhhHkKyN',
'md5': '8f... | minor nitpick, but since I assume this is a JWPlatform id, might as well keep it as the same as JWPlatform id regex:
```suggestion
_VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos\?vid=(?P<id>[a-zA-Z0-9]{8})'
``` | from .common import InfoExtractor
from .jwplatform import JWPlatformIE
class BundesligaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos(?:/[^?]+)?\?vid=(?P<id>[a-zA-Z0-9]{8})'
_TESTS = [
{
'url': 'https://www.bundesliga.com/en/bundesliga/video... | @@ -0,0 +1,26 @@
+from .common import InfoExtractor
+from .jwplatform import JWPlatformIE
+
+
+class BundesligaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos\?vid=(?P<id>\w+)' | yt_dlp/extractor/bundesliga.py | 6 | Python | 0.786 | suggestion | 249 | 27 | 31 | false | [extractor/bundesliga] Add extractor | 5,094 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | Fabi019 |
'info_dict': {
'id': 'bhhHkKyN',
'ext': 'mp4',
'title': 'Watch: Alphonso Davies and Jeremie Frimpong head-to-head',
'thumbnail': 'https://cdn.jwplayer.com/v2/media/bhhHkKyN/poster.jpg?width=720',
'upload_date': '20220928',
... | ```suggestion
return self.url_result(f'jwplatform:{video_id}', JWPlatformIE, video_id)
``` | from .common import InfoExtractor
from .jwplatform import JWPlatformIE
class BundesligaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos(?:/[^?]+)?\?vid=(?P<id>[a-zA-Z0-9]{8})'
_TESTS = [
{
'url': 'https://www.bundesliga.com/en/bundesliga/video... | @@ -0,0 +1,36 @@
+from .common import InfoExtractor
+from .jwplatform import JWPlatformIE
+
+
+class BundesligaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?bundesliga\.com/[a-z]{2}/bundesliga/videos(?:/[^?]+)?\?vid=(?P<id>[a-zA-Z0-9]{8})'
+ _TESTS = [
+ {
+ 'url': 'https://www.bundesli... | yt_dlp/extractor/bundesliga.py | 26 | Python | 0.714 | suggestion | 100 | 27 | 35 | false | [extractor/bundesliga] Add extractor | 5,094 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
'Pop-Up Museum zeigt Schwarze Unterhaltung und Black Music',
'subtitles': {'de': [{
'url': 'https://hr-a.akamaihd.net/video/as/hessenschau/2020_08/hrLogo_200826200407_L385592_512x288-25p-500kbit.vtt'
}]},
'timestamp': 1598400000,
... | These dont need to be functions imo | 'url': 'https://www.hessenschau.de/tv-sendung/hessenschau-vom-26082020,video-130546.html',
'md5': '5c4e0ba94677c516a2f65a84110fc536',
'info_dict': {
'id': '130546',
'ext': 'mp4',
'description': 'Sturmtief Kirsten fegt über Hessen / Die Corona-Pandemie – eine C... | @@ -33,25 +32,28 @@ class HRFernsehenIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
- def extract_airdate(self, loader_data):
- airdate_str = loader_data.get('mediaMetadata', {}).get('agf', {}).get('airdate')
+ def extract_datetime(self, webpage):
+ datetime = self._search_regex(r'<time\sdateti... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.071 | suggestion | 35 | 51 | 51 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
loader_str = unescapeHTML(self._search_regex(r"data-(?:new-)?hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
loader_data = json.loads(loader_str)
info = {
'id': video_id,
'title': title,
'description': description,
'formats': self.extract... | why so complicated?
```py
info['thumbnail'] = self._search_regex(..., default=None)
``` | import json
import re
from ..utils import (
int_or_none,
traverse_obj,
try_call,
unescapeHTML,
unified_timestamp,
)
from .common import InfoExtractor
class HRFernsehenIE(InfoExtractor):
IE_NAME = 'hrfernsehen'
_VALID_URL = r'^https?://www\.(?:hr-fernsehen|hessenschau)\.de/.*,video-(?P<id>... | @@ -72,21 +74,30 @@ def _real_extract(self, url):
description = self._html_search_meta(
['description'], webpage)
- loader_str = unescapeHTML(self._search_regex(r"data-new-hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
+ loader_str = unescapeHTML(self._search_regex(r"data... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.571 | question | 90 | 29 | 93 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_meta(
['og:title', 'twitter:title', 'name'], webpage)
description = self._html_search_meta(
['description'], webpage)
... | ```suggestion
subtitle = traverse_obj(loader_data, ('mediaCollection', 'subTitles', 0, 'sources', 0, 'url'))
if subtitle:
info['subtitles'] = {'de': [{'url': subtitle}]}
```
This can be further simplified by moving it above `info = {...}`
Then u can also move `thumbnails` above it, a... |
title = self._html_search_meta(
['og:title', 'twitter:title', 'name'], webpage)
description = self._html_search_meta(
['description'], webpage)
loader_str = unescapeHTML(self._search_regex(r"data-(?:new-)?hr-mediaplayer-loader='([^']*)'", webpage, 'ardloader'))
... | @@ -72,21 +74,30 @@ def _real_extract(self, url):
description = self._html_search_meta(
['description'], webpage)
- loader_str = unescapeHTML(self._search_regex(r"data-new-hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
+ loader_str = unescapeHTML(self._search_regex(r"data... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.857 | suggestion | 346 | 38 | 26 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
'description': 'Sturmtief Kirsten fegt über Hessen / Die Corona-Pandemie – eine Chronologie / '
'Sterbehilfe: Die Lage in Hessen / Miss Hessen leitet zwei eigene Unternehmen / '
'Pop-Up Museum zeigt Schwarze Unterhaltung und Black Music',
'su... | ```suggestion
'format_id': try_call(lambda: f'{inner["maxHResolutionPx"]}p'),
'height': inner.get('maxHResolutionPx'),
``` | _TESTS = [{
'url': 'https://www.hessenschau.de/tv-sendung/hessenschau-vom-26082020,video-130546.html',
'md5': '5c4e0ba94677c516a2f65a84110fc536',
'info_dict': {
'id': '130546',
'ext': 'mp4',
'description': 'Sturmtief Kirsten fegt über Hessen / Die Corona-P... | @@ -33,25 +33,18 @@ class HRFernsehenIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
- def extract_airdate(self, loader_data):
- airdate_str = loader_data.get('mediaMetadata', {}).get('agf', {}).get('airdate')
-
- if airdate_str is None:
- return None
-
- return unified_timestamp(... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.714 | suggestion | 157 | 51 | 51 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
['og:title', 'twitter:title', 'name'], webpage)
description = self._html_search_meta(
['description'], webpage)
loader_str = unescapeHTML(self._search_regex(r"data-(?:new-)?hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
loader_data = json.loads(loader_str)
... | ```suggestion
'timestamp': unified_timestamp(self._search_regex(
r'<time\sdatetime="(\d{4}\W\d{1,2}\W\d{1,2})', webpage, 'datetime', fatal=False)),
'duration': int_or_none(traverse_obj(
loader_data, ('playerConfig', 'pluginData', 'trackingAti@all', 'richMedia'... |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_meta(
['og:title', 'twitter:title', 'name'], webpage)
description = self._html_search_meta(
['description'], webpage)
... | @@ -72,22 +65,28 @@ def _real_extract(self, url):
description = self._html_search_meta(
['description'], webpage)
- loader_str = unescapeHTML(self._search_regex(r"data-new-hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
+ loader_str = unescapeHTML(self._search_regex(r"data... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.786 | suggestion | 450 | 30 | 30 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
import json
import re
from ..utils import int_or_none, traverse_obj, unescapeHTML, unified_timestamp
from .common import InfoExtractor
class HRFernsehenIE(InfoExtractor):
IE_NAME = 'hrfernsehen'
_VALID_URL = r'^https?://www\.(?:hr-fernsehen|hessenschau)\.de/.*,video-(?P<id>[0-9]{6})\.html'
_TESTS = [{
... | ```suggestion
from ..utils import (
int_or_none,
traverse_obj,
try_call,
unescapeHTML,
unified_timestamp,
)
``` | import json
import re
from ..utils import (
int_or_none,
traverse_obj,
try_call,
unescapeHTML,
unified_timestamp,
)
from .common import InfoExtractor
class HRFernsehenIE(InfoExtractor):
IE_NAME = 'hrfernsehen'
_VALID_URL = r'^https?://www\.(?:hr-fernsehen|hessenschau)\.de/.*,video-(?P<id>... | @@ -1,14 +1,13 @@
import json
import re
-from ..utils import int_or_none, unified_timestamp, unescapeHTML
+from ..utils import int_or_none, traverse_obj, unescapeHTML, unified_timestamp | yt_dlp/extractor/hrfensehen.py | 4 | Python | 0.714 | security | 139 | 29 | 29 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
}
}, {
'url': 'https://www.hr-fernsehen.de/sendungen-a-z/mex/sendungen/fair-und-gut---was-hinter-aldis-eigenem-guetesiegel-steckt,video-130544.html',
'only_matching': True
}]
_GEO_COUNTRIES = ['DE']
def extract_formats(self, loader_data):
stream_formats = []
dat... | this is bad, but since it's legacy code, I wont request change | }]},
'timestamp': 1598400000,
'upload_date': '20200826',
'thumbnail': 'https://www.hessenschau.de/tv-sendung/hs_ganz-1554~_t-1598465545029_v-16to9.jpg',
'title': 'hessenschau vom 26.08.2020',
'duration': 1654
}
}, {
'url': 'http... | @@ -33,25 +33,18 @@ class HRFernsehenIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
- def extract_airdate(self, loader_data):
- airdate_str = loader_data.get('mediaMetadata', {}).get('agf', {}).get('airdate')
-
- if airdate_str is None:
- return None
-
- return unified_timestamp(... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.286 | suggestion | 62 | 51 | 51 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
'url': inner['url'],
}
quality_information = re.search(r'([0-9]{3,4})x([0-9]{3,4})-([0-9]{2})p-([0-9]{3,4})kbit',
inner['url'])
if quality_information:
stream_format['width'] = int_or_none(quality_informatio... | ```suggestion
loader_str = unescapeHTML(self._search_regex(r"data-(?:new-)?hr-mediaplayer-loader='([^']*)'", webpage, 'ardloader'))
``` | stream_formats = []
data = loader_data['mediaCollection']['streams'][0]['media']
for inner in data[1:]:
stream_format = {
'format_id': try_call(lambda: f'{inner["maxHResolutionPx"]}p'),
'height': inner.get('maxHResolutionPx'),
'url': in... | @@ -72,22 +65,28 @@ def _real_extract(self, url):
description = self._html_search_meta(
['description'], webpage)
- loader_str = unescapeHTML(self._search_regex(r"data-new-hr-mediaplayer-loader='([^']*)'", webpage, "ardloader"))
+ loader_str = unescapeHTML(self._search_regex(r"data... | yt_dlp/extractor/hrfensehen.py | 26 | Python | 0.714 | security | 145 | 51 | 51 | false | [extractor/hrfensehen] : fixed `hrfensehen` broken extractor | 5,096 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | snapdgn |
data, content_type = multipart_encode(form_data)
return self._download_webpage(
urljoin(url, '/a/validatebirth'), video_id, *args,
data=data, headers={
'Referer': url,
'Content-Type': content_type,
}, **kwargs)
def _real_extract(se... | Use `self._get_cookies` to get cookies.
But, I don't understand what u r trying to do here. Where does `ytdlp-internal.cda.pl` come from? | 'description': 'md5:1b6cb18508daf2dc4e0fa4db77fec24c',
'height': 1080,
'uploader': 'boniek61',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 5554,
'age_limit': 18,
'view_count': int,
'average_rating': float,
},
... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.571 | question | 140 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
urljoin(url, '/a/validatebirth'), video_id, *args,
data=data, headers={
'Referer': url,
'Content-Type': content_type,
}, **kwargs)
def _real_extract(self, url):
video_id = self._match_id(url)
self._set_cookie('cda.pl', 'cda.player'... | Save this in cache instead of cookies (see discussion on discord) | 'uploader': 'boniek61',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 5554,
'age_limit': 18,
'view_count': int,
'average_rating': float,
},
}, {
'url': 'http://ebd.cda.pl/0x0/5749950c',
'only_matching': True,
}]... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.286 | performance | 65 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
if 'Ten film jest dostępny dla użytkowników premium' in webpage:
raise ExtractorError('This video is only available for premium users.', expected=True)
if re.search(r'niedostępn[ey] w(?: |\s+)Twoim kraju\s*<', webpage):
self.raise_geo_restricted()
need_confirm_age... | ```suggestion
password_hash = base64.urlsafe_b64encode(hmac.new(
's01m1Oer5IANoyBXQETzSOLWXgWs01m1Oer5bMg5xrTMMxRZ9Pi4fIPeFgIVRZ9PeXL8mPfXQETZGUAN5StRZ9P'.encode('utf-8'),
''.join((
'{:0>2}'.format(bytes((bt & 255, )).hex())
for bt in hashlib.md5(pass... |
def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
form_data = random_birthday('rok', 'miesiac', 'dzien')
form_data.update({'return': url, 'module': 'video', 'module_id': video_id})
data, content_type = multipart_encode(form_data)
return self._download_webpage(
... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.857 | suggestion | 458 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
need_confirm_age = False
if self._html_search_regex(r'(<form[^>]+action="[^"]*/a/validatebirth[^"]*")',
webpage, 'birthday validate form', default=None):
webpage = self._download_age_confirm_page(
url, video_id, note='Confirming age')
... | use query param to make sure username is encoded properly | urljoin(url, '/a/validatebirth'), video_id, *args,
data=data, headers={
'Referer': url,
'Content-Type': content_type,
}, **kwargs)
def _perform_login(self, username, password):
cached_bearer = self.cache.load(self._BEARER_CACHE, username) ... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.286 | suggestion | 57 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
need_confirm_age = False
if self._html_search_regex(r'(<form[^>]+action="[^"]*/a/validatebirth[^"]*")',
webpage, 'birthday validate form', default=None):
webpage = self._download_age_confirm_page(
url, video_id, note='Confirming age')
... | ```suggestion
None, 'Logging in', data=b'',
headers={**self._BASE_API_HEADERS, 'Authorization': self._LOGIN_REQUEST_AUTH})
``` | data=data, headers={
'Referer': url,
'Content-Type': content_type,
}, **kwargs)
def _perform_login(self, username, password):
cached_bearer = self.cache.load(self._BEARER_CACHE, username) or {}
if cached_bearer.get('valid_until', 0) > datetime... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.786 | security | 209 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
form_data = random_birthday('rok', 'miesiac', 'dzien')
form_data.update({'return': url, 'module': 'video', 'module_id': video_id})
data, content_type = multipart_encode(form_data)
return self._download_webpage(
urljoin(url, '/a/validatebirth'), video_id, *args,
da... | rename this to `_perform_login` and remove it from real_extract | 'ext': 'mp4',
'title': 'Bronson (2008) napisy HD 1080p',
'description': 'md5:1b6cb18508daf2dc4e0fa4db77fec24c',
'height': 1080,
'uploader': 'boniek61',
'thumbnail': r're:^https?://.*\.jpg$',
'duration': 5554,
'age_limit': 18... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password): | yt_dlp/extractor/cda.py | 26 | Python | 0.429 | refactor | 63 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
(?:<\1[^>]*>[^<]*</\1>|(?!</\1>)(?:.|\n))*?
<(span|meta)[^>]+itemprop=(["\'])name\4[^>]*>(?P<uploader>[^<]+)</\3>
''', webpage, 'uploader', default=None, group='uploader')
view_count = self._search_regex(
r'Odsłony:(?:\s| )*([0-9]+)', webpage,
'view_c... | See above comment. Then this can be checked with `if 'Authorization' in self._HEADERS` | password_hash = base64.urlsafe_b64encode(hmac.new(
b's01m1Oer5IANoyBXQETzSOLWXgWs01m1Oer5bMg5xrTMMxRZ9Pi4fIPeFgIVRZ9PeXL8mPfXQETZGUAN5StRZ9P',
''.join(f'{bytes((bt & 255, )).hex():0>2}'
for bt in hashlib.md5(password.encode()).digest()).encode(),
hashlib.s... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.357 | security | 86 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
info_dict = {
'id': video_id,
'title': self._og_search_title(webpage),
'description': self._og_search_description(webpage),
'uploader': uploader,
'view_count': int_or_none(view_count),
'average_rating': float_or_none(average_rating),
... | put this in the headers dict when logging in | 'grant_type': 'password',
'login': username,
'password': password_hash,
})
self.cache.store(self._BEARER_CACHE, username, {
'token': token_res['access_token'],
'valid_until': token_res['expires_in'] + datetime.datetime.now().tim... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.071 | suggestion | 44 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
'description': self._og_search_description(webpage),
'uploader': uploader,
'view_count': int_or_none(view_count),
'average_rating': float_or_none(average_rating),
'thumbnail': self._og_search_thumbnail(webpage),
'formats': formats,
'dur... | any reason this isnt just
```suggestion
if meta.get('premium') and not meta.get('premium_free'):
``` | self.cache.store(self._BEARER_CACHE, username, {
'token': token_res['access_token'],
'valid_until': token_res['expires_in'] + datetime.datetime.now().timestamp(),
})
self._API_HEADERS['Authorization'] = f'Bearer {token_res["access_token"]}'
def _real_extract(self, ur... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
def extract_format(page, version):
json_str = self._html_search_regex(
r'player_data=(\\?["\'])(?P<player_data>.+?)\1', page,
'%s player_json' % version, fatal=False, group='player_data')
if not json_str:
return
player_data = s... | ```suggestion
'uploader': None if uploader == 'anonim' else uploader,
``` | } for quality in meta['qualities'] if quality.get('file')]
self._sort_formats(formats)
return {
'id': video_id,
'title': meta.get('title'),
'description': meta.get('description'),
'uploader': None if uploader == 'anonim' else uploader,
... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.571 | suggestion | 87 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
for c in a:
f = compat_ord(c)
b.append(chr(33 + (f + 14) % 94) if 33 <= f <= 126 else chr(f))
a = ''.join(b)
a = a.replace('.cda.mp4', '')
for p in ('.2cda.pl', '.3cda.pl'):
a = a.replace(p, '.cda.pl')
if '/upstr... | ```suggestion
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['qualit... | if meta.get('premium') and not meta.get('premium_free'):
self.report_drm(video_id)
uploader = traverse_obj(meta, 'author', 'login')
formats = [{
'url': quality['file'],
'format': quality.get('title'),
'resolution': quality.get('name'),
... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.786 | suggestion | 350 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
}
info = self._search_json_ld(webpage, video_id, default={})
# Source: https://www.cda.pl/js/player.js?t=1606154898
def decrypt_file(a):
for p in ('_XDDD', '_CDA', '_ADC', '_CXD', '_QWE', '_Q5', '_IKSDE'):
a = a.replace(p, '')
a = compat_urllib_p... | ```suggestion
```
core code handles this |
if 'Authorization' in self._API_HEADERS:
return self._api_extract(video_id)
else:
return self._web_extract(video_id, url)
def _api_extract(self, video_id):
meta = self._download_json(
f'{self._BASE_API_URL}/video/{video_id}', video_id, headers=self._API_... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.571 | suggestion | 42 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
return 'https://' + a
return 'https://' + a + '.mp4'
def extract_format(page, version):
json_str = self._html_search_regex(
r'player_data=(\\?["\'])(?P<player_data>.+?)\1', page,
'%s player_json' % version, fatal=False, group='player_data'... | ```suggestion
'title': meta.get('title'),
``` | 'height': try_call(lambda: int(quality['name'][:-1])),
'filesize': quality.get('length'),
} for quality in meta['qualities'] if quality.get('file')]
self._sort_formats(formats)
return {
'id': video_id,
'title': meta.get('title'),
'des... | @@ -83,8 +98,92 @@ def _download_age_confirm_page(self, url, video_id, *args, **kwargs):
'Content-Type': content_type,
}, **kwargs)
+ def _login(self, username, password):
+ token = [c for c in self._downloader.cookiejar if c.domain == 'ytdlp-internal.cda.pl' and c.name == 'tok... | yt_dlp/extractor/cda.py | 26 | Python | 0.571 | suggestion | 59 | 51 | 51 | false | cda: allow using api | 5,100 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
import re
import uuid
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
ExtractorError,
)
class WyborczaVideoIE(InfoExtractor):
# this id is not an article id, it has to be extracted from the article
_VALID_URL = r'(?:wyborcza:video:|https?://wyborcza\.pl/(?:api... | Why the prefix? I prefer to add them only if there is no other way | import functools
import uuid
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
month_by_name,
parse_duration,
try_call,
)
class WyborczaVideoIE(InfoExtractor):
# this id is not an article id, it has to be extracted from the article
... | @@ -0,0 +1,266 @@
+import re
+import uuid
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_duration,
+ ExtractorError,
+)
+
+
+class WyborczaVideoIE(InfoExtractor):
+ # this id is not an article id, it has to be extracted from the article
+ _VALID_URL = r'(?:wyborcza:vid... | yt_dlp/extractor/agora.py | 17 | Python | 0.286 | question | 66 | 42 | 42 | false | add agora extractors (tokfm, wyborcza) | 5,101 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
'thumbnail': 'https://i.mycdn.me/videoPreview?id=1369902483995&type=37&idx=2&tkn=fqlnoQD_xwq5ovIlKfgNyU08qmM&fn=external_8',
'title': 'Boosty для тебя!',
'uploader_id': '597811038747',
'like_count': 0,
'duration': 35,
},
... | ```suggestion
for x in super()._extract_embed_urls(url, webpage):
yield smuggle_url(x, {'referrer': scheme_host_only(url)})
```
doesnt referer=url work? | },
}]
@classmethod
def _extract_embed_urls(cls, url, webpage):
for x in super()._extract_embed_urls(url, webpage):
yield smuggle_url(x, {'referrer': url})
def _real_extract(self, url):
try:
return self._extract_desktop(url)
except ExtractorError ... | @@ -30,135 +33,200 @@ class OdnoklassnikiIE(InfoExtractor):
(?P<id>[\d-]+)
'''
_EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:odnoklassniki|ok)\.ru/videoembed/.+?)\1']
- _TESTS = [{
- 'note': 'Coub embedded',
- 'url': 'http://ok.ru/video/148... | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 0.786 | refactor | 176 | 51 | 51 | false | [extractor/odnoklassniki] Boosty.to support | 5,105 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | megapro17 |
}
]
@classmethod
def _extract_embed_urls(cls, url, webpage):
yield from (smuggle_url(x, {'referrer': scheme_host_only(url)}) for x in super()._extract_embed_urls(url, webpage))
def _real_extract(self, url):
try:
return self._extract_desktop(url)
except Extra... | ```suggestion
url, smuggled = unsmuggle_url(url, {})
video_id, is_embed = self._match_valid_url(url).group('id', 'embed')
mode = 'videoembed' if is_embed else 'video'
```
`embed` can be captured in L28 | compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0])
url, smuggled = unsmuggle_url(url, {})
video_id, is_embed = self._match_valid_url(url).group('id', 'embed')
mode = 'videoembed' if is_embed else 'video'
webpage = self._download_webpage(
f'http... | @@ -174,16 +242,26 @@ def _extract_desktop(self, url):
start_time = int_or_none(compat_parse_qs(
compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0])
+ url, smuggled = unsmuggle_url(url, {})
+
video_id = self._match_id(url)
+ mode = 'videoembed' if '/vide... | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 0.786 | suggestion | 230 | 51 | 51 | false | [extractor/odnoklassniki] Boosty.to support | 5,105 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | megapro17 |
# error message of desktop webpage is in English
raise e
def _extract_desktop(self, url):
start_time = int_or_none(compat_parse_qs(
compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0])
url, smuggled = unsmuggle_url(url, {})
video... | line too long
```suggestion
if (error == 'The author of this video has not been found or is blocked'
and not smuggled.get('referrer') and mode == 'videoembed'):
return self._extract_desktop(smuggle_url(url, {'referrer': 'https://boosty.to'}))
``` | # Direct link from boosty
if (error == 'The author of this video has not been found or is blocked'
and not smuggled.get('referrer') and mode == 'videoembed'):
return self._extract_desktop(smuggle_url(url, {'referrer': 'https://boosty.to'}))
elif error:
rai... | @@ -174,16 +242,26 @@ def _extract_desktop(self, url):
start_time = int_or_none(compat_parse_qs(
compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0])
+ url, smuggled = unsmuggle_url(url, {})
+
video_id = self._match_id(url)
+ mode = 'videoembed' if '/vide... | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 1 | security | 287 | 51 | 51 | false | [extractor/odnoklassniki] Boosty.to support | 5,105 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | megapro17 |
'title': 'Народная забава',
'uploader': 'Nevata',
'upload_date': '20181223',
'age_limit': 0,
'uploader_id': 'nevata.s',
'like_count': int,
'duration': 8.08,
'repost_count': int,
},
}, {
'note': 'vk.com em... | Do u know why all the md5s changed? If u don't, just download one of the tests manually and make sure we are fetching the correct video | 'uploader': 'Nevata',
'upload_date': '20181223',
'age_limit': 0,
'uploader_id': 'nevata.s',
'like_count': int,
'duration': 8.08,
'repost_count': int,
},
}, {
'note': 'vk.com embedded',
'url': 'https://ok.ru/v... | @@ -64,12 +67,13 @@ class OdnoklassnikiIE(InfoExtractor):
},
}, {
# metadata in JSON
- 'url': 'http://ok.ru/video/20079905452',
- 'md5': '0b62089b479e06681abaaca9d204f152',
+ 'url': 'https://ok.ru/video/20079905452',
+ 'md5': '5d2b64756e2af296e3b383a0bc02a6aa', | yt_dlp/extractor/odnoklassniki.py | 26 | Python | 0.429 | suggestion | 135 | 51 | 51 | false | [extractor/odnoklassniki] Boosty.to support | 5,105 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | megapro17 |
# JWPlatform iframe
'url': 'https://www.covermagazine.co.uk/feature/2465255/business-protection-involved',
'info_dict': {
'id': 'AG26UQXM',
'ext': 'mp4',
'upload_date': '20160719',
'timestamp': 1468923808,
'title': '2016_05_18 Cover L&G... | this is effectively same as
```suggestion
'params': {'allowed_extractors': ['generic', 'jwplatform']},
``` | # JWPlatform iframe
'url': 'https://www.covermagazine.co.uk/feature/2465255/business-protection-involved',
'info_dict': {
'id': 'AG26UQXM',
'ext': 'mp4',
'upload_date': '20160719',
'timestamp': 1468923808,
'title': '2016_05_18 Cover L&G... | @@ -22,13 +22,42 @@ class JWPlatformIE(InfoExtractor):
'only_matching': True,
}]
+ _WEBPAGE_TESTS = [{
+ # JWPlatform iframe
+ 'url': 'https://www.covermagazine.co.uk/feature/2465255/business-protection-involved',
+ 'info_dict': {
+ 'id': 'AG26UQXM',
+ 'ext'... | yt_dlp/extractor/jwplatform.py | 26 | Python | 0.786 | refactor | 117 | 51 | 51 | false | [extractor/JWPlatform] Fix extractor | 5,112 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
)
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)'''
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulko... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?iltalehti\.fi/[^/?#]+/a/(?P<id>[^/?#])'
``` | from .common import InfoExtractor
from ..utils import js_to_json, traverse_obj
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?iltalehti\.fi/[^/?#]+/a/(?P<id>[^/?#])'
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulkomaat/a/9fbd067f... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+)
+
+
+class IltalehtiIE(InfoExtractor):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)''' | yt_dlp/extractor/iltalehti.py | 9 | Python | 0.571 | suggestion | 97 | 34 | 34 | false | [extractor/iltalehti] New extractor | 5,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
# jwplatform embed body
{
'url': 'https://www.iltalehti.fi/politiikka/a/1ce49d85-1670-428b-8db8-d2479b9950a4',
'md5': '9e50334b8f8330ce8828b567a82a3c65',
'info_dict': {
'id': '18R6zkLi',
'ext': 'mp4',
'title': 'Pekka Tov... | ```suggestion
props = traverse_obj(info, (
'state', 'articles', ..., 'items', (('main_media', 'properties'), ('body', ..., 'properties'))))
``` | 'md5': '9e50334b8f8330ce8828b567a82a3c65',
'info_dict': {
'id': '18R6zkLi',
'ext': 'mp4',
'title': 'Pekka Toverin arvio: Näin Nord Stream -kaasuputken räjäyttäminen on saatettu toteuttaa',
'description': 'md5:3d1302c9e17e7ffd564143f... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+)
+
+
+class IltalehtiIE(InfoExtractor):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)'''
+ _TESTS = [
+ # jwplatform embed main_media
+ {
+ 'url': ... | yt_dlp/extractor/iltalehti.py | 26 | Python | 0.714 | suggestion | 166 | 37 | 27 | false | [extractor/iltalehti] New extractor | 5,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'url': 'https://www.iltalehti.fi/politiikka/a/1ce49d85-1670-428b-8db8-d2479b9950a4',
'md5': '9e50334b8f8330ce8828b567a82a3c65',
'info_dict': {
'id': '18R6zkLi',
'ext': 'mp4',
'title': 'Pekka Toverin arvio: Näin Nord Stream -kaasuputken ... | ```suggestion
video_ids = traverse_obj(props, (lambda _, v: v['provider'] == 'jwplayer', 'id'))
``` | from .common import InfoExtractor
from ..utils import js_to_json, traverse_obj
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?iltalehti\.fi/[^/?#]+/a/(?P<id>[^/?#])'
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulkomaat/a/9fbd067f... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+)
+
+
+class IltalehtiIE(InfoExtractor):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)'''
+ _TESTS = [
+ # jwplatform embed main_media
+ {
+ 'url': ... | yt_dlp/extractor/iltalehti.py | 26 | Python | 0.714 | suggestion | 109 | 35 | 52 | false | [extractor/iltalehti] New extractor | 5,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'timestamp': 1664435867,
'duration': 165.0,
'thumbnail': r're:^https?://.*\.jpg',
},
},
]
def _real_extract(self, url):
article_id = self._match_id(url)
webpage = self._download_webpage(url, article_id)
info = self._sea... | ```suggestion
return self.playlist_from_matches(
video_ids, article_id, ie=JWPlatform, getter=lambda id: f'jwplatform:{id}',
title=traverse_obj(info, ('state', 'articles', ..., 'items', 'canonical_title'), get_all=False))
``` | from .common import InfoExtractor
from ..utils import js_to_json, traverse_obj
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?iltalehti\.fi/[^/?#]+/a/(?P<id>[^/?#])'
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulkomaat/a/9fbd067f... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+)
+
+
+class IltalehtiIE(InfoExtractor):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)'''
+ _TESTS = [
+ # jwplatform embed main_media
+ {
+ 'url': ... | yt_dlp/extractor/iltalehti.py | 26 | Python | 0.786 | suggestion | 261 | 27 | 52 | false | [extractor/iltalehti] New extractor | 5,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
from .common import InfoExtractor
from ..utils import (
js_to_json,
traverse_obj,
)
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)?iltalehti\.fi/[^/]+/a/(?P<id>.+)'''
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulko... | ```suggestion
from ..utils import js_to_json, traverse_obj
``` | from .common import InfoExtractor
from ..utils import js_to_json, traverse_obj
class IltalehtiIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?iltalehti\.fi/[^/?#]+/a/(?P<id>[^/?#])'
_TESTS = [
# jwplatform embed main_media
{
'url': 'https://www.iltalehti.fi/ulkomaat/a/9fbd067f... | @@ -0,0 +1,61 @@
+from .common import InfoExtractor
+from ..utils import (
+ js_to_json,
+ traverse_obj,
+)
+ | yt_dlp/extractor/iltalehti.py | 6 | Python | 0.571 | suggestion | 66 | 31 | 31 | false | [extractor/iltalehti] New extractor | 5,117 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'ext': 'mp4',
'title': 'Харків\'яни згадують місто до війни: щемливе відео',
'thumbnail': r're:^https?://.*\.jpe?g',
},
}]
}, {
# 2 media_embeds with YouTube iframes
'url': 'https://24tv.ua/bronetransporteri-ozbroyenni-zsu-shho-vido... | ```suggestion
data = urllib.parse.unquote(extract_attributes(html).get('data-html'))
``` | 'ext': 'mp4',
'title': 'Харків\'яни згадують місто до війни: щемливе відео',
'thumbnail': r're:^https?://.*\.jpe?g',
},
}]
}, {
# 2 media_embeds with YouTube iframes
'url': 'https://24tv.ua/bronetransporteri-ozbroyenni-zsu-shho-vido... | @@ -0,0 +1,146 @@
+import base64
+import re
+from urllib.parse import unquote
+
+from .common import InfoExtractor
+from ..utils import (
+ determine_ext,
+ extract_attributes,
+ get_elements_html_by_class,
+ js_to_json,
+ mimetype2ext,
+ smuggle_url,
+ traverse_obj,
+)
+
+
+class TV24UAVideoIE(Inf... | yt_dlp/extractor/tv24ua.py | 26 | Python | 0.786 | refactor | 102 | 34 | 34 | false | [extractor/24tv.ua] Add extractors | 5,121 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
import base64
import re
from urllib.parse import unquote
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
get_elements_html_by_class,
js_to_json,
mimetype2ext,
smuggle_url,
traverse_obj,
)
class TV24UAVideoIE(InfoExtractor):
_VALID_URL = r'htt... | ```suggestion
import urllib.parse
``` | import base64
import re
import urllib.parse
from .common import InfoExtractor
from ..utils import (
determine_ext,
extract_attributes,
get_elements_html_by_class,
js_to_json,
mimetype2ext,
smuggle_url,
traverse_obj,
)
class TV24UAVideoIE(InfoExtractor):
_VALID_URL = r'https?://24tv\.u... | @@ -0,0 +1,146 @@
+import base64
+import re
+from urllib.parse import unquote | yt_dlp/extractor/tv24ua.py | 3 | Python | 0.429 | suggestion | 39 | 28 | 28 | false | [extractor/24tv.ua] Add extractors | 5,121 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
class ParamountPlusIE(CBSBaseIE):
_VALID_URL = r'''(?x)
(?:
paramountplus:|
https?://(?:www\.)?(?:
paramountplus\.com/(?:shows|movies)/(?:video|[^/]+/video|[^/]+)/
)(?P<id>[\w-]+))'''
# All tests are blocked outside US
_TESTS = [{
'url': 'http... | ```suggestion
'chapters': 'count:3',
```
is sufficient imo |
class ParamountPlusIE(CBSBaseIE):
_VALID_URL = r'''(?x)
(?:
paramountplus:|
https?://(?:www\.)?(?:
paramountplus\.com/(?:shows|movies)/(?:video|[^/]+/video|[^/]+)/
)(?P<id>[\w-]+))'''
# All tests are blocked outside US
_TESTS = [{
'url': 'htt... | @@ -24,14 +24,24 @@ class ParamountPlusIE(CBSBaseIE):
'ext': 'mp4',
'title': 'CatDog - Climb Every CatDog/The Canine Mutiny',
'description': 'md5:7ac835000645a69933df226940e3c859',
- 'duration': 1418,
+ 'duration': 1426,
'timestamp': 920264400,
... | yt_dlp/extractor/paramountplus.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | [extractor/paramountplus] Fix formats request and detection | 5,126 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
denverbroncos|
(?:kc)?chiefs|
raiders|
chargers|
dallascowboys|
giants|
... | Would be better to use `self._search_json`, but unless u want do a refactor, this is good enough | denverbroncos|
(?:kc)?chiefs|
raiders|
chargers|
dallascowboys|
giants|
... | @@ -53,8 +53,7 @@ class NFLBaseIE(InfoExtractor):
)
)/
'''
- _VIDEO_CONFIG_REGEX = r'<script[^>]+id="[^"]*video-config-[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}[^"]*"[^>]*>\s*({.+})' | yt_dlp/extractor/nfl.py | 26 | Python | 0.429 | refactor | 96 | 51 | 51 | false | [extractor/nfl] Fix extractor | 5,130 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'md5': None
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
return next(ZypeIE.extract_from_webpage(self._downloader, url, webpage))
class OfTVPlaylistIE(InfoExtractor):
_VALID_URL = r'https?://(... | ```suggestion
remaining_videos = self._search_json(
r'var\s*remaining_videos\s*=', webpage, 'oftv playlists',
playlist_id, contains_pattern=r'\[.+\]')
```
should work, no? | 'creator': 'This is Fire'
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
info = next(ZypeIE.extract_from_webpage(self._downloader, url, webpage))
info['_type'] = 'url_transparent'
info... | @@ -0,0 +1,51 @@
+from .common import InfoExtractor
+from .zype import ZypeIE
+from ..utils import traverse_obj
+
+
+class OfTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)'
+ _TESTS = [{
+ 'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
+ 'md5': 'cb9... | yt_dlp/extractor/oftv.py | 26 | Python | 0.857 | question | 208 | 30 | 33 | false | OF.TV extractors | 5,134 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
class OfTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
'md5': 'cb9cd5db3bb9ee0d32bfd7e373d6ef0a',
'info_dict': {
'id': '627d7d95b353db0001dadd1a',
'ext': '... | ```suggestion
info = next(ZypeIE.extract_from_webpage(self._downloader, url, webpage))
info['creator'] = self._search_regex(r'<a[^>]+class=\"creator-name\"[^>]+>([^<]+)', webpage, 'creator')
return info
```
convention | class OfTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>\w+)'
_TESTS = [{
'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
'md5': 'cb9cd5db3bb9ee0d32bfd7e373d6ef0a',
'info_dict': {
'id': '627d7d95b353db0001dadd1a',
'ext': 'mp4',
... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from .zype import ZypeIE
+from ..utils import traverse_obj
+
+
+class OfTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)'
+ _TESTS = [{
+ 'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
+ 'md5': 'cb9... | yt_dlp/extractor/oftv.py | 26 | Python | 0.857 | refactor | 246 | 48 | 50 | false | OF.TV extractors | 5,134 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
'id': '627d7d95b353db0001dadd1a',
'ext': 'mp4',
'title': 'E1: Jacky vs Eric',
'thumbnail': r're:^https?://.*\.jpg',
'average_rating': 0,
'description': 'md5:dd16e3e2a8d27d922e7a989f85986853',
'display_id': '',
'duration': 14... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?of.tv/creators/(?P<id>[\w-]+)'
``` | 'id': '627d7d95b353db0001dadd1a',
'ext': 'mp4',
'title': 'E1: Jacky vs Eric',
'thumbnail': r're:^https?://.*\.jpg',
'average_rating': 0,
'description': 'md5:dd16e3e2a8d27d922e7a989f85986853',
'display_id': '',
'duration': 14... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from .zype import ZypeIE
+from ..utils import traverse_obj
+
+
+class OfTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)'
+ _TESTS = [{
+ 'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
+ 'md5': 'cb9... | yt_dlp/extractor/oftv.py | 26 | Python | 0.571 | suggestion | 88 | 42 | 44 | false | OF.TV extractors | 5,134 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
from .common import InfoExtractor
from .zype import ZypeIE
from ..utils import traverse_obj
class OfTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
'md5': 'cb9cd5db3bb9ee0d32bfd7e373d6ef... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>\w+)'
``` | from .common import InfoExtractor
from .zype import ZypeIE
from ..utils import traverse_obj
class OfTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>\w+)'
_TESTS = [{
'url': 'https://of.tv/video/627d7d95b353db0001dadd1a',
'md5': 'cb9cd5db3bb9ee0d32bfd7e373d6ef0a',
... | @@ -0,0 +1,52 @@
+from .common import InfoExtractor
+from .zype import ZypeIE
+from ..utils import traverse_obj
+
+
+class OfTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?of.tv/video/(?P<id>[0-9a-zA-Z]+)' | yt_dlp/extractor/oftv.py | 7 | Python | 0.571 | suggestion | 82 | 32 | 32 | false | OF.TV extractors | 5,134 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | DoubleCouponDay |
from .common import InfoExtractor
from ..utils import ExtractorError, traverse_obj
class Screen9IE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)'
_TESTS = [
{
'url': 'https://api.screen9.com/embed/8kTNE... | ```suggestion
_VALID_URL = r'https?://(?:\w+\.screen9\.(?:tv|com)|play\.su\.se)/(?:embed|media)/(?P<id>[^?#/]+)'
``` | from .common import InfoExtractor
from ..utils import traverse_obj
class Screen9IE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.screen9\.(?:tv|com)|play\.su\.se)/(?:embed|media)/(?P<id>[^?#/]+)'
_TESTS = [
{
'url': 'https://api.screen9.com/embed/8kTNEjvoXGM33dmWwF0uDA',
'md5... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class Screen9IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)' | yt_dlp/extractor/screen9.py | 6 | Python | 0.714 | suggestion | 122 | 31 | 31 | false | [extractor/screen9] Add extractor | 5,137 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
{
'url': 'https://folkhogskolekanalen.screen9.tv/media/gy35PKLHe-5K29RYHga2bw/ett-starkare-samhalle-en-snabbguide-om-sveriges-folkhogskolor',
'md5': 'c9389806e78573ea34fc48b6f94465dc',
'info_dict': {
'id': 'gy35PKLHe-5K29RYHga2bw',
'ext': 'mp4'... | ```suggestion
config = self._search_json(r'var\s+config\s*=', webpage, 'config', video_id)
``` | {
'url': 'https://folkhogskolekanalen.screen9.tv/media/gy35PKLHe-5K29RYHga2bw/ett-starkare-samhalle-en-snabbguide-om-sveriges-folkhogskolor',
'md5': 'c9389806e78573ea34fc48b6f94465dc',
'info_dict': {
'id': 'gy35PKLHe-5K29RYHga2bw',
'ext': 'mp4'... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class Screen9IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)'
+ _TESTS = [
+ {
+ 'url': 'https://a... | yt_dlp/extractor/screen9.py | 26 | Python | 0.714 | suggestion | 104 | 50 | 47 | false | [extractor/screen9] Add extractor | 5,137 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'info_dict': {
'id': 'gy35PKLHe-5K29RYHga2bw',
'ext': 'mp4',
'title': 'Ett starkare samhälle - en snabbguide om Sveriges folkhögskolor',
'thumbnail': r're:^https?://.+\.jpg',
},
},
{
'url': 'https://play.... | ```py
video_id, ext=...)
```
| 'info_dict': {
'id': 'gy35PKLHe-5K29RYHga2bw',
'ext': 'mp4',
'title': 'Ett starkare samhälle - en snabbguide om Sveriges folkhögskolor',
'thumbnail': r're:^https?://.+\.jpg',
},
},
{
'url': 'https://play.... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class Screen9IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)'
+ _TESTS = [
+ {
+ 'url': 'https://a... | yt_dlp/extractor/screen9.py | 26 | Python | 0.429 | suggestion | 44 | 47 | 44 | false | [extractor/screen9] Add extractor | 5,137 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
},
},
{
'url': 'https://play.su.se/media/H1YA0EYNCxiesrSU1kaRBQ/baltic-breakfast',
'md5': '2b817647c3058002526269deff4c0683',
'info_dict': {
'id': 'H1YA0EYNCxiesrSU1kaRBQ',
'ext': 'mp4',
'title': 'Baltic Brea... | why not extract all formats instead of the `if not formats`? | },
},
{
'url': 'https://play.su.se/media/H1YA0EYNCxiesrSU1kaRBQ/baltic-breakfast',
'md5': '2b817647c3058002526269deff4c0683',
'info_dict': {
'id': 'H1YA0EYNCxiesrSU1kaRBQ',
'ext': 'mp4',
'title': 'Baltic Brea... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class Screen9IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)'
+ _TESTS = [
+ {
+ 'url': 'https://a... | yt_dlp/extractor/screen9.py | 26 | Python | 0.429 | refactor | 60 | 42 | 39 | false | [extractor/screen9] Add extractor | 5,137 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
'info_dict': {
'id': 'H1YA0EYNCxiesrSU1kaRBQ',
'ext': 'mp4',
'title': 'Baltic Breakfast',
'thumbnail': r're:^https?://.+\.jpg',
},
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
we... | ```suggestion
return {
``` | 'info_dict': {
'id': 'H1YA0EYNCxiesrSU1kaRBQ',
'ext': 'mp4',
'title': 'Baltic Breakfast',
'thumbnail': r're:^https?://.+\.jpg',
},
},
]
def _real_extract(self, url):
video_id = self._match_id(url)
we... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError, traverse_obj
+
+
+class Screen9IE(InfoExtractor):
+ _VALID_URL = r'https?://(?:(?:api\.)?screen9\.com|[^\.]+\.screen9\.tv|play\.su\.se)/(?:embed|media)/(?P<id>[^"\'?/]+)'
+ _TESTS = [
+ {
+ 'url': 'https://a... | yt_dlp/extractor/screen9.py | 26 | Python | 0.429 | suggestion | 36 | 37 | 34 | false | [extractor/screen9] Add extractor | 5,137 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | tpikonen |
# however some websites are using 'Text' type instead.
# 1. https://schema.org/VideoObject
'uploader': author.get('name') if isinstance(author, dict) else author if isinstance(author, str) else None,
'artist': traverse_obj(e, ('byArtist', 'name'), expected... | ```suggestion
for e in variadic(json_ld):
```
accomplishes the same | # however some websites are using 'Text' type instead.
# 1. https://schema.org/VideoObject
'uploader': author.get('name') if isinstance(author, dict) else author if isinstance(author, str) else None,
'artist': traverse_obj(e, ('byArtist', 'name'), expected... | @@ -1569,11 +1565,18 @@ def extract_video_object(e):
extract_chapter_information(e)
def traverse_json_ld(json_ld, at_top_level=True):
+ if isinstance(json_ld, dict):
+ json_ld = [json_ld]
+ if not isinstance(json_ld, list):
+ return
+
... | yt_dlp/extractor/common.py | 26 | Python | 0.571 | suggestion | 82 | 51 | 51 | false | [extractor/common] Fix `json_ld` type checks | 5,145 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
for json_ld in variadic(json_ld_item):
if isinstance(json_ld, dict):
yield json_ld
def _search_json_ld(self, html, video_id, expected_type=None, *, fatal=True, default=NO_DEFAULT):
"""Search for a video in any json ld in the html"""
if default is not ... | this also seems unnecesary. The check in L1574 should handle all of these | for json_ld in variadic(json_ld_item):
if isinstance(json_ld, dict):
yield json_ld
def _search_json_ld(self, html, video_id, expected_type=None, *, fatal=True, default=NO_DEFAULT):
"""Search for a video in any json ld in the html"""
if default is not ... | @@ -1463,13 +1463,9 @@ def _search_json_ld(self, html, video_id, expected_type=None, *, fatal=True, def
def _json_ld(self, json_ld, video_id, fatal=True, expected_type=None):
if isinstance(json_ld, str):
json_ld = self._parse_json(json_ld, video_id, fatal=fatal)
- if not json_ld:
+ ... | yt_dlp/extractor/common.py | 26 | Python | 0.429 | suggestion | 73 | 51 | 51 | false | [extractor/common] Fix `json_ld` type checks | 5,145 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
float_or_none,
int_or_none,
parse_duration,
str_to_int,
unescapeHTML,
xpath_text,
)
class TNAFlixNetworkBaseIE(InfoExtractor):
# May be overridden in descendants if necessary
... | ```suggestion
_VIDEO_XML_URL = 'https://www.tnaflix.com/cdn/cdn.php?file={}.fid&key={}&VID={}&nomp4=1&catID=0&rollover=1&startThumb=12&embed=0&utm_source=0&multiview=0&premium=1&country=0user=0&vip=1&cd=0&ref=0&alpha'
``` | from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
float_or_none,
int_or_none,
parse_duration,
str_to_int,
unescapeHTML,
xpath_text,
)
class TNAFlixNetworkBaseIE(InfoExtractor):
# May be overridden in descendants if necessary
... | @@ -19,10 +19,15 @@ class TNAFlixNetworkBaseIE(InfoExtractor):
r'config\s*=\s*(["\'])(?P<url>(?:https?:)?//(?:(?!\1).)+)\1',
]
_HOST = 'tna'
+ _VIDEO_XML_URL = "https://www.tnaflix.com/cdn/cdn.php?file={}.fid&key={}&VID={}&nomp4=1&catID=0&rollover=1&" \
+ "startThumb=12&embed=0... | yt_dlp/extractor/tnaflix.py | 23 | Python | 0.857 | suggestion | 227 | 48 | 48 | false | Tnaflix 500 err | 5,150 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SG5 |
first_el = get_child(timeline, ['imageFirst', 'first'])
last_el = get_child(timeline, ['imageLast', 'last'])
if first_el is None or last_el is None:
return
first_text = first_el.text
last_text = last_el.text
if not first_text.isdigit() or not last_text.isdigi... | This seems unnecessary. But I'll let it be since it's legacy code |
first_text = first_el.text
last_text = last_el.text
if not first_text.isdigit() or not last_text.isdigit():
return
first = int(first_text)
last = int(last_text)
if first > last:
return
width = int_or_none(xpath_text(timeline, './imageWid... | @@ -71,6 +76,10 @@ def get_child(elem, names):
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
+
+ def extract_field(pattern, name):
+ return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None | yt_dlp/extractor/tnaflix.py | 26 | Python | 0.214 | suggestion | 65 | 51 | 51 | false | Tnaflix 500 err | 5,150 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SG5 |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
def extract_field(pattern, name):
return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None
for display_id_key in ('display_id', 'display_id_2'):... | ```suggestion
vkey = extract_field(r'<input id="vkey" type="hidden" value="([^"]+)"', 'vkey')
nkey = extract_field(r'<input id="nkey" type="hidden" value="([^"]+)"', 'nkey')
vid = extract_field(r'<input id="VID" type="hidden" value="([^"]+)"', 'vid')
``` |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
def extract_field(pattern, name):
return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None
for display_id_key in ('display_id', 'display_id_2'):... | @@ -85,6 +90,13 @@ def _real_extract(self, url):
self._CONFIG_REGEX, webpage, 'flashvars.config', default=None,
group='url'), 'http:')
+ if not cfg_url:
+ vkey = extract_field(r'<input id="vkey" type="hidden" value="(?P<vkey>[^"]+)" />', 'vkey')
+ nkey = extract_... | yt_dlp/extractor/tnaflix.py | 26 | Python | 1 | refactor | 294 | 51 | 51 | false | Tnaflix 500 err | 5,150 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SG5 |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
def extract_field(pattern, name):
return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None
for display_id_key in ('display_id', 'display_id_2'):... | ```suggestion
vkey = extract_field(r'<input\b[^>]+\bid="vkey"\b[^>]+\bvalue="([^"]+)"', 'vkey')
nkey = extract_field(r'<input\b[^>]+\bid="nkey"\b[^>]+\bvalue="([^"]+)"', 'nkey')
vid = extract_field(r'<input\b[^>]+\bid="VID"\b[^>]+\bvalue="([^"]+)"', 'vid')
``` |
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
def extract_field(pattern, name):
return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None
for display_id_key in ('display_id', 'display_id_2'):... | @@ -85,6 +90,13 @@ def _real_extract(self, url):
self._CONFIG_REGEX, webpage, 'flashvars.config', default=None,
group='url'), 'http:')
+ if not cfg_url:
+ vkey = extract_field(r'<input id="vkey" type="hidden" value="([^"]+)"', 'vkey')
+ nkey = extract_field(r'<in... | yt_dlp/extractor/tnaflix.py | 26 | Python | 0.857 | refactor | 300 | 51 | 51 | false | Tnaflix 500 err | 5,150 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SG5 |
plugins = importlib.util.module_from_spec(plugins_spec)
sys.modules[plugins_spec.name] = plugins
plugins_spec.loader.exec_module(plugins)
for name in dir(plugins):
if name in namespace:
continue
if not name.endswith(suffix):
continu... | Instead, update the @returns imo
```
@returns The result of the object traversal.
If `get_all=True`, and the last path branches,
then a list of results is returned instead.
``` | plugins = importlib.util.module_from_spec(plugins_spec)
sys.modules[plugins_spec.name] = plugins
plugins_spec.loader.exec_module(plugins)
for name in dir(plugins):
if name in namespace:
continue
if not name.endswith(suffix):
continu... | @@ -5304,6 +5304,8 @@ def traverse_obj(
"value"
Each of the provided `paths` is tested and the first producing a valid result will be returned.
+ The next path will also be tested if the path branched but no results could be found.
+ If the branching path is the last of `paths` always return a list. | yt_dlp/utils.py | 26 | Python | 0.857 | suggestion | 256 | 51 | 51 | false | [utils] `traverse_obj`: return `[]` if last path branches without default | 5,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
if is_user_input and key == ':':
key = ...
if not casesense and isinstance(key, str):
key = key.casefold()
if key is ...... | This is clearer imo:
```py
if get_all and has_branched:
if results or (last and default is NO_DEFAULT):
return results.exhaust()
elif results:
return results[0]
``` | def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
if is_user_input and key == ':':
key = ...
if not casesense and isinstance(key, str):
key = key.casefold()
if key is ...... | @@ -5426,18 +5428,20 @@ def apply_path(start_obj, path):
return has_branched, objs
- def _traverse_obj(obj, path):
+ def _traverse_obj(obj, path, last=True):
has_branched, results = apply_path(obj, path)
results = LazyList(x for x in map(type_test, results) if x is not None)
- ... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 227 | 51 | 51 | false | [utils] `traverse_obj`: return `[]` if last path branches without default | 5,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
yield obj[key]
def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
if is_user_input and key == ':':
key = ...
if not casesense and isinstance(key, str):
key = key.casef... | this should check for `get_all` too | yield obj[key]
def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
if is_user_input and key == ':':
key = ...
if not casesense and isinstance(key, str):
key = key.casef... | @@ -5426,18 +5428,20 @@ def apply_path(start_obj, path):
return has_branched, objs
- def _traverse_obj(obj, path):
+ def _traverse_obj(obj, path, last=True):
has_branched, results = apply_path(obj, path)
results = LazyList(x for x in map(type_test, results) if x is not None)
- ... | yt_dlp/utils.py | 26 | Python | 0.286 | suggestion | 35 | 51 | 51 | false | [utils] `traverse_obj`: return `[]` if last path branches without default | 5,170 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
request, None, False, 'Wrong login info')
if not re.search(r'id="tubi-logout"', login_page):
raise ExtractorError(
'Login failed (invalid username/password)', expected=True)
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = sel... | ```suggestion
elif not formats and not video_data.get('policy_match'): # policy_match is False if content was removed
``` | request, None, False, 'Wrong login info')
if not re.search(r'id="tubi-logout"', login_page):
raise ExtractorError(
'Login failed (invalid username/password)', expected=True)
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = sel... | @@ -69,17 +82,26 @@ def _perform_login(self, username, password):
def _real_extract(self, url):
video_id = self._match_id(url)
- video_data = self._download_json(
- 'https://tubitv.com/oz/videos/%s/content?video_resources=dash&video_resources=hlsv3&video_resources=hlsv6' % video_id, vi... | yt_dlp/extractor/tubitv.py | 26 | Python | 0.786 | suggestion | 132 | 51 | 51 | false | [extractor/tubitv] Better DRM detection | 5,171 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
tags = []
for hashtag in (try_get(status, lambda x: x['entities']['hashtags'], list) or []):
hashtag_text = hashtag.get('text')
if not hashtag_text:
continue
tags.append(hashtag_text)
info = {
'id': twid,
'title': titl... | ```suggestion
media_id = traverse_obj(media, 'id_str', 'id', expected_type=str_or_none)
``` | 'tweet_mode': 'extended',
})
title = description = status['full_text'].replace('\n', ' ')
# strip 'https -_t.co_BJYgOjSeGA' junk from filenames
title = re.sub(r'\s+(https?://[^ ]+)', '', title)
user = status.get('user') or {}
uploader = user.get('nam... | @@ -479,6 +580,9 @@ def _real_extract(self, url):
}
def extract_from_video_info(media):
+ media_id = (traverse_obj(media, 'id_str', expected_type=str)
+ or traverse_obj(media, 'id', expected_type=lambda x: str(x))) | yt_dlp/extractor/twitter.py | 26 | Python | 0.857 | suggestion | 105 | 51 | 51 | false | [extractor/twitter] Support multiple media | 5,183 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.