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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'url': 'https://event.on24.com/wcc/r/2639291/82829018E813065A122363877975752E?mode=login&email=johnsmith@gmail.com',
'only_matching': True,
}, {
'url': 'https://event.on24.com/eventRegistration/console/EventConsoleApollo.jsp?&eventid=2639291&sessionid=1&username=&partnerref=&format=fhvideo1&... | I personally wouldn't use `compat_str` just so that the code can't be blindly ported back to py2 😈
But it's okay to use it if u want | mobj = self._match_valid_url(url)
event_id = mobj.group('id_1') or mobj.group('id_2')
event_key = mobj.group('key_1') or mobj.group('key_2')
event_data = self._download_json(
'https://event.on24.com/apic/utilApp/EventConsoleCachedServlet',
event_id, query={
... | @@ -0,0 +1,105 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..compat import (
+ compat_str,
+ compat_urlparse,
+)
+from ..utils import strip_or_none
+
+
+class On24IE(InfoExtractor):
+ IE_NAME = 'on24'
+ IE_DESC = 'ON24'
+
+ _VALID_U... | yt_dlp/extractor/on24.py | 26 | Python | 0.571 | suggestion | 134 | 51 | 50 | false | [on24] Add new extractor | 1,200 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
if not self._is_absolute(media_url):
media_url = 'https://event.on24.com/media/news/corporatevideo/events/%s' % media_url
if m['code'] == 'fhvideo1':
formats.append({
'format_id': 'video',
'url': media_url,
... | if you going to inline return, better keep it 1 line imo
therefore move timestamp above
Also don't use .get chains | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
strip_or_none,
try_get,
urljoin,
)
class On24IE(InfoExtractor):
IE_NAME = 'on24'
IE_DESC = 'ON24'
_VALID_URL = r'''(?x)
https?://event\.on24\.c... | @@ -0,0 +1,105 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..compat import (
+ compat_str,
+ compat_urlparse,
+)
+from ..utils import strip_or_none
+
+
+class On24IE(InfoExtractor):
+ IE_NAME = 'on24'
+ IE_DESC = 'ON24'
+
+ _VALID_U... | yt_dlp/extractor/on24.py | 26 | Python | 0.429 | suggestion | 120 | 31 | 92 | false | [on24] Add new extractor | 1,200 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
formats = []
for m in info_media:
media_url = urljoin('https://event.on24.com/media/news/corporatevideo/events/', str(m['url']))
if m['code'] == 'fhvideo1':
formats.append({
'format_id': 'video',
'url': media_url,
... | the infodict has no language field. It should be set within each format | for media in event_data.get('mediaUrlInfo', []):
media_url = urljoin('https://event.on24.com/media/news/corporatevideo/events/', str(media.get('url')))
if not media_url:
continue
media_type = media.get('code')
if media_type == 'fhvideo1':
... | @@ -0,0 +1,89 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ strip_or_none,
+ try_get,
+ urljoin,
+)
+
+
+class On24IE(InfoExtractor):
+ IE_NAME = 'on24'
+ IE_DESC = 'ON24'
+
+ _VALID_URL = r'''(?x)
+ ... | yt_dlp/extractor/on24.py | 26 | Python | 0.286 | suggestion | 71 | 32 | 34 | false | [on24] Add new extractor | 1,200 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
)
class MicrosoftStreamIE(InfoExtractor):
IE_NAME = 'microsoftstream'
IE_DESC = 'Microsoft Stream'
_VALID_URL = r'https?://(?:web|www|msit)\.microsoftstream\.com/video/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
_TESTS = [{
'url': 'https://web.microsoftstream.com/video/6e... | ```suggestion
headers = {'Authorization': f'Bearer {access_token}'}
``` | parse_resolution,
try_get,
url_basename,
)
class MicrosoftStreamIE(InfoExtractor):
IE_NAME = 'microsoftstream'
IE_DESC = 'Microsoft Stream'
_VALID_URL = r'https?://(?:web|www|msit)\.microsoftstream\.com/video/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
_TESTS = [{
... | @@ -0,0 +1,116 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..compat import compat_b64decode
+from ..utils import (
+ try_get,
+ parse_iso8601,
+ parse_duration,
+ parse_resolution,
+)
+
+
+class MicrosoftStreamIE(InfoExtractor):
+ IE_NAME = 'mic... | yt_dlp/extractor/microsoftstream.py | 26 | Python | 0.571 | security | 81 | 51 | 51 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
def parse_count(s):
if s is None:
return None
s = s.strip()
if re.match(r'^[\d,.]+$', s):
return str_to_int(s)
_UNIT_TABLE = {
'k': 1000,
'K': 1000,
'm': 1000 ** 2,
'M': 1000 ** 2,
'kk': 1000 ** 2,
'KK': 1000 ** 2,
}
return look... | Have you tested that these changes won't break an existing extractor? | def parse_count(s):
if s is None:
return None
s = s.strip()
if re.match(r'^[\d,.]+$', s):
return str_to_int(s)
_UNIT_TABLE = {
'k': 1000,
'K': 1000,
'm': 1000 ** 2,
'M': 1000 ** 2,
'kk': 1000 ** 2,
'KK': 1000 ** 2,
}
return look... | @@ -3689,18 +3689,18 @@ def parse_resolution(s):
if s is None:
return {}
- mobj = re.search(r'\b(?P<w>\d+)\s*[xX×]\s*(?P<h>\d+)\b', s)
+ mobj = re.search(r'(?P<w>\d+)\s*[xX×,]\s*(?P<h>\d+)', s) | yt_dlp/utils.py | 26 | Python | 0.286 | refactor | 69 | 51 | 51 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | damianoamatruda |
fatal=False, headers=headers))
elif playlist['mimeType'] == 'application/dash+xml':
formats.extend(self._extract_mpd_formats(
playlist['playbackUrl'], video_id, mpd_id='dash',
fatal=False, headers=headers))
elif playlist... | move this inside `_get_subtitles` function:
```py
def _get_subtitles(self, ...):
...
return {
'subtitles': captions,
'automatic_captions': auto_captions
}
```
Then in the infodict, use `**extract_subtitles(...)`. That way, the request for subtitles are sent only if the subs are re... | f'{api_url}/videos/{video_id}', video_id,
headers=headers, query={
'$expand': 'creator,tokens,status,liveEvent,extensions',
'api-version': '1.4-private'
})
video_id = video_data.get('id') or video_id
language = video_data.get('language'... | @@ -0,0 +1,113 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from base64 import b64decode
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ parse_duration,
+ parse_resolution,
+ try_get,
+ url_basename,
+)
+
+
+class MicrosoftStreamIE(InfoExtractor):
+ IE... | yt_dlp/extractor/microsoftstream.py | 26 | Python | 0.857 | refactor | 339 | 46 | 51 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
playlist['playbackUrl'], video_id, ism_id='mss',
fatal=False, headers=headers))
self._sort_formats(formats)
subtitles = {}
automatic_captions = {}
text_tracks = self._download_json(
f'{api_url}/videos/{video_id}/texttracks', video_id,
... | ```suggestion
'uploader_id': try_get(video_data, (lambda x: x['creator']['mail'],
lambda x: x['creator']['id']), str),
``` |
thumbnails = []
for thumbnail_id in ('extraSmall', 'small', 'medium', 'large'):
thumbnail_url = try_get(video_data, lambda x: x['posterImage'][thumbnail_id]['url'], str)
if not thumbnail_url:
continue
thumb = {
'id': thumbnail_id,
... | @@ -0,0 +1,113 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from base64 import b64decode
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ parse_duration,
+ parse_resolution,
+ try_get,
+ url_basename,
+)
+
+
+class MicrosoftStreamIE(InfoExtractor):
+ IE... | yt_dlp/extractor/microsoftstream.py | 26 | Python | 0.714 | suggestion | 185 | 39 | 51 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
formats.extend(self._extract_ism_formats(
playlist['playbackUrl'], video_id, ism_id='mss',
fatal=False, headers=headers))
self._sort_formats(formats)
subtitles = {}
automatic_captions = {}
text_tracks = self._download_json(
... | use `try_get` or `traverse_obj` for `uploader` | language = video_data.get('language')
thumbnails = []
for thumbnail_id in ('extraSmall', 'small', 'medium', 'large'):
thumbnail_url = try_get(video_data, lambda x: x['posterImage'][thumbnail_id]['url'], str)
if not thumbnail_url:
continue
thum... | @@ -0,0 +1,113 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from base64 import b64decode
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ parse_duration,
+ parse_resolution,
+ try_get,
+ url_basename,
+)
+
+
+class MicrosoftStreamIE(InfoExtractor):
+ IE... | yt_dlp/extractor/microsoftstream.py | 26 | Python | 0.286 | suggestion | 46 | 40 | 51 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
subtitles = {}
automatic_captions = {}
text_tracks = self._download_json(
f'{api_url}/videos/{video_id}/texttracks', video_id,
note='Downloading subtitles JSON', headers=headers,
query={
'api-version': '1.4-private'
}).get('value')
... | infodict has no language field. Update this inside each applicable format | if not thumbnail_url:
continue
thumb = {
'id': thumbnail_id,
'url': thumbnail_url,
}
thumb_name = url_basename(thumbnail_url)
thumb_name = str(b64decode(thumb_name + '=' * (-len(thumb_name) % 4)))
thu... | @@ -0,0 +1,113 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from base64 import b64decode
+
+from .common import InfoExtractor
+from ..utils import (
+ parse_iso8601,
+ parse_duration,
+ parse_resolution,
+ try_get,
+ url_basename,
+)
+
+
+class MicrosoftStreamIE(InfoExtractor):
+ IE... | yt_dlp/extractor/microsoftstream.py | 26 | Python | 0.214 | style | 73 | 35 | 47 | false | [microsoftstream] Add new extractor | 1,201 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | damianoamatruda |
'timestamp': 1512106377,
'series': 'Mighty Ships',
'season_number': 7,
'episode_number': 3,
'episode': 'Wind Surf',
},
'params': {
'format': 'bestvideo',
'skip_download': True,
}
}, {
'url': 'https://... | ```suggestion
login_token = next(v for k, v in cookies.items() if k.startswith('glt_')).value
except StopIteration:
``` | 'timestamp': 1512106377,
'series': 'Mighty Ships',
'season_number': 7,
'episode_number': 3,
'episode': 'Wind Surf',
},
'params': {
'format': 'bestvideo',
'skip_download': True,
}
}, {
'url': 'https://... | @@ -42,9 +43,55 @@ class SevenPlusIE(BrightcoveNewIE):
'only_matching': True,
}]
+ def _real_initialize(self):
+ self.token = None
+
+ cookies = self._get_cookies('https://7plus.com.au')
+ if not cookies:
+ return
+
+ try:
+ api_key = next(x for x in ... | yt_dlp/extractor/sevenplus.py | 26 | Python | 0.714 | suggestion | 142 | 51 | 51 | false | [7plus] Add support for cookie auth to get 720p video | 1,202 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'series': 'Mighty Ships',
'season_number': 7,
'episode_number': 3,
'episode': 'Wind Surf',
},
'params': {
'format': 'bestvideo',
'skip_download': True,
}
}, {
'url': 'https://7plus.com.au/UUUU?episode-id=AUMS43-0... | cookie based login must never throw error since the cookies may not have been intended to log in to this site | 'series': 'Mighty Ships',
'season_number': 7,
'episode_number': 3,
'episode': 'Wind Surf',
},
'params': {
'format': 'bestvideo',
'skip_download': True,
}
}, {
'url': 'https://7plus.com.au/UUUU?episode-id=AUMS43-0... | @@ -42,9 +43,55 @@ class SevenPlusIE(BrightcoveNewIE):
'only_matching': True,
}]
+ def _real_initialize(self):
+ self.token = None
+
+ cookies = self._get_cookies('https://7plus.com.au')
+ if not cookies:
+ return
+
+ try:
+ api_key = next(x for x in ... | yt_dlp/extractor/sevenplus.py | 26 | Python | 0.5 | suggestion | 109 | 51 | 51 | false | [7plus] Add support for cookie auth to get 720p video | 1,202 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
'login_token': login_token,
'authMode': 'cookie',
'pageURL': 'https://7plus.com.au/',
'sdkBuild': '12471',
'format': 'json',
})
if 'errorMessage' in login_resp:
raise ExtractorError(f'7plus returned an error: {login_resp["errorMess... | ```suggestion
def _real_initialize(self):
self.token = None
cookies = self._get_cookies('https://7plus.com.au')
api_key = next((x for x in cookies if x.startswith('glt_')), '')[4:]
if not api_key: # Cookies are signed out, skip login
return
login_resp ... | 'format': 'json',
}) or {}
if 'errorMessage' in login_resp:
self.report_warning(f'Unable to login: 7plus said: {login_resp["errorMessage"]}')
return
id_token = login_resp.get('id_token')
if not id_token:
self.report_warning('Unable... | @@ -42,9 +43,56 @@ class SevenPlusIE(BrightcoveNewIE):
'only_matching': True,
}]
+ def _real_initialize(self):
+ self.token = None
+
+ cookies = self._get_cookies('https://7plus.com.au')
+ if not cookies:
+ return
+
+ try:
+ api_key = next(x for x in ... | yt_dlp/extractor/sevenplus.py | 26 | Python | 1 | security | 1,641 | 51 | 51 | false | [7plus] Add support for cookie auth to get 720p video | 1,202 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ghost |
_TESTS = [
# hosted on audiomack
{
'url': 'http://www.audiomack.com/song/roosh-williams/extraordinary',
'info_dict':
{
'id': '310086',
'ext': 'mp3',
'uploader': 'Roosh Williams',
'title': 'Extraordina... | would be better to add skip to this test rather than commenting it out.
A comment can be added explaining why it doesn't work. | _TESTS = [
# hosted on audiomack
{
'url': 'http://www.audiomack.com/song/roosh-williams/extraordinary',
'info_dict':
{
'id': '310086',
'ext': 'mp3',
'uploader': 'Roosh Williams',
'title': 'Extraordina... | @@ -29,25 +29,27 @@ class AudiomackIE(InfoExtractor):
}
},
# audiomack wrapper around soundcloud song
+ # Needs new test URL.
{
'add_ie': ['Soundcloud'],
'url': 'http://www.audiomack.com/song/hip-hop-daily/black-mamba-freestyle',
- 'inf... | yt_dlp/extractor/audiomack.py | 26 | Python | 0.429 | suggestion | 128 | 51 | 51 | false | [extractor/audiomack] Updated album and song URL regex | 1,203 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | abdullah-if |
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570... | ```suggestion
m3u8_url = self._download_json( f'https://nbg-api.fite.tv/api/v2/videos/{video_id}/streams', video_id,
headers={'x-flipps-user-agent': 'Flipps/75/9.7'})[0]['url']
```
GH won't let me align the text properly so take care of that as we... | 'title': 'Братя',
'alt_title': 'bratya/season-3/bratq-2021-10-08',
'duration': 1603.0,
'timestamp': 1633724150,
'upload_date': '20211008',
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'descr... | @@ -0,0 +1,51 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677',
+ 'md5': 'b1127a84e61... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.857 | suggestion | 364 | 38 | 50 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Bojidarist |
'info_dict': {
'id': '548677',
'ext': 'mp4',
'title': 'Братя',
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://pla... | you can move these to return like you did with description | 'md5': 'b1127a84e61bed1632b7c2ca9cbb4153',
'info_dict': {
'id': '548677',
'ext': 'mp4',
'title': 'Братя',
'alt_title': 'bratya/season-3/bratq-2021-10-08',
'duration': 1603.0,
'timestamp': 1633724150,
... | @@ -0,0 +1,51 @@
+# coding: utf-8
+from .common import InfoExtractor
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677',
+ 'md5': 'b1127a84e61... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.286 | suggestion | 58 | 42 | 51 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Bojidarist |
'alt_title': 'bratya/season-3/bratq-2021-10-08',
'duration': 1603.0,
'release_date': '2021-10-08T20:15:50+00:00',
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
... | use self._parse_json and self._search_regex | 'timestamp': 1633724150,
'upload_date': '20211008',
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3... | @@ -0,0 +1,63 @@
+# coding: utf-8
+from .common import InfoExtractor
+import re
+import json
+from ..utils import parse_duration
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/season-... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.143 | suggestion | 43 | 47 | 47 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
'description': 'Сезон 3 Епизод 13'
},
}
]
def _real_extract(self, url):
webpage = self._download_webpage(url, self._match_id(url))
video_props = json.loads(re.search(
r'<script\s?id=\"__NEXT_DATA__\"\s?type=\"application/json\">({.+})</script>',
... | ```suggestion
'timestamp': parse_iso8601(video_props['published_at']),
``` | 'description': 'Сезон 3 Епизод 13'
},
}
]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_props = self._parse_json(self._search_regex(
r'<script\s?id=\"__NEXT_DATA__\"\s?ty... | @@ -0,0 +1,63 @@
+# coding: utf-8
+from .common import InfoExtractor
+import re
+import json
+from ..utils import parse_duration
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/season-... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.571 | suggestion | 88 | 29 | 29 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
},
}
]
def _real_extract(self, url):
webpage = self._download_webpage(url, self._match_id(url))
video_props = json.loads(re.search(
r'<script\s?id=\"__NEXT_DATA__\"\s?type=\"application/json\">({.+})</script>',
webpage).group(1))['props']['pageProps']... | ```suggestion
'view_count': int_or_none(video_props['view_count']),
``` | },
}
]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_props = self._parse_json(self._search_regex(
r'<script\s?id=\"__NEXT_DATA__\"\s?type=\"application/json\">({.+})</script>',
... | @@ -0,0 +1,63 @@
+# coding: utf-8
+from .common import InfoExtractor
+import re
+import json
+from ..utils import parse_duration
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/season-... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.571 | suggestion | 85 | 28 | 28 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570... | dont run `_match_id` multiple times. Save it in a variable | 'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570... | @@ -40,9 +40,9 @@ class NovaPlayIE(InfoExtractor):
def _real_extract(self, url):
webpage = self._download_webpage(url, self._match_id(url))
- video_props = json.loads(re.search(
+ video_props = self._parse_json(self._search_regex(
r'<script\s?id=\"__NEXT_DATA__\"\s?type=\"appl... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.357 | suggestion | 58 | 44 | 45 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570965d58',
'info_dict': {
'id': '548227',
... | ```suggestion
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
video_props = self._parse_json(self._search_regex(
r'<script\s?id=\"__NEXT_DATA__\"\s?type=\"application/json\">({.+})</script>',
webpage, 'video_props'), display_id)['pro... | 'description': 'Сезон 3 Епизод 25'
},
},
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570965d58',
'info_dict': {
'id': '548227',
... | @@ -0,0 +1,62 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_duration, parse_iso8601
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/sea... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.929 | suggestion | 392 | 43 | 44 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
{
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570965d58',
'info_dict': {
'id': '548227',
'ext': 'mp4',
'title': 'Игри на волята: България (20.09.... | ```suggestion
video_id, headers={'x-flipps-user-agent': 'Flipps/75/9.7'})[0]['url']
``` | {
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
'md5': '5fd61b8ecbe582fc021019d570965d58',
'info_dict': {
'id': '548227',
'ext': 'mp4',
'title': 'Игри на волята: България (20.09.... | @@ -0,0 +1,63 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_duration, parse_iso8601
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/sea... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.786 | suggestion | 101 | 41 | 41 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
'alt_title': 'gri-na-volqta/season-3/igri-na-volqta-2021-09-20-1',
'duration': 4060.0,
'timestamp': 1632167564,
'upload_date': '20210920',
'thumbnail': 'https://nbg-img.fite.tv/img/548227_460x260.jpg',
'description': 'Сезон ... | ```suggestion
'alt_title': video_props.get('slug'),
``` | 'alt_title': 'gri-na-volqta/season-3/igri-na-volqta-2021-09-20-1',
'duration': 4060.0,
'timestamp': 1632167564,
'upload_date': '20210920',
'thumbnail': 'https://nbg-img.fite.tv/img/548227_460x260.jpg',
'description': 'Сезон ... | @@ -0,0 +1,63 @@
+# coding: utf-8
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_duration, parse_iso8601
+
+
+class NovaPlayIE(InfoExtractor):
+ _VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
+ _TESTS = [
+ {
+ 'url': 'https://play.nova.bg/video/bratya/sea... | yt_dlp/extractor/novaplay.py | 26 | Python | 0.571 | suggestion | 69 | 34 | 34 | false | [NovaPlay] Add extractor | 1,209 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Bojidarist |
_TESTS = [{
'url': 'https://euscreen.eu/item.html?id=EUS_0EBCBF356BFC4E12A014023BA41BD98C',
'info_dict': {
'id': 'EUS_0EBCBF356BFC4E12A014023BA41BD98C',
'ext': 'mp4',
'title': "L'effondrement du stade du Heysel",
'alt_title': 'Collapse of the Heysel S... | ```suggestion
_payload = b'<fsxml><screen><properties><screenId>-1</screenId></properties><capabilities id="1"><properties><platform>Win32</platform><appcodename>Mozilla</appcodename><appname>Netscape</appname><appversion>5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 S... |
_TESTS = [{
'url': 'https://euscreen.eu/item.html?id=EUS_0EBCBF356BFC4E12A014023BA41BD98C',
'info_dict': {
'id': 'EUS_0EBCBF356BFC4E12A014023BA41BD98C',
'ext': 'mp4',
'title': "L'effondrement du stade du Heysel",
'alt_title': 'Collapse of the Heysel S... | @@ -0,0 +1,56 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+from ..utils import (
+ parse_duration,
+ js_to_json,
+)
+
+
+class EUScreenIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?euscreen\.eu/item.html\?id=(?P<id>[^&?$/]+)'
+
+ _TESTS = ... | yt_dlp/extractor/euscreen.py | 26 | Python | 1 | refactor | 1,664 | 44 | 51 | false | [EUScreen] Add Extractor | 1,219 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
try:
import Crypto # noqa: F401
print('WARNING: Using Crypto since Cryptodome is not available. '
'Install with: pip install pycryptodomex', file=sys.stderr)
return 'Crypto'
except ImportError:
pass
return 'Cryptodome'
dependancies... | How to set version info on the macOS binaries? | try:
import Crypto # noqa: F401
print('WARNING: Using Crypto since Cryptodome is not available. '
'Install with: pip install pycryptodomex', file=sys.stderr)
return 'Crypto'
except ImportError:
pass
return 'Cryptodome'
dependancies... | @@ -99,4 +108,6 @@ def pycryptodome_module():
*opts,
'yt_dlp/__main__.py',
])
-SetVersion('dist/%syt-dlp%s.exe' % ('yt-dlp/' if '--onedir' in opts else '', _x86), VERSION_FILE)
+
+if platform.system() == 'Windows':
+ SetVersion('dist/%syt-dlp%s.exe' % ('yt-dlp/' if '--onedir' in opts else '', _x86), VERSI... | pyinst.py | 26 | Python | 0.071 | question | 46 | 27 | 27 | false | Build mac os packages | 1,221 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | smplayer-dev |
except (IOError, OSError):
return report_permission_error(f'{exe}.new')
expected_sum = get_sha256sum(bin_type, arch)
if not expected_sum:
ydl.report_warning('no hash information found for the release')
elif calc_sha256sum(exe + '.new') != expected_sum:
... | does this mean mac binaries can overwrite itself? If so, an implementation similar to the zip version would be simpler. We go through all these steps on windows since a running executable can't be replaced/deleted | return report_permission_error(f'{exe}.new')
expected_sum = get_sha256sum('exe', arch)
if not expected_sum:
ydl.report_warning('no hash information found for the release')
elif calc_sha256sum(exe + '.new') != expected_sum:
report_network_error('verify the new... | @@ -190,10 +194,14 @@ def get_sha256sum(bin_or_exe, version):
os.rename(exe + '.old', exe)
return
try:
- # Continues to run in the background
- subprocess.Popen(
- 'ping 127.0.0.1 -n 5 -w 1000 & del /F "%s.old"' % exe,
- shell=True, ... | yt_dlp/update.py | 26 | Python | 0.5 | question | 213 | 51 | 51 | false | Build mac os packages | 1,221 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | smplayer-dev |
version_labels = {
'zip_3': '',
'exe_64': '.exe',
'exe_32': '_x86.exe',
'mac_64': '_macos',
}
def get_bin_info(bin_or_exe, version):
label = version_labels['%s_%s' % (bin_or_exe, version)]
return next((i for i in version_info['assets'] if i['name'] == 'yt-dlp... | ```suggestion
variant = detect_variant()
if variant == 'exe':
``` | 'zip_3': '',
'exe_64': '.exe',
'exe_32': '_x86.exe',
'mac_64': '_macos',
}
def get_bin_info(bin_or_exe, version):
label = version_labels['%s_%s' % (bin_or_exe, version)]
return next((i for i in version_info['assets'] if i['name'] == 'yt-dlp%s' % label), {})
... | @@ -144,7 +144,7 @@ def get_sha256sum(bin_or_exe, version):
return report_permission_error(filename)
# PyInstaller
- if hasattr(sys, 'frozen'):
+ if hasattr(sys, 'frozen') and platform.system() == 'Windows': | yt_dlp/update.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | Build mac os packages | 1,221 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | smplayer-dev |
return report_unable('remove corrupt download')
try:
os.rename(exe, exe + '.old')
except (IOError, OSError):
return report_unable('move current version')
try:
os.rename(exe + '.new', exe)
except (IOError, OSError):
report_u... | ```suggestion
elif variant in ('zip', 'mac_bin'):
pack_type = ('mac', '64') if variant == 'mac_bin' else ('zip', '3')
``` | return report_unable('remove corrupt download')
try:
os.rename(exe, exe + '.old')
except (IOError, OSError):
return report_unable('move current version')
try:
os.rename(exe + '.new', exe)
except (IOError, OSError):
report_u... | @@ -199,10 +202,12 @@ def get_sha256sum(bin_or_exe, version):
except OSError:
report_unable('delete the old version')
- # Zip unix package
- elif isinstance(globals().get('__loader__'), zipimporter):
+ # Zip unix or Mac OS binary package
+ elif isinstance(globals().get('__loader__'),... | yt_dlp/update.py | 26 | Python | 0.857 | suggestion | 136 | 51 | 51 | false | Build mac os packages | 1,221 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | smplayer-dev |
video = extract_attributes(video).get('data-config')
if not video:
continue
video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
video_formats = try_get(video, lambda x: x['mc']['_mediaArray'][0]['_mediaStreamArray'])
... | Only format extraction is different. It can be simplified to get rid of duplicate code | continue
video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
video_formats = try_get(video, lambda x: x['mc']['_mediaArray'][0]['_mediaStreamArray'])
if not video_formats:
continue
num += 1
for vi... | @@ -271,34 +103,46 @@ def _real_extract(self, url):
title = self._html_search_regex(
r'<span[^>]*class="headline"[^>]*>(.+?)</span>',
- webpage, 'title', default=None) or self._og_search_title(webpage)
-
- DOWNLOAD_REGEX = r'(?s)<p>Wir bieten dieses (?P<kind>Video|Audio) in fol... | yt_dlp/extractor/tagesschau.py | 26 | Python | 0.286 | refactor | 86 | 46 | 44 | false | [tagesschau] Fix extractor | 1,227 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
if not video:
continue
video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
video_formats = try_get(video, lambda x: x['mc']['_mediaArray'][0]['_mediaStreamArray'])
if not video_formats:
continue
n... | since mp3 urls are added directly to entries, it wont have a formats key | video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
video_formats = try_get(video, lambda x: x['mc']['_mediaArray'][0]['_mediaStreamArray'])
if not video_formats:
continue
num += 1
for video_format in video_forma... | @@ -271,34 +103,46 @@ def _real_extract(self, url):
title = self._html_search_regex(
r'<span[^>]*class="headline"[^>]*>(.+?)</span>',
- webpage, 'title', default=None) or self._og_search_title(webpage)
-
- DOWNLOAD_REGEX = r'(?s)<p>Wir bieten dieses (?P<kind>Video|Audio) in fol... | yt_dlp/extractor/tagesschau.py | 26 | Python | 0.214 | style | 72 | 45 | 43 | false | [tagesschau] Fix extractor | 1,227 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
videos = re.findall(r'<div[^>]+>', webpage)
num = 0
for video in videos:
video = extract_attributes(video).get('data-config')
if not video:
continue
video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
... | ```suggestion
'title': try_get(video, lambda x: x['mc']['_title']),
``` | for video in videos:
video = extract_attributes(video).get('data-config')
if not video:
continue
video = self._parse_json(video, video_id, transform_source=js_to_json, fatal=False)
video_formats = try_get(video, lambda x: x['mc']['_mediaArray'][0][... | @@ -271,34 +103,46 @@ def _real_extract(self, url):
title = self._html_search_regex(
r'<span[^>]*class="headline"[^>]*>(.+?)</span>',
- webpage, 'title', default=None) or self._og_search_title(webpage)
-
- DOWNLOAD_REGEX = r'(?s)<p>Wir bieten dieses (?P<kind>Video|Audio) in fol... | yt_dlp/extractor/tagesschau.py | 26 | Python | 0.571 | suggestion | 93 | 49 | 47 | false | [tagesschau] Fix extractor | 1,227 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
extract_attributes,
try_get,
int_or_none,
)
class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/(?P<path>[^/]+/(?:[^/]+/)*?(?P<id>... | Add one (or all working) tests to the other extractor | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
extract_attributes,
try_get,
int_or_none,
)
class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/(?P<path>[^/]+/(?:[^/]+/)*?(?P<id>... | @@ -5,125 +5,13 @@
from .common import InfoExtractor
from ..utils import (
- determine_ext,
js_to_json,
- parse_iso8601,
- parse_filesize,
+ extract_attributes,
+ try_get,
+ int_or_none,
)
-class TagesschauPlayerIE(InfoExtractor):
- IE_NAME = 'tagesschau:player'
- _VALID_URL = r'ht... | yt_dlp/extractor/tagesschau.py | 17 | Python | 0.286 | refactor | 53 | 42 | 42 | false | [tagesschau] Fix extractor | 1,227 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'author_id': str_or_none(author.get('uid')),
'id': str_or_none(comment.get('commentID')),
'text': content,
'timestamp': int_or_none(comment.get('createdAt')),
'parent': 'root' if parent == 0 else str_or_none(parent),
})
... | ```suggestion
_VALID_URL = r'trovovod:(?P<id>[^\s]+)'
IE_DESC = 'All VODs of a trovo.live channel, "trovovod" keyword'
```
Add similar desc for clips | 'author_id': str_or_none(author.get('uid')),
'id': str_or_none(comment.get('commentID')),
'text': content,
'timestamp': int_or_none(comment.get('createdAt')),
'parent': 'root' if parent == 0 else str_or_none(parent),
})
... | @@ -194,3 +195,69 @@ def _real_extract(self, url):
}
info.update(self._extract_streamer_info(vod_detail_info))
return info
+
+
+class TrovoBatchVodIE(InfoExtractor):
+ _VALID_URL = r'trovovod:(?P<id>[^\s]+)' | yt_dlp/extractor/trovo.py | 26 | Python | 0.714 | suggestion | 161 | 51 | 51 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'view_count': get_count('watch'),
'like_count': get_count('like'),
'comment_count': get_count('comment'),
'comments': comments,
'categories': [category] if category else None,
}
info.update(self._extract_streamer_info(vod_detail_info))
... | line is too long. This is the kind of usage where it makes sense to put the query in a class var | 'view_count': get_count('watch'),
'like_count': get_count('like'),
'comment_count': get_count('comment'),
'comments': comments,
'categories': [category] if category else None,
}
info.update(self._extract_streamer_info(vod_detail_info))
... | @@ -194,3 +195,69 @@ def _real_extract(self, url):
}
info.update(self._extract_streamer_info(vod_detail_info))
return info
+
+
+class TrovoBatchVodIE(InfoExtractor):
+ _VALID_URL = r'trovovod:(?P<id>[^\s]+)'
+
+ _TESTS = [{
+ 'url': 'trovovod:OneTappedYou',
+ 'playlist_min... | yt_dlp/extractor/trovo.py | 26 | Python | 0.214 | refactor | 96 | 51 | 51 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'playlist_mincount': 29,
'info_dict': {
'id': '100719456',
},
}]
def _entries(self, uid):
for page in itertools.count(1):
vod_json = self._download_json('https://gql.trovo.live/', uid, query={
'query': '{getChann... | too much duplicate code. If you move the base_url and query to class variables, both the extractors can share the same code |
def _get_vod_json(self, page, uid):
return self._download_json('https://gql.trovo.live/', uid, query={
'query': self._QUERY % (page, uid)
})['data']['getChannelLtvVideoInfos']
class TrovoChannelClipIE(TrovoChannelBaseIE):
_VALID_URL = r'trovoclip:(?P<id>[^\s]+)'
IE_DESC = 'All... | @@ -194,3 +195,69 @@ def _real_extract(self, url):
}
info.update(self._extract_streamer_info(vod_detail_info))
return info
+
+
+class TrovoBatchVodIE(InfoExtractor):
+ _VALID_URL = r'trovovod:(?P<id>[^\s]+)'
+
+ _TESTS = [{
+ 'url': 'trovovod:OneTappedYou',
+ 'playlist_min... | yt_dlp/extractor/trovo.py | 26 | Python | 0.429 | refactor | 123 | 27 | 27 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'view_count': get_count('watch'),
'like_count': get_count('like'),
'comment_count': get_count('comment'),
'comments': comments,
'categories': [category] if category else None,
}
info.update(self._extract_streamer_info(vod_detail_info))
... | ```suggestion
def _get_vod_json(self, page, uid):
raise NotImplementedError('This method must be implemented by subclasses')
```
for self-documentation | 'view_count': get_count('watch'),
'like_count': get_count('like'),
'comment_count': get_count('comment'),
'comments': comments,
'categories': [category] if category else None,
}
info.update(self._extract_streamer_info(vod_detail_info))
... | @@ -194,3 +195,64 @@ def _real_extract(self, url):
}
info.update(self._extract_streamer_info(vod_detail_info))
return info
+
+
+class TrovoBatchIE(InfoExtractor):
+ def _entries(self, uid):
+ for page in itertools.count(1):
+ vod_json = self._get_vod_json(page, uid)
+ ... | yt_dlp/extractor/trovo.py | 26 | Python | 0.857 | suggestion | 173 | 51 | 51 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
info = {
'id': vid,
'title': title,
'formats': formats,
'thumbnail': vod_info.get('coverUrl'),
'timestamp': int_or_none(vod_info.get('publishTs')),
'duration': int_or_none(vod_info.get('duration')),
'view_count': get_count('wat... | Are you sure this is correct? In the original PR, this was `/clip/` for clips |
info = {
'id': vid,
'title': title,
'formats': formats,
'thumbnail': vod_info.get('coverUrl'),
'timestamp': int_or_none(vod_info.get('publishTs')),
'duration': int_or_none(vod_info.get('duration')),
'view_count': get_count('wat... | @@ -194,3 +195,64 @@ def _real_extract(self, url):
}
info.update(self._extract_streamer_info(vod_detail_info))
return info
+
+
+class TrovoBatchIE(InfoExtractor):
+ def _entries(self, uid):
+ for page in itertools.count(1):
+ vod_json = self._get_vod_json(page, uid)
+ ... | yt_dlp/extractor/trovo.py | 26 | Python | 0.357 | suggestion | 77 | 51 | 51 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
from .tmz import TMZIE
from .tnaflix import (
TNAFlixNetworkEmbedIE,
TNAFlixIE,
EMPFlixIE,
MovieFapIE,
)
from .toggle import (
ToggleIE,
MeWatchIE,
)
from .tokentube import (
TokentubeIE,
TokentubeChannelIE
)
from .tonline import TOnlineIE
from .toongoggles import ToonGogglesIE
from .tou... | Better names would be
```
TrovoChannelBaseIE
TrovoChannelVodsIE
TrovoChannelClipsIE
``` | from .tmz import TMZIE
from .tnaflix import (
TNAFlixNetworkEmbedIE,
TNAFlixIE,
EMPFlixIE,
MovieFapIE,
)
from .toggle import (
ToggleIE,
MeWatchIE,
)
from .tokentube import (
TokentubeIE,
TokentubeChannelIE
)
from .tonline import TOnlineIE
from .toongoggles import ToonGogglesIE
from .tou... | @@ -1470,6 +1470,8 @@
from .trovo import (
TrovoIE,
TrovoVodIE,
+ TrovoBatchVodIE,
+ TrovoBatchClipIE, | yt_dlp/extractor/extractors.py | 26 | Python | 0.643 | suggestion | 93 | 51 | 51 | false | Add TrovoBatchClipIE and TrovoBatchVodIE. | 1,246 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
dn = os.path.dirname(path)
if dn and not os.path.exists(dn):
os.makedirs(dn)
return True
except (OSError, IOError) as err:
if callable(to_screen) is not None:
to_screen('unable to create directory ' + error_to_compat_str(err))
return False
def get_ex... | since we are doing this anyway, can we get rid of the need for an init file? That would make plugins just a drop in | dn = os.path.dirname(path)
if dn and not os.path.exists(dn):
os.makedirs(dn)
return True
except (OSError, IOError) as err:
if callable(to_screen) is not None:
to_screen('unable to create directory ' + error_to_compat_str(err))
return False
def get_ex... | @@ -6310,7 +6310,11 @@ def get_executable_path():
def load_plugins(name, suffix, namespace):
classes = {}
try:
- plugins = importlib.import_module(name, package='ytdlp_plugins')
+ plugins_spec = importlib.util.spec_from_file_location(
+ name, os.path.join(get_executable_path(), 'ytdl... | yt_dlp/utils.py | 26 | Python | 0.357 | nitpick | 115 | 51 | 51 | false | Fix use of deprecated imp module | 1,277 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
return mobj.group('link')
def _login(self):
username, password = self._get_login_info()
login_webpage = self._download_webpage(
'https://www.instagram.com/accounts/login/', None,
note='Downloading login webpage', errnote='Failed to download login webpage')
... | confirm these are actually needed | return mobj.group('link')
def _login(self):
username, password = self._get_login_info()
login_webpage = self._download_webpage(
'https://www.instagram.com/accounts/login/', None,
note='Downloading login webpage', errnote='Failed to download login webpage')
... | @@ -140,6 +143,48 @@ def _extract_embed_url(webpage):
if mobj:
return mobj.group('link')
+ def _login(self):
+ username, password = self._get_login_info()
+
+ login_webpage = self._download_webpage(
+ 'https://www.instagram.com/accounts/login/', None,
+ not... | yt_dlp/extractor/instagram.py | 26 | Python | 0.071 | suggestion | 33 | 51 | 51 | false | [Instagram] Add login | 1,288 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
},
'skip': 'Live might have ended',
}
# It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the future.
# There are two URLs, some livestreams are in one, and some
# in the other. The JSON schema is the same for both.
_API_... | Suggestion for L406-L422 (github wont let me comment on unedited lines)
```py
for api_url in self._API_URLS:
video_info = next((
stream for stream in self._download_json(api_url, video_id)['entries']
if stream.get('guid') == video_id), None)
if video... | },
'skip': 'Live might have ended',
}
# It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the future.
# There are two URLs, some livestreams are in one, and some
# in the other. The JSON schema is the same for both.
_API_... | @@ -396,17 +396,26 @@ class CBCGemLiveIE(InfoExtractor):
# It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the future.
- _API = 'https://tpfeed.cbc.ca/f/ExhSPC/t_t3UKJR6MAT'
+ # There are two URLs, some livestreams are in one, and some
+ #... | yt_dlp/extractor/cbc.py | 26 | Python | 1 | refactor | 491 | 43 | 34 | false | CBC Gem: Fix livestream download | 1,289 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
})
thumbnail = None
tn_uri = season_info.get('image')
# the-national was observed to use a "data:image/png;base64"
# URI for their 'image' value. The image was 1x1, and is
# probably just a placeholder, so it is ignored.
if tn_uri is not None and not tn_uri.s... | ```suggestion
_VALID_URL = r'https?://gem\.cbc\.ca/live/(?P<id>\d+)'
```
Also, add a test for where the old valid_url dont match | })
thumbnail = None
tn_uri = season_info.get('image')
# the-national was observed to use a "data:image/png;base64"
# URI for their 'image' value. The image was 1x1, and is
# probably just a placeholder, so it is ignored.
if tn_uri is not None and not tn_uri.s... | @@ -377,7 +377,7 @@ def _real_extract(self, url):
class CBCGemLiveIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca:live'
- _VALID_URL = r'https?://gem\.cbc\.ca/live/(?P<id>[0-9]{12})'
+ _VALID_URL = r'https?://gem\.cbc\.ca/live/(?P<id>[0-9]*)' | yt_dlp/extractor/cbc.py | 26 | Python | 0.714 | suggestion | 137 | 51 | 51 | false | CBC Gem: Fix livestream download | 1,289 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'info_dict': {
'id': 'schitts-creek/s01e01',
'ext': 'mp4',
'title': 'The Cup Runneth Over',
'description': 'md5:9bca14ea49ab808097530eb05a29e797',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/episode/perso/cbc_schitts_creek_season_01e01_th... | dont add a var for URLs that are only used once | 'info_dict': {
'id': 'schitts-creek/s01e01',
'ext': 'mp4',
'title': 'The Cup Runneth Over',
'description': 'md5:9bca14ea49ab808097530eb05a29e797',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/episode/perso/cbc_schitts_creek_season_01e01_th... | @@ -244,37 +247,98 @@ class CBCGemIE(InfoExtractor):
'params': {'format': 'bv'},
'skip': 'Geo-restricted to Canada',
}]
+
_API_BASE = 'https://services.radio-canada.ca/ott/cbc-api/v2/assets/'
+ _GEO_COUNTRIES = ['CA']
+ _LOGIN_URL = 'https://api.loginradius.com/identity/v2/auth/login'
... | yt_dlp/extractor/cbc.py | 26 | Python | 0.143 | suggestion | 47 | 51 | 51 | false | CBC Gem: Support member content | 1,294 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
self._downloader.cache.store(self._NETRC_MACHINE, 'claims_token', self._claims_token)
return self._claims_token
def _real_initialize(self):
if self.claims_token_valid():
return
self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token')
... | ```suggestion
self.raise_login_required(method='password')
``` | return self._claims_token
def _real_initialize(self):
if self.claims_token_valid():
return
self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token')
def _real_extract(self, url):
video_id = self._match_id(url)
video_info = self._d... | @@ -244,37 +247,98 @@ class CBCGemIE(InfoExtractor):
'params': {'format': 'bv'},
'skip': 'Geo-restricted to Canada',
}]
+
_API_BASE = 'https://services.radio-canada.ca/ott/cbc-api/v2/assets/'
+ _GEO_COUNTRIES = ['CA']
+ _LOGIN_URL = 'https://api.loginradius.com/identity/v2/auth/login'
... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | CBC Gem: Support member content | 1,294 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
import copy
import heapq
import os
from copy import deepcopy
from .common import PostProcessor
from .ffmpeg import (
FFmpegPostProcessor,
FFmpegSubtitlesConvertorPP
)
from .sponsorblock import SponsorBlockPP
from ..utils import (
orderedSet,
PostProcessingError,
prepend_extension,
)
_TINY_CHAPTER... | ```suggestion
```
we already import copy | import copy
import heapq
import os
from .common import PostProcessor
from .ffmpeg import (
FFmpegPostProcessor,
FFmpegSubtitlesConvertorPP
)
from .sponsorblock import SponsorBlockPP
from ..utils import (
orderedSet,
PostProcessingError,
prepend_extension,
)
_TINY_CHAPTER_DURATION = 1
DEFAULT_SPON... | @@ -1,6 +1,7 @@
import copy
import heapq
import os
+from copy import deepcopy | yt_dlp/postprocessor/modify_chapters.py | 4 | Python | 0.429 | suggestion | 42 | 29 | 29 | false | Preserve sponsorblock_chapters when downloading multiple formats of the same video | 1,322 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nihil-admirari |
from ..utils import (
orderedSet,
PostProcessingError,
prepend_extension,
)
_TINY_CHAPTER_DURATION = 1
DEFAULT_SPONSORBLOCK_CHAPTER_TITLE = '[SponsorBlock]: %(category_names)l'
class ModifyChaptersPP(FFmpegPostProcessor):
def __init__(self, downloader, remove_chapters_patterns=None, remove_sponsor_s... | ```suggestion
# original chapters must be preserved when downloading multiple formats of the same video
chapters, sponsor_chapters = self._mark_chapters_to_remove(
copy.deepcopy(info.get('chapters')) or [], copy.deepcopy(info.get('sponsorblock_chapters')) or [])
``` | orderedSet,
PostProcessingError,
prepend_extension,
)
_TINY_CHAPTER_DURATION = 1
DEFAULT_SPONSORBLOCK_CHAPTER_TITLE = '[SponsorBlock]: %(category_names)l'
class ModifyChaptersPP(FFmpegPostProcessor):
def __init__(self, downloader, remove_chapters_patterns=None, remove_sponsor_segments=None,
... | @@ -30,8 +31,10 @@ def __init__(self, downloader, remove_chapters_patterns=None, remove_sponsor_seg
@PostProcessor._restrict_to(images=False)
def run(self, info):
+ # sponsorblock_chapters must be preserved intact
+ # when downloading multiple formats of the same video.
chapters, spon... | yt_dlp/postprocessor/modify_chapters.py | 26 | Python | 0.857 | suggestion | 298 | 51 | 51 | false | Preserve sponsorblock_chapters when downloading multiple formats of the same video | 1,322 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nihil-admirari |
count = 0
for count, entry in enumerate(extract_thread(continuation_renderer.get('contents') or {})):
yield entry
continuation = self._extract_continuation(continuation_renderer)
if count == 0:
... | ```suggestion
renderer = next(filter(
lambda x: x.get('sectionIdentifier') == 'comment-item-section',
traverse_obj(contents, (..., 'itemSectionRenderer'), default={})), None)
```
or, maybe just this since there isn't much point in using filter if u have to make a lambda
... | count = 0
for count, entry in enumerate(extract_thread(continuation_renderer.get('contents') or {})):
yield entry
continuation = self._extract_continuation(continuation_renderer)
if count == 0:
... | @@ -2416,8 +2420,9 @@ def _generate_comment_continuation(video_id):
def _get_comments(self, ytcfg, video_id, contents, webpage):
"""Entry for comment extraction"""
def _real_comment_extract(contents):
- yield from self._comment_entries(
- traverse_obj(contents, (..., 'it... | yt_dlp/extractor/youtube.py | 26 | Python | 0.786 | suggestion | 553 | 51 | 51 | false | [youtube:comments] Fix comment section not being extracted in new layouts | 1,324 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
self.raise_geo_restricted(countries=[country])
raise
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
self._sort_formats(formats)
episode = program.get('episode') or {}
return {
'id': guid,
'title... | ```suggestion
play\.(?:tv3|skaties)\.(?P<country>lv|lt|ee)/
``` | self.raise_geo_restricted(countries=[country])
raise
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
self._sort_formats(formats)
episode = program.get('episode') or {}
return {
'id': guid,
'title... | @@ -431,77 +431,96 @@ def _real_extract(self, url):
class TVPlayHomeIE(InfoExtractor):
- _VALID_URL = r'https?://(?:tv3?)?play\.(?:tv3\.lt|skaties\.lv|tv3\.ee)/(?:[^/]+/)*[^/?#&]+-(?P<id>\d+)'
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:tv3?)?
+ play\.(?:tv3|skaties).(?P<country... | yt_dlp/extractor/tvplay.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [Tvplayhome][tvplay] extractor updates | 1,357 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | 18928172992817182 |
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
self._sort_formats(formats)
episode = program.get('episode') or {}
return {
'id': guid,
'title': title,
'thumbnail': meta.get('image'),
'description': ... | ```suggestion
[^?#&]+(?:episode|programme|clip)-(?P<id>\d+)
``` |
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
self._sort_formats(formats)
episode = program.get('episode') or {}
return {
'id': guid,
'title': title,
'thumbnail': meta.get('image'),
'description': ... | @@ -431,77 +431,96 @@ def _real_extract(self, url):
class TVPlayHomeIE(InfoExtractor):
- _VALID_URL = r'https?://(?:tv3?)?play\.(?:tv3\.lt|skaties\.lv|tv3\.ee)/(?:[^/]+/)*[^/?#&]+-(?P<id>\d+)'
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:tv3?)?
+ play\.(?:tv3|skaties).(?P<country... | yt_dlp/extractor/tvplay.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [Tvplayhome][tvplay] extractor updates | 1,357 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | 18928172992817182 |
media_urls.add(media_url)
entries.append({
'id': compat_str(media['id']),
'url': media_url,
'title': compat_urllib_parse_unquote(media['desc']),
'duration': int_or_none(media.get('length')),
'vcodec': 'none' if media... | use `self._proto_relative_url` |
def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
content = self._search_regex(
r'(?s)<div[^>]+class="\s*this-article\s*"[^>]*>(.+?)<div[^>]+class="tags"[^>]*>',
webpage, 'content', default=None)
... | @@ -94,39 +122,34 @@ def _real_extract(self, url):
content = self._search_regex(
r'(?s)<div[^>]+class="\s*this-article\s*"[^>]*>(.+?)<div[^>]+class="tags"[^>]*>',
- webpage, 'content')
+ webpage, 'content', default=None)
timestamp = unified_timestamp(self._html_s... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.286 | suggestion | 30 | 51 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_unquote,
compat_urlparse
)
from ..utils import (
extract_attributes,
int_or_none,
strip_or_none,
unified_timestamp,
... | these should be adapted into `js_to_json` if possible |
_TESTS = [{
'url': 'https://player.polskieradio.pl/anteny/trojka',
'info_dict': {
'id': '3',
'ext': 'm4a',
'title': 'Trójka',
},
'params': {
'format': 'bestaudio',
'skip_download': 'endless stream',
},
}]
d... | @@ -207,3 +230,225 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(url, webpage, category_id),
category_id, title)
+
+
+class PolskieRadioPlayerIE(InfoExtractor):
+ IE_NAME = 'polskieradio:player'
+ _VALID_URL = r'https?://player\.polskieradio\.pl/ant... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.429 | suggestion | 53 | 210 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
})
part_of_series = e.get('partOfSeries') or e.get('partOfTVSeries')
if isinstance(part_of_series, dict) and part_of_series.get('@type') in ('TVSeries', 'Series', 'CreativeWorkSeries'):
info['series'] = unescapeHTML(part_of_series.g... | ```suggestion
r'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)</script>',
```
This is the most general form and will allow me to use this function for other extractors | })
part_of_series = e.get('partOfSeries') or e.get('partOfTVSeries')
if isinstance(part_of_series, dict) and part_of_series.get('@type') in ('TVSeries', 'Series', 'CreativeWorkSeries'):
info['series'] = unescapeHTML(part_of_series.g... | @@ -1485,6 +1485,13 @@ def extract_video_object(e):
break
return dict((k, v) for k, v in info.items() if v is not None)
+ def _search_nextjs_data(self, webpage, video_id, **kw):
+ return self._parse_json(
+ self._search_regex(
+ r'<script id="__NEXT_DA... | yt_dlp/extractor/common.py | 26 | Python | 0.786 | refactor | 195 | 51 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
'url': 'http://www.polskieradio.pl/7/5102/Artykul/1587943,Prof-Andrzej-Nowak-o-historii-nie-da-sie-myslec-beznamietnie',
'info_dict': {
'id': '1587943',
'title': 'Prof. Andrzej Nowak: o historii nie da się myśleć beznamiętnie',
'description': 'md5:12f954edbf3120c5e707... | `yield entry` here. Don't init and append | url_or_none,
)
class PolskieRadioBaseExtractor(InfoExtractor):
def _extract_webpage_player_entries(self, webpage, playlist_id, base_data):
media_urls = set()
for data_media in re.findall(r'<[^>]+data-media="?({[^>]+})"?', webpage):
media = self._parse_json(data_media, playlist_id,... | @@ -12,15 +13,47 @@
)
from ..utils import (
extract_attributes,
+ ExtractorError,
int_or_none,
+ parse_iso8601,
strip_or_none,
unified_timestamp,
unescapeHTML,
+ url_or_none,
)
-class PolskieRadioIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?polskieradio\.pl/\d+/\d+/... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.214 | nitpick | 41 | 51 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
compat_urlparse
)
from ..utils import (
extract_attributes,
int_or_none,
strip_or_none,
unified_timestamp,
unescapeHTML,
)
class PolskieRadioIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?polskieradio\.pl/\d+/\d+/Artykul/(?P<id>[0-9]+)'
_TESTS = [{ # Old-style single broadcast.
... | any reason to explicitly give http here rather than the default https? | compat_str,
compat_urllib_parse_unquote,
compat_urlparse
)
from ..utils import (
extract_attributes,
ExtractorError,
InAdvancePagedList,
int_or_none,
js_to_json,
parse_iso8601,
strip_or_none,
unified_timestamp,
unescapeHTML,
url_or_none,
)
class PolskieRadioBaseExtr... | @@ -12,15 +13,47 @@
)
from ..utils import (
extract_attributes,
+ ExtractorError,
int_or_none,
+ parse_iso8601,
strip_or_none,
unified_timestamp,
unescapeHTML,
+ url_or_none,
)
-class PolskieRadioIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?polskieradio\.pl/\d+/\d+/... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.214 | question | 70 | 51 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_unquote,
compat_urlparse
)
from ..utils import (
extract_attributes,
int_or_none,
strip_or_none,
unified_timestamp,
... | ```suggestion
channel = next((c for c in channel_list if c.get('url') == channel_url), None)
``` | }]
def _get_channel_list(self, channel_url='no_channel'):
player_code = self._download_webpage(
self._PLAYER_URL, channel_url,
note='Downloading js player')
channel_list = js_to_json(self._search_regex(
r';var r="anteny",a=(\[.+?\])},', player_code, 'channel ... | @@ -207,3 +230,225 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(url, webpage, category_id),
category_id, title)
+
+
+class PolskieRadioPlayerIE(InfoExtractor):
+ IE_NAME = 'polskieradio:player'
+ _VALID_URL = r'https?://player\.polskieradio\.pl/ant... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.714 | suggestion | 106 | 210 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_unquote,
compat_urlparse
)
from ..utils import (
extract_attributes,
int_or_none,
strip_or_none,
unified_timestamp,
... | same as above, explain the preference |
station_list = self._download_json(self._STATIONS_API_URL, channel_url,
note='Downloading stream url list',
headers={
'Accept': 'application/json',
... | @@ -207,3 +230,225 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(url, webpage, category_id),
category_id, title)
+
+
+class PolskieRadioPlayerIE(InfoExtractor):
+ IE_NAME = 'polskieradio:player'
+ _VALID_URL = r'https?://player\.polskieradio\.pl/ant... | yt_dlp/extractor/polskieradio.py | 26 | Python | 0.143 | suggestion | 37 | 210 | 51 | false | haruhi-dl backporting, batch 1 | 1,386 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
class ThreeSpeakIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?3speak\.tv/watch\?v\=[^/]+/(?P<id>[^/$&#?]+)'
_TESTS = [{
'url': 'https://3speak.tv/watch?v=dannyshine/wjgoxyfy',
'info_dict': {
'id': 'wjgoxyfy',
'ext': 'mp4',
'title': 'Can People who ... | ```suggestion
# The json string itself is escaped. Hence the double parsing
data_json = self._parse_json(self._parse_json(f'"{json_str}"', id), id)
``` | class ThreeSpeakIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?3speak\.tv/watch\?v\=[^/]+/(?P<id>[^/$&#?]+)'
_TESTS = [{
'url': 'https://3speak.tv/watch?v=dannyshine/wjgoxyfy',
'info_dict': {
'id': 'wjgoxyfy',
'ext': 'mp4',
'title': 'Can People who ... | @@ -0,0 +1,96 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ try_get,
+ unified_strdate,
+)
+
+
+class ThreeSpeakIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?3speak\.tv/watch\?v\=[^/]+/(?P<id>[^/$&#?]+)'
+
+ ... | yt_dlp/extractor/threespeak.py | 26 | Python | 0.714 | security | 170 | 51 | 51 | false | [3speak] Add extractors | 1,430 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'id': 'wjgoxyfy',
'ext': 'mp4',
'title': 'Can People who took the Vax think Critically',
'uploader': 'dannyshine',
'description': 'md5:181aa7ccb304afafa089b5af3bca7a10',
'tags': ['sex', 'covid', 'antinatalism', 'comedy', 'vaccines'],
't... | ```suggestion
if og_m3u8:
https_frmts, https_subs = self._extract_m3u8_formats_and_subtitles(og_m3u8, id, fatal=False, m3u8_id='https')
formats.extend(https_frmts)
subtitles = self._merge_subtitles(subtitles, https_subs)
``` | 'id': 'wjgoxyfy',
'ext': 'mp4',
'title': 'Can People who took the Vax think Critically',
'uploader': 'dannyshine',
'description': 'md5:181aa7ccb304afafa089b5af3bca7a10',
'tags': ['sex', 'covid', 'antinatalism', 'comedy', 'vaccines'],
't... | @@ -0,0 +1,96 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ try_get,
+ unified_strdate,
+)
+
+
+class ThreeSpeakIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?3speak\.tv/watch\?v\=[^/]+/(?P<id>[^/$&#?]+)'
+
+ ... | yt_dlp/extractor/threespeak.py | 26 | Python | 0.857 | refactor | 273 | 51 | 51 | false | [3speak] Add extractors | 1,430 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'thumbnail': 'https://img.3speakcontent.co/wjgoxyfy/thumbnails/default.png',
'upload_date': '20211021',
'duration': 2703.867833,
'filesize': 1620054781,
},
'params': {'skip_download': True}
}]
def _real_extract(self, url):
id = self._match... | ```suggestion
if ipfs_m3u8:
ipfs_frmts, ipfs_subs = self._extract_m3u8_formats_and_subtitles(f'https://ipfs.3speak.tv/ipfs/{ipfs_m3u8}',
id, fatal=False, m3u8_id='ipfs')
formats.extend(ipfs_frmts)
... | 'thumbnail': 'https://img.3speakcontent.co/wjgoxyfy/thumbnails/default.png',
'upload_date': '20211021',
'duration': 2703.867833,
'filesize': 1620054781,
},
'params': {'skip_download': True}
}]
def _real_extract(self, url):
id = self._match... | @@ -0,0 +1,96 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ try_get,
+ unified_strdate,
+)
+
+
+class ThreeSpeakIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?3speak\.tv/watch\?v\=[^/]+/(?P<id>[^/$&#?]+)'
+
+ ... | yt_dlp/extractor/threespeak.py | 26 | Python | 0.857 | refactor | 383 | 51 | 51 | false | [3speak] Add extractors | 1,430 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
from __future__ import unicode_literals
import os
import re
from .common import InfoExtractor, compat_urllib_parse_unquote
from ..utils import (
HEADRequest,
sanitized_Request,
unified_timestamp,
url_basename,
)
class BreitBartIE(InfoExtractor):
_VALID_URL = r"https?:\/\/(?:www\.)breitbart.com/v... | ```suggestion
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
```
1. Use single quotes everywhere
2. By defining an `id` group in the URL, u can just use `_match_id`
3. Add `_TESTS` | from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | @@ -0,0 +1,79 @@
+from __future__ import unicode_literals
+
+import os
+import re
+
+from .common import InfoExtractor, compat_urllib_parse_unquote
+from ..utils import (
+ HEADRequest,
+ sanitized_Request,
+ unified_timestamp,
+ url_basename,
+)
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"ht... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.857 | suggestion | 217 | 51 | 40 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
)
class BreitBartIE(InfoExtractor):
_VALID_URL = r"https?:\/\/(?:www\.)breitbart.com/videos/v/(.*?)/"
@classmethod
def _get_video_id(cls, url):
if '_VALID_URL_RE' not in cls.__dict__:
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
if cls._VALID_URL_RE.match(url) is not None:
... | ```suggestion
video_id = self._match_id(url)
``` | 'id': '5cOz1yup',
'ext': 'mp4',
'title': 'Watch \u2013 Clyburn: Statues in Congress Have to Go Because they Are Honoring Slavery',
'description': 'md5:bac35eb0256d1cb17f517f54c79404d5',
'thumbnail': 'https://cdn.jwplayer.com/thumbs/5cOz1yup-1920.jpg',
... | @@ -0,0 +1,79 @@
+from __future__ import unicode_literals
+
+import os
+import re
+
+from .common import InfoExtractor, compat_urllib_parse_unquote
+from ..utils import (
+ HEADRequest,
+ sanitized_Request,
+ unified_timestamp,
+ url_basename,
+)
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"ht... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.571 | suggestion | 58 | 51 | 29 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
if cls._VALID_URL_RE.match(url) is not None:
return cls._VALID_URL_RE.match(url).group(1)
else:
return ""
def _generic_id(self, url):
return compat_urllib_parse_unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
def _generic_title(self, url):
... | don't use generic title. get title from webpage | from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | @@ -0,0 +1,79 @@
+from __future__ import unicode_literals
+
+import os
+import re
+
+from .common import InfoExtractor, compat_urllib_parse_unquote
+from ..utils import (
+ HEADRequest,
+ sanitized_Request,
+ unified_timestamp,
+ url_basename,
+)
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"ht... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.143 | suggestion | 47 | 51 | 40 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
return compat_urllib_parse_unquote(os.path.splitext(url_basename(url))[0])
def _real_extract(self, url):
video_id = self._get_video_id(url)
if not video_id:
return {}
head_req = HEADRequest(url)
head_response = self._request_webpage(
head_req, video_... | why? It should just be:
```suggestion
webpage = self._download_webpage(url, video_id)
``` | from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | @@ -0,0 +1,79 @@
+from __future__ import unicode_literals
+
+import os
+import re
+
+from .common import InfoExtractor, compat_urllib_parse_unquote
+from ..utils import (
+ HEADRequest,
+ sanitized_Request,
+ unified_timestamp,
+ url_basename,
+)
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"ht... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.786 | question | 100 | 49 | 40 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
full_response = self._request_webpage(request, video_id)
first_bytes = full_response.read(512)
webpage = self._webpage_read_content(
full_response, url, video_id, prefix=first_bytes)
video_title = self._og_search_title(
webpage, default=None) or self._html_search... | ```suggestion
formats = self._extract_m3u8_formats(f'https://cdn.jwplayer.com/manifests/{video_id}.m3u8', video_id, ext='mp4')
self._sort_formats(formats)
``` | from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | @@ -0,0 +1,79 @@
+from __future__ import unicode_literals
+
+import os
+import re
+
+from .common import InfoExtractor, compat_urllib_parse_unquote
+from ..utils import (
+ HEADRequest,
+ sanitized_Request,
+ unified_timestamp,
+ url_basename,
+)
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"ht... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.786 | refactor | 177 | 28 | 40 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
'url': 'https://www.breitbart.com/videos/v/eaiZjVOn/'
},
{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji'
}
]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
... | ```suggestion
formats = self._extract_m3u8_formats(f'https://cdn.jwplayer.com/manifests/{video_id}.m3u8', video_id, ext='mp4')
self._sort_formats(formats)
return {
'id': video_id,
'title': self._og_search_title(
webpage, default=None) or self._html_s... | 'md5': '0aa6d1d6e183ac5ca09207fe49f17ade',
'info_dict': {
'id': '5cOz1yup',
'ext': 'mp4',
'title': 'Watch \u2013 Clyburn: Statues in Congress Have to Go Because they Are Honoring Slavery',
'description': 'md5:bac35eb0256d1cb17f517f54c79404d5',
... | @@ -0,0 +1,35 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)"
+ _TESTS = [
+ {
+ 'url': 'https://www.breitbart.com/videos/v/eaiZjVOn/'
+ },
+ ... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.857 | refactor | 675 | 27 | 31 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
class BreitBartIE(InfoExtractor):
_VALID_URL = r"https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)"
_TESTS = [
{
'url': 'https://www.breitbart.com/videos/v/eaiZjVOn/'
},
{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji'
}
]
... | ```suggestion
'thumbnail': self._og_search_thumbnail(webpage),
``` | class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe49f17ade',
'info_dict': {
'id': '5cOz1yup',
'e... | @@ -0,0 +1,33 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r"https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)"
+ _TESTS = [
+ {
+ 'url': 'https://www.breitbart.com/videos/v/eaiZjVOn/'
+ },
+ ... | yt_dlp/extractor/breitbart.py | 26 | Python | 0.571 | suggestion | 80 | 29 | 35 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | description is too long. use `md5:` | from __future__ import unicode_literals
from .common import InfoExtractor
class BreitBartIE(InfoExtractor):
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
'md5': '0aa6d1d6e183ac5ca09207fe4... | @@ -0,0 +1,39 @@
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class BreitBartIE(InfoExtractor):
+ _VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
+ 'md5':... | yt_dlp/extractor/breitbart.py | 15 | Python | 0.286 | refactor | 35 | 40 | 40 | false | [extractor/breitbart] Breitbart.com website support | 1,434 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
qs = compat_parse_qs(self._match_valid_url(url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'):
raise ExtractorError('Invalid URL', expected=True)
video_id = re.sub(r'.mp4$', '', qs['filename'][0])
webpage = self._download_webpage(url, v... | this is wrong and I don't understand what you intended here | qs = compat_parse_qs(self._match_valid_url(url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'):
raise ExtractorError('Invalid URL', expected=True)
video_id = re.sub(r'.mp4$', '', qs['filename'][0])
webpage = self._download_webpage(url, vi... | @@ -0,0 +1,215 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..compat import (
+ compat_parse_qs,
+ compat_urlparse,
+)
+from ..utils import (
+ ExtractorError,
+ determine_ext,
+ parse_qs,
+ unsmuggle_url,
+)
+
+_COMMITTEES = {
+ ... | yt_dlp/extractor/senategov.py | 26 | Python | 0.214 | bug | 59 | 51 | 51 | false | Senate.gov website downloading fixes | 1,435 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
qs = compat_parse_qs(self._match_valid_url(url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'):
raise ExtractorError('Invalid URL', expected=True)
video_id = re.sub(r'.mp4$', '', qs['filename'][0])
webpage = self._download_webpage(url, vi... | ```suggestion
formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4', m3u8_id='m3u8')
``` | qs = compat_parse_qs(self._match_valid_url(url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'):
raise ExtractorError('Invalid URL', expected=True)
video_id = re.sub(r'.mp4$', '', qs['filename'][0])
webpage = self._download_webpage(url, vi... | @@ -0,0 +1,214 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..compat import (
+ compat_parse_qs,
+ compat_urlparse,
+)
+from ..utils import (
+ ExtractorError,
+ parse_qs,
+ unsmuggle_url,
+)
+
+_COMMITTEES = {
+ 'ag': ('76440', '... | yt_dlp/extractor/senategov.py | 26 | Python | 0.786 | refactor | 115 | 51 | 51 | false | Senate.gov website downloading fixes | 1,435 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grabien |
class SkyNewsStoryIE(SkyBaseIE):
IE_NAME = 'sky:news:story'
_VALID_URL = r'https?://news\.sky\.com/story/[0-9a-z-]+-(?P<id>[0-9]+)'
_TEST = {
'url': 'https://news.sky.com/story/budget-2021-chancellor-rishi-sunak-vows-address-will-deliver-strong-economy-fit-for-a-new-age-of-optimism-12445425',
... | ```suggestion
entries = [self._process_ooyala_element(webpage, sdc_el, url)
for sdc_el in re.findall(self._SDC_EL_REGEX, webpage)]
``` |
class SkyNewsStoryIE(SkyBaseIE):
IE_NAME = 'sky:news:story'
_VALID_URL = r'https?://news\.sky\.com/story/[0-9a-z-]+-(?P<id>[0-9]+)'
_TEST = {
'url': 'https://news.sky.com/story/budget-2021-chancellor-rishi-sunak-vows-address-will-deliver-strong-economy-fit-for-a-new-age-of-optimism-12445425',
... | @@ -105,6 +105,35 @@ class SkyNewsIE(SkyBaseIE):
}
+class SkyNewsStoryIE(SkyBaseIE):
+ IE_NAME = 'sky:news:story'
+ _VALID_URL = r'https?://news\.sky\.com/story/[0-9a-z-]+-(?P<id>[0-9]+)'
+ _TEST = {
+ 'url': 'https://news.sky.com/story/budget-2021-chancellor-rishi-sunak-vows-address-will-deliv... | yt_dlp/extractor/sky.py | 26 | Python | 0.714 | suggestion | 166 | 51 | 51 | false | [sky] Add extractor for Sky News articles | 1,443 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ajj8 |
'url': 'https://www.mlssoccer.com/video/the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986#the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986',
'info_dict': {
'id': '6276033198001',
'ext': 'mp4',
'title': 'The Octagon | Ca... | why transparent? You are not adding any other fields. Use `self.url_result` | _TESTS = [{
'url': 'https://www.mlssoccer.com/video/the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986#the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986',
'info_dict': {
'id': '6276033198001',
'ext': 'mp4',
'title': '... | @@ -0,0 +1,39 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class MLSSoccerIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?mlssoccer\.com/video/[^#]+#(?P<id>[^/&$#?]+)'
+
+ _TESTS = [{
+ 'url': 'https://www.mlssoccer.com/video/the-octagon-... | yt_dlp/extractor/mlssoccer.py | 26 | Python | 0.429 | question | 75 | 30 | 51 | false | [MLSScoccer] Add extractor | 1,452 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
json_map = try_get(self._parse_json(self._html_search_regex(
'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[^>]*>([^<]+)</script>', webpage, 'json_map'), playlist_id),
... | use guard
```suggestion
if not any(video['data'].get(attr) == 'Brightcove' for attr in ('name', 'type')):
continue
video_id = video['data']['id']
account_id = video['data']['accountId']
player_id = video['data']['playerId']
entries.appen... |
def _real_extract(self, url):
playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id)
json_map = try_get(self._parse_json(self._html_search_regex(
'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[^>]*>([^<]+)</script>', webpage, 'json_map'), playlist_id),
... | @@ -240,24 +247,22 @@ def _real_extract(self, url):
'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[^>]*>([^<]+)</script>', webpage, 'json_map'), playlist_id),
lambda x: x['props']['pageProps']['article']['body']['content']) or []
- # Discard empty objects
- video_ids = []
+ entr... | yt_dlp/extractor/itv.py | 26 | Python | 1 | suggestion | 707 | 31 | 32 | false | [itv] Merged ITVBTCCIE into new ITVNewsIE extractor | 1,456 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | ajj8 |
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 7,
}]
_HOST = 'https://www.mediasetplay.mediaset.it'
_FEED_URL = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/'
_BY_SUBBRAND = _FEED_URL + 'mediaset-prod-all-programs-v2?byCustomValue={subBrand... | use a generator or even better a `OnDemandPagedList` | # TV Show specific playlist (single page)
'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST000000002738,sb100013107',
'info_dict': {
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# T... | @@ -212,3 +213,94 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.429 | suggestion | 52 | 51 | 47 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
sb = self._match_valid_url(url).group('sb')
if not sb:
pl = []
page = self._download_webpage(url, playlist_id)
for u in re.findall(
r'href="([^<>=]+SE\d{12},ST\d{12},sb\d{9})">[^<]+<',
page):
if not u.startswith... | ```suggestion
playlist_id, st, sb = self._match_valid_url(url).group('id', 'st', 'sb')
if not sb:
page = self._download_webpage(url, playlist_id)
entries = [self.url_result(urljoin('https://www.mediasetplay.mediaset.it', url))
for url in re.findall(r'href="([... | # coding: utf-8
from __future__ import unicode_literals
import functools
import re
from .theplatform import ThePlatformBaseIE
from ..utils import (
ExtractorError,
int_or_none,
OnDemandPagedList,
parse_qs,
try_get,
urljoin,
update_url_query,
)
class MediasetIE(ThePlatformBaseIE):
_TP... | @@ -212,3 +213,94 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.786 | suggestion | 821 | 27 | 297 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
# coding: utf-8
from __future__ import unicode_literals
import re
from .theplatform import ThePlatformBaseIE
from ..utils import (
ExtractorError,
int_or_none,
parse_qs,
try_get,
update_url_query,
)
class MediasetIE(ThePlatformBaseIE):
_TP_TLD = 'eu'
_VALID_URL = r'''(?x)
... | ```suggestion
try_get,
urljoin,
``` | # coding: utf-8
from __future__ import unicode_literals
import functools
import re
from .theplatform import ThePlatformBaseIE
from ..utils import (
ExtractorError,
int_or_none,
OnDemandPagedList,
parse_qs,
try_get,
urljoin,
update_url_query,
)
class MediasetIE(ThePlatformBaseIE):
_TP... | @@ -8,6 +8,7 @@
ExtractorError,
int_or_none,
parse_qs,
+ try_get, | yt_dlp/extractor/mediaset.py | 13 | Python | 0.429 | suggestion | 46 | 38 | 38 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
_FEED_URL = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/'
_BY_SUBBRAND = _FEED_URL + 'mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{%s}&sort=:publishInfo_lastPublished|desc,tvSeasonEpisodeNumber|desc&range=%d-%d'
_RANGE_STEP = 25
_RANGE_STOP = 200
def _get_data(self, sb):
... | ```suggestion
entries = [self.url_result(urljoin('https://www.mediasetplay.mediaset.it', url))
for url in re.findall(r'href="([^<>=]+SE\d{12},ST\d{12},sb\d{9})">[^<]+<', page)]
``` | # TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
'info_dict': {
'id': '100013375',
'title': 'I servizi',
},
'playlist_count': 53,
}]
... | @@ -212,3 +214,79 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.786 | suggestion | 218 | 35 | 39 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST000000002738,sb100013107',
'info_dict': {
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
... | what's with these variable names? Use readable names | 'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST000000002738,sb100013107',
'info_dict': {
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
... | @@ -246,47 +248,53 @@ class MediasetShowIE(MediasetIE):
},
'playlist_count': 7,
}, {
- # TV Show specific playlist (extracts video contents)
+ # TV Show specific playlist (single page)
'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.286 | question | 52 | 50 | 46 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'info_dict': {
'id': '000000002763',
'title': 'Le Iene',
},
'playlist_count': 7,
}, {
# TV Show specific playlist (single page)
'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST000000002738,sb100013107',
... | _BY_SUBBRAND is long, so it is justified making it a seperate variable. But the other two doesnt need to be. They are only used in a single place. Better to just put them there | 'info_dict': {
'id': '000000002763',
'title': 'Le Iene',
},
'playlist_count': 7,
}, {
# TV Show specific playlist (single page)
'url': 'https://www.mediasetplay.mediaset.it/serie-tv/fireforce/episodi_SE000000001556,ST000000002738,sb100013107',
... | @@ -212,3 +216,85 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.429 | suggestion | 176 | 51 | 51 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
}, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
'info_dict': {
'id': '100013375',
'title': 'I servizi',
},
'playlist_count': 53... | ```suggestion
playlist_title=entry['mediasetprogram$subBrandDescription'])
``` | }, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
'info_dict': {
'id': '100013375',
'title': 'I servizi',
},
'playlist_count': 53... | @@ -212,3 +216,85 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.714 | suggestion | 100 | 44 | 40 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'info_dict': {
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
... | ```suggestion
if content.get('entries'):
``` | 'info_dict': {
'id': '100013107',
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
... | @@ -212,3 +216,85 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.571 | suggestion | 54 | 49 | 45 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
},
'playlist_count': 53,
}]
_HOST = 'https://www.mediasetplay.mediaset.it'
_FEED_URL = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/'
_BY_SUBBRAND = _FEED_URL + 'mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{%s}&sort=:publishInfo_lastPublished|desc,tvSeasonEpisodeNu... | ```suggestion
entries = [self.url_result(urljoin('https://www.mediasetplay.mediaset.it', url))
``` | },
'playlist_count': 53,
}]
_BY_SUBBRAND = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{%s}&sort=:publishInfo_lastPublished|desc,tvSeasonEpisodeNumber|desc&range=%d-%d'
_PAGE_SIZE = 25
def _fetch_page(self, sb, page):
... | @@ -212,3 +216,85 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.714 | suggestion | 112 | 38 | 34 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
'info_dict': {
'id': '100013375',
... | ```suggestion
for entry in content.get('entries') or []:
yield self.url_result(
'mediaset:' + entry['guid'],
playlist_title=entry['mediasetprogram$subBrandDescription'])
``` | 'title': 'Episodi',
},
'playlist_count': 4,
}, {
# TV Show specific playlist (with multiple pages)
'url': 'https://www.mediasetplay.mediaset.it/programmi-tv/leiene/iservizi_SE000000000061,ST000000002763,sb100013375',
'info_dict': {
'id': '100013375',
... | @@ -212,3 +216,82 @@ def _real_extract(self, url):
'subtitles': subtitles,
})
return info
+
+
+class MediasetShowIE(MediasetIE):
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://
+ (?:(?:www|static3)\.)?mediasetplay\.mediaset... | yt_dlp/extractor/mediaset.py | 26 | Python | 0.786 | suggestion | 230 | 44 | 43 | false | [mediaset] Added playlist support | 1,463 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
import asyncio
import atexit
import base64
import binascii
import calendar
import codecs
import collections
import contextlib
import ctypes
import datetime
import email.header
import email.utils
import errno
import gzip
import hashlib
import hmac
import html.entities
import html.parser
import http.client
import http.co... | ```suggestion
return 'mkv'
``` | import asyncio
import atexit
import base64
import binascii
import calendar
import codecs
import collections
import contextlib
import ctypes
import datetime
import email.header
import email.utils
import errno
import gzip
import hashlib
import hmac
import html.entities
import html.parser
import http.client
import http.co... | @@ -6616,3 +6616,41 @@ def join_nonempty(*values, delim='-', from_dict=None):
if from_dict is not None:
values = map(from_dict.get, values)
return delim.join(map(str, filter(None, values)))
+
+def get_compatible_ext(vcodecs, acodecs, vexts, aexts):
+ assert len(vcodecs) == len(vexts) and len(acode... | yt_dlp/utils.py | 26 | Python | 0.429 | suggestion | 40 | 5,718 | 5,758 | false | [core] merging formats by codecs, determining extension before download | 1,482 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
default_overwrite=False)
if file:
info_dict['ext'] = os.path.splitext(file)[1][1:]
return file
fd, success = None, True
if info_dict.get('protocol') or info_dict.get('url'):
... | ```suggestion
self.report_warning(
'webm doesn\'t support embedding a thumbnail, mkv will be used')
``` | ext = info_dict.get('ext')
converted = lambda file: replace_extension(file, self.params.get('final_ext') or ext, ext)
file = self.existing_file(itertools.chain(*zip(map(converted, filepaths), filepaths)),
default_o... | @@ -3067,41 +3065,16 @@ def existing_video_file(*filepaths):
return
if info_dict.get('requested_formats') is not None:
-
- def compatible_formats(formats):
- # TODO: some formats actually allow this (mkv, webm, ogg, mp4), but not all ... | yt_dlp/YoutubeDL.py | 26 | Python | 0.786 | suggestion | 166 | 51 | 51 | false | [core] merging formats by codecs, determining extension before download | 1,482 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | selfisekai |
thumbnails_list = json_ld.get('image')
if not thumbnails_list:
try:
thumbnails_list = self._html_search_regex(
r'["\']image["\']:\s*["\']([^"\']+)["\']', webpage, 'images', default='')
thumbnails_list = thumbnails_list.replace('[', '').repl... | ```suggestion
width_a, height_a, width = int_or_none(width_a), int_or_none(height_a), int_or_none(width)
thumbnails.append({
'url': thumbnail,
'width': width,
'height': try_get(width, lambda x: x * height_a / width_a)
})
``` | title = self._html_search_meta(('title', 'og:title', 'twitter:title'), webpage)
uuid = self._html_search_meta('episode_uid', webpage)
m3u8_url = self._html_search_meta('video_url', webpage)
json_ld = self._search_json_ld(webpage, uuid)
thumbnails_list = json_ld.get('image')
... | @@ -26,31 +27,50 @@ class OlympicsReplayIE(InfoExtractor):
def _real_extract(self, url):
id = self._match_id(url)
- # The parameters are hardcoded in the webpage, it's not necessary to download the webpage just for these parameters.
- # If in downloading webpage serves other functions aswe... | yt_dlp/extractor/olympics.py | 26 | Python | 0.786 | suggestion | 315 | 42 | 37 | false | [Olympics] Fix extractor | 1,483 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'title': node.get('title') or 'Video %d' % edge_num,
'url': node_video_url,
'thumbnail': node.get('display_url'),
'duration': float_or_none(node.get('video_duration')),
'width': in... | ```suggestion
dash = try_get(media, lambda x: x['dash_info']['video_dash_manifest'])
if dash:
formats.extend(self._parse_mpd_formats(self._parse_xml(dash, video_id), mpd_id='dash'))
self._sort_formats(formats)
``` | 'title': node.get('title') or 'Video %d' % edge_num,
'url': node_video_url,
'thumbnail': node.get('display_url'),
'duration': float_or_none(node.get('video_duration')),
'width': in... | @@ -294,6 +294,11 @@ def get_count(keys, kind):
'width': width,
'height': height,
}]
+ dash = try_get(media, lambda x: x['dash_info']['video_dash_manifest'])
+ if dash:
+ additional_formats = self._parse_mpd_formats(self._parse_xml(dash, video_id), mpd_id='das... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | suggestion | 254 | 51 | 51 | false | [instagram] Add additional formats when logged in | 1,487 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
description = lowercase_escape(description)
if not thumbnail:
thumbnail = self._og_search_thumbnail(webpage)
return {
'id': video_id,
'formats': formats,
'ext': 'mp4',
'title': title or 'Video by %s' % uploader_id,
... | It is recommended to make an `InstagramBaseIE` instead to avoid accidentally sharing undesirable properties. I can see you have made sure to overload everything manually, but that is the wrong approach
Also, in the login code, make sure the token is saved as a class var of the base class (not an instance var) so tha... | webpage, 'uploader id', fatal=False)
if not description:
description = self._search_regex(
r'"caption"\s*:\s*"(.+?)"', webpage, 'description', default=None)
if description is not None:
description = lowercase_escape(description)
i... | @@ -329,9 +329,10 @@ def get_count(keys, kind):
}
-class InstagramPlaylistIE(InfoExtractor):
+class InstagramPlaylistIE(InstagramIE): | yt_dlp/extractor/instagram.py | 26 | Python | 0.643 | bug | 441 | 51 | 51 | false | [Instagram] Add login to playlist | 1,488 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
login_webpage, 'shared data', default='{}'),
None)
login = self._download_json('https://www.instagram.com/accounts/login/ajax/', None, note='Logging in', headers={
'Accept': '*/*',
'X-IG-App-ID': '936619743392459',
'X-ASBD-ID': '198387',
... | ```suggestion
InstagramBaseIE._IS_LOGGED_IN = True
``` |
login = self._download_json('https://www.instagram.com/accounts/login/ajax/', None, note='Logging in', headers={
'Accept': '*/*',
'X-IG-App-ID': '936619743392459',
'X-ASBD-ID': '198387',
'X-IG-WWW-Claim': '0',
'X-Requested-With': 'XMLHttpRequest',
... | @@ -25,9 +26,179 @@
)
-class InstagramIE(InfoExtractor):
- _VALID_URL = r'(?P<url>https?://(?:www\.)?instagram\.com/(?:p|tv|reel)/(?P<id>[^/?#&]+))'
+class InstagramBaseIE(InfoExtractor):
_NETRC_MACHINE = 'instagram'
+ _IS_LOGGED_IN = False
+
+ _gis_tmpl = None # used to cache GIS request type
+
+ ... | yt_dlp/extractor/instagram.py | 26 | Python | 0.571 | suggestion | 64 | 51 | 51 | false | [Instagram] Add login to playlist | 1,488 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'view_count': view_count,
})
yield info
page_info = media.get('page_info')
if not page_info or not isinstance(page_info, dict):
break
has_next_page = page_info.get('has_next_page')
if not has_next_page... | The point was not to have a _real_extract/_VALID_URL/TESTS that needs to be overloaded in subclasses
```py
class InstagramPlayListBaseIE(InstagramBaseIE):
def _real_extract(self, url):
...
``` | 'only_matching': True,
}]
@staticmethod
def _extract_embed_url(webpage):
mobj = re.search(
r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1',
webpage)
if mobj:
return mobj.group('url')
blockquote... | @@ -25,9 +26,179 @@
)
-class InstagramIE(InfoExtractor):
- _VALID_URL = r'(?P<url>https?://(?:www\.)?instagram\.com/(?:p|tv|reel)/(?P<id>[^/?#&]+))'
+class InstagramBaseIE(InfoExtractor):
_NETRC_MACHINE = 'instagram'
+ _IS_LOGGED_IN = False
+
+ _gis_tmpl = None # used to cache GIS request type
+
+ ... | yt_dlp/extractor/instagram.py | 26 | Python | 0.857 | refactor | 215 | 51 | 51 | false | [Instagram] Add login to playlist | 1,488 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
webpage = self._download_webpage(url, playlist_id)
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
raise ExtractorError(NOT_AVAILABLE_STRING, expected=True)
type_ = None
... | The structure of your code is confusing. Move variables as close to where they are first used. So this should go just above the for loop | 'title': 'Queer: Bogotart (Queer)',
'thumbnail': r're:^https?://.*\.jpg',
'duration': 1558.3,
},
}],
'params': {
# m3u8 download
'skip_download': True,
},
}, {
# iframe embed
'url': 'http://ww... | @@ -66,12 +52,58 @@ class CeskaTelevizeIE(InfoExtractor):
}, {
'url': 'http://www.ceskatelevize.cz/ivysilani/embed/iFramePlayer.php?hash=d6a3e1370d2e4fa76296b90bad4dfc19673b641e&IDEC=217 562 22150/0004&channelID=1&width=100%25',
'only_matching': True,
+ }, {
+ # video with 18+ caution t... | yt_dlp/extractor/ceskatelevize.py | 26 | Python | 0.429 | suggestion | 136 | 51 | 51 | false | [ceskatelevize] Fix request url | 1,489 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
(lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']),
dict)
# _sharedData.entry_data.PostPage is empty when authenticated (see
# https://github.com/ytdl-org/youtube-dl/pull/22880)
... | Did u mean to do this?
```suggestion
display_resources = [{'src': media.get('display_src') or media.get('display_url')}]
``` | (lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']),
dict)
# _sharedData.entry_data.PostPage is empty when authenticated (see
# https://github.com/ytdl-org/youtube-dl/pull/22880)
... | @@ -234,7 +234,9 @@ def _real_extract(self, url):
media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'],
compat_str) or media.get('caption')
title = media.get('title')
- thumbnail = media.get('display_src') or media.get('display_url')
+ ... | yt_dlp/extractor/instagram.py | 26 | Python | 0.714 | suggestion | 143 | 51 | 51 | false | [Instagram] Improve thumbnail extraction | 1,496 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | u-spec-png |
if not display_resources:
display_resources = [{'src': media.get('display_src') or media.get('display_url')}]
duration = float_or_none(media.get('video_duration'))
timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date'))
uploader = try... | ```suggestion
thumbnails = [{
'url': thumbnail['src'],
'width': thumbnail.get('config_width'),
'height': thumbnail.get('config_height'),
} for thumbnail in display_resources if thumbnail.get('src')]
``` | if not display_resources:
display_resources = [{'src': media.get('display_src')}, {'src': media.get('display_url')}]
duration = float_or_none(media.get('video_duration'))
timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date'))
uploade... | @@ -252,6 +254,14 @@ def get_count(keys, kind):
comment_count = get_count(
('preview_comment', 'to_comment', 'to_parent_comment'), 'comment')
+ thumbnails = []
+ for thumbnail in display_resources:
+ thumbnails.append({
+ 'url': thu... | yt_dlp/extractor/instagram.py | 26 | Python | 0.786 | suggestion | 280 | 51 | 51 | false | [Instagram] Improve thumbnail extraction | 1,496 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
(lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']),
dict)
# _sharedData.entry_data.PostPage is empty when authenticated (see
# https://github.com/ytdl-org/youtube-dl/pull/22880)
... | Now that this is being done `if thumbnail.get('src')`
```suggestion
display_resources = [{'src': media.get('display_src')}, {'src': media.get('display_url')}]
```
TBH i'd remove the ` if not display_resources:` and append anyways
something like
```py
display_resources = media.get('... | (lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']),
dict)
# _sharedData.entry_data.PostPage is empty when authenticated (see
# https://github.com/ytdl-org/youtube-dl/pull/22880)
... | @@ -234,7 +234,9 @@ def _real_extract(self, url):
media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'],
compat_str) or media.get('caption')
title = media.get('title')
- thumbnail = media.get('display_src') or media.get('display_url')
+ ... | yt_dlp/extractor/instagram.py | 26 | Python | 0.857 | suggestion | 460 | 51 | 51 | false | [Instagram] Improve thumbnail extraction | 1,496 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | u-spec-png |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class PeerTVIE(InfoExtractor):
IE_NAME = 'peer.tv'
_VALID_URL = r'https?://(?:www\.)?peer\.tv/(?:de|it|en)/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.peer.tv/de/841',
# md5 hash changes
'in... | ```suggestion
'info_dict': {
'id': '841',
'ext': 'mp4',
'title': 'Die Brunnenburg',
'description': 'md5:4395f6142b090338340ab88a3aae24ed',
},
'params': {'skip_download': 'm3u8'}
```
same for other test | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import js_to_json
class PeerTVIE(InfoExtractor):
IE_NAME = 'peer.tv'
_VALID_URL = r'https?://(?:www\.)?peer\.tv/(?:de|it|en)/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.peer.tv/de/841',
... | @@ -0,0 +1,60 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class PeerTVIE(InfoExtractor):
+ IE_NAME = 'peer.tv'
+ _VALID_URL = r'https?://(?:www\.)?peer\.tv/(?:de|it|en)/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.peer.tv/de/841',
+ #... | yt_dlp/extractor/peertv.py | 18 | Python | 0.786 | suggestion | 282 | 43 | 43 | false | [peer.tv] Add extractor | 1,499 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title').replace('\xa0', ' ')
description = self._html_search_meta(('og:description', 'description'), webpage)
video_key = self._html_search_regex(r'player\.peer\.tv/js/([\d\w]+)', webpage, 'video key')
js = self._download_web... | ```suggestion
'title': self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title').replace('\xa0', ' '),
'formats': formats,
'description': self._html_search_meta(('og:description', 'description'), webpage),
```
is cleaner imo | video_key = self._html_search_regex(r'player\.peer\.tv/js/([a-zA-Z0-9]+)', webpage, 'video key')
js = self._download_webpage(f'https://player.peer.tv/js/{video_key}/', video_id,
headers={'Referer': 'https://www.peer.tv/'}, note='Downloading session id')
sess... | @@ -0,0 +1,60 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class PeerTVIE(InfoExtractor):
+ IE_NAME = 'peer.tv'
+ _VALID_URL = r'https?://(?:www\.)?peer\.tv/(?:de|it|en)/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://www.peer.tv/de/841',
+ #... | yt_dlp/extractor/peertv.py | 26 | Python | 0.857 | suggestion | 268 | 29 | 26 | false | [peer.tv] Add extractor | 1,499 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'id': '107163961867310434-0',
'ext': 'mp4',
'title': "L on Gab: ''",
'uploader_id': '946600',
'uploader': 'SomeBitchIKnow',
'description': 'md5:204055fafd5e1a519f5d6db953567ca3',
'timestamp': 1635192289,
'upload_date': '2021... | the CSRF token is not required for the API request (if it was, it would break the mobile apps). there's no reason to download the webpage here | 'id': '107163961867310434-0',
'ext': 'mp4',
'title': 'L on Gab',
'uploader_id': '946600',
'uploader': 'SomeBitchIKnow',
'description': 'md5:204055fafd5e1a519f5d6db953567ca3',
'timestamp': 1635192289,
'upload_date': '20211025... | @@ -62,3 +68,103 @@ def _real_extract(self, url):
'uploader_id': channel_id,
'thumbnail': f'https://tv.gab.com/image/{id}',
}
+
+
+class GabIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gab\.com/[^/]+/posts/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://gab.com/Som... | yt_dlp/extractor/gab.py | 26 | Python | 0.357 | security | 142 | 51 | 51 | false | [Gab] Add extractor | 1,505 | yt-dlp/yt-dlp | 132,642 | Python | selfisekai | u-spec-png |
description = clean_html(json_data.get('content'))
like_count = json_data.get('favourites_count')
comment_count = json_data.get('replies_count')
repost_count = json_data.get('reblogs_count')
media_list = json_data['media_attachments']
author = json_data.get('account') or... | ```suggestion
url = media.get('url') or media.get('source_mp4')
```
cant u just do this? | continue
metadata = media['meta']
format_metadata = {
'acodec': parse_codecs(metadata.get('audio_encode')).get('acodec'),
'asr': int_or_none((metadata.get('audio_bitrate') or '').split(' ')[0]),
'fps': metadata.get('fps'),
... | @@ -62,3 +68,97 @@ def _real_extract(self, url):
'uploader_id': channel_id,
'thumbnail': f'https://tv.gab.com/image/{id}',
}
+
+
+class GabIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?gab\.com/[^/]+/posts/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://gab.com/Some... | yt_dlp/extractor/gab.py | 26 | Python | 0.714 | question | 107 | 51 | 40 | false | [Gab] Add extractor | 1,505 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
vod_id = info.get('id') or item_id
# id backward compatibility for download archives
if vod_id[0] != 'v':
vod_id = 'v%s' % vod_id
thumbnail = url_or_none(info.get('previewThumbnailURL'))
if thumbnail:
for p in ('width', 'height'):
thumbnail... | int_or_none has a scale parameter | if thumbnail:
for p in ('width', 'height'):
thumbnail = thumbnail.replace('{%s}' % p, '0')
return {
'id': vod_id,
'title': info.get('title') or 'Untitled Broadcast',
'description': info.get('description'),
'duration': int_or_no... | @@ -314,6 +376,33 @@ def _extract_info_gql(info, item_id):
if thumbnail:
for p in ('width', 'height'):
thumbnail = thumbnail.replace('{%s}' % p, '0')
+
+ chapters = list()
+ for moment in info.get('moments'):
+ moment = moment.get('node')
+ if m... | yt_dlp/extractor/twitch.py | 26 | Python | 0.071 | suggestion | 33 | 51 | 51 | false | Twitch VOD extractor - chapters | 1,515 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mpeter50 |
'duration': int_or_none(info.get('length')),
'thumbnails': thumbnails,
'uploader': info.get('channel', {}).get('display_name'),
'uploader_id': info.get('channel', {}).get('name'),
'timestamp': parse_iso8601(info.get('recorded_at')),
'view_count': i... | why? The type doesnt affect anything in code | 'start_time': start_time,
'end_time': start_time + duration,
'title': name,
}
def _extract_info_gql(self, info, item_id):
vod_id = info.get('id') or item_id
# id backward compatibility for download archives
if vod_id[0] != 'v':
... | @@ -314,6 +376,33 @@ def _extract_info_gql(info, item_id):
if thumbnail:
for p in ('width', 'height'):
thumbnail = thumbnail.replace('{%s}' % p, '0')
+
+ chapters = list()
+ for moment in info.get('moments'):
+ moment = moment.get('node')
+ if m... | yt_dlp/extractor/twitch.py | 26 | Python | 0.214 | question | 44 | 51 | 51 | false | Twitch VOD extractor - chapters | 1,515 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mpeter50 |
return {
'id': info['_id'],
'title': info.get('title') or 'Untitled Broadcast',
'description': info.get('description'),
'duration': int_or_none(info.get('length')),
'thumbnails': thumbnails,
'uploader': info.get('channel', {}).get('display_... | ```suggestion
for moment in info.get('moments') or []:
``` | if start_time is None or duration is None:
self.report_warning(f'Important chapter information missing for chapter {name}', item_id)
continue
yield {
'start_time': start_time,
'end_time': start_time + duration,
'titl... | @@ -314,6 +376,33 @@ def _extract_info_gql(info, item_id):
if thumbnail:
for p in ('width', 'height'):
thumbnail = thumbnail.replace('{%s}' % p, '0')
+
+ chapters = list()
+ for moment in info.get('moments'): | yt_dlp/extractor/twitch.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | Twitch VOD extractor - chapters | 1,515 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mpeter50 |
})
return {
'id': info['_id'],
'title': info.get('title') or 'Untitled Broadcast',
'description': info.get('description'),
'duration': int_or_none(info.get('length')),
'thumbnails': thumbnails,
'uploader': info.get('channel'... | convention is to do
```suggestion
chapters = []
```
Also, this entire for loop looks like it can be simplified into a list comprehension |
if start_time is None or duration is None:
self.report_warning(f'Important chapter information missing for chapter {name}', item_id)
continue
yield {
'start_time': start_time,
'end_time': start_time + duration,
'tit... | @@ -314,6 +376,33 @@ def _extract_info_gql(info, item_id):
if thumbnail:
for p in ('width', 'height'):
thumbnail = thumbnail.replace('{%s}' % p, '0')
+
+ chapters = list() | yt_dlp/extractor/twitch.py | 26 | Python | 0.714 | suggestion | 148 | 51 | 51 | false | Twitch VOD extractor - chapters | 1,515 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | mpeter50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.