mirror of https://github.com/yt-dlp/yt-dlp.git
Compare commits
6 Commits
ac24c07a4e
...
796611a784
Author | SHA1 | Date |
---|---|---|
Mozi | 796611a784 | |
bashonly | 5904853ae5 | |
Chris Caruso | c8bf48f3a8 | |
The-MAGI | 351368cb9a | |
Mozi | 1b92d6fab7 | |
Mozi | cf1829bf03 |
|
@ -820,6 +820,7 @@
|
|||
InstagramUserIE,
|
||||
InstagramTagIE,
|
||||
InstagramStoryIE,
|
||||
InstagramLiveIE,
|
||||
)
|
||||
from .internazionale import InternazionaleIE
|
||||
from .internetvideoarchive import InternetVideoArchiveIE
|
||||
|
|
|
@ -151,7 +151,7 @@ def _real_extract(self, url):
|
|||
|
||||
class CBCPlayerIE(InfoExtractor):
|
||||
IE_NAME = 'cbc.ca:player'
|
||||
_VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>(?:\d\.)?\d+)'
|
||||
_VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/(?:video/)?|i/caffeine/syndicate/\?mediaId=))(?P<id>(?:\d\.)?\d+)'
|
||||
_TESTS = [{
|
||||
'url': 'http://www.cbc.ca/player/play/2683190193',
|
||||
'md5': '64d25f841ddf4ddb28a235338af32e2c',
|
||||
|
@ -277,6 +277,28 @@ class CBCPlayerIE(InfoExtractor):
|
|||
'location': 'Canada',
|
||||
'media_type': 'Full Program',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.cbc.ca/player/play/video/1.7194274',
|
||||
'md5': '188b96cf6bdcb2540e178a6caa957128',
|
||||
'info_dict': {
|
||||
'id': '2334524995812',
|
||||
'ext': 'mp4',
|
||||
'title': '#TheMoment a rare white spirit moose was spotted in Alberta',
|
||||
'description': 'md5:18ae269a2d0265c5b0bbe4b2e1ac61a3',
|
||||
'timestamp': 1714788791,
|
||||
'duration': 77.678,
|
||||
'subtitles': {'eng': [{'ext': 'vtt', 'protocol': 'm3u8_native'}]},
|
||||
'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/201/543/THE_MOMENT.jpg',
|
||||
'uploader': 'CBCC-NEW',
|
||||
'chapters': 'count:0',
|
||||
'upload_date': '20240504',
|
||||
'categories': 'count:3',
|
||||
'series': 'The National',
|
||||
'tags': 'count:15',
|
||||
'creators': ['encoder'],
|
||||
'location': 'Canada',
|
||||
'media_type': 'Excerpt',
|
||||
},
|
||||
}, {
|
||||
'url': 'cbcplayer:1.7159484',
|
||||
'only_matching': True,
|
||||
|
|
|
@ -53,15 +53,19 @@ def _set_auth_info(self, response):
|
|||
CrunchyrollBaseIE._AUTH_EXPIRY = time_seconds(seconds=traverse_obj(response, ('expires_in', {float_or_none}), default=300) - 10)
|
||||
|
||||
def _request_token(self, headers, data, note='Requesting token', errnote='Failed to request token'):
|
||||
try: # TODO: Add impersonation support here
|
||||
try:
|
||||
return self._download_json(
|
||||
f'{self._BASE_URL}/auth/v1/token', None, note=note, errnote=errnote,
|
||||
headers=headers, data=urlencode_postdata(data))
|
||||
headers=headers, data=urlencode_postdata(data), impersonate=True)
|
||||
except ExtractorError as error:
|
||||
if not isinstance(error.cause, HTTPError) or error.cause.status != 403:
|
||||
raise
|
||||
if target := error.cause.response.extensions.get('impersonate'):
|
||||
raise ExtractorError(f'Got HTTP Error 403 when using impersonate target "{target}"')
|
||||
raise ExtractorError(
|
||||
'Request blocked by Cloudflare; navigate to Crunchyroll in your browser, '
|
||||
'Request blocked by Cloudflare. '
|
||||
'Install the required impersonation dependency if possible, '
|
||||
'or else navigate to Crunchyroll in your browser, '
|
||||
'then pass the fresh cookies (with --cookies-from-browser or --cookies) '
|
||||
'and your browser\'s User-Agent (with --user-agent)', expected=True)
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
from ..networking.exceptions import HTTPError
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
UserNotLive,
|
||||
decode_base_n,
|
||||
encode_base_n,
|
||||
filter_dict,
|
||||
|
@ -733,3 +734,59 @@ def _real_extract(self, url):
|
|||
**filter_dict(highlight_data),
|
||||
})
|
||||
return self.playlist_result(info_data, playlist_id=story_id, playlist_title=story_title)
|
||||
|
||||
|
||||
class InstagramLiveIE(InstagramBaseIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?instagram\.com/(?P<user>[^/]+)/live(?:/|/(?P<id>\d+))?'
|
||||
IE_NAME = 'instagram:live'
|
||||
|
||||
_TESTS = [{
|
||||
'url': 'https://www.instagram.com/answer/live/42',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
username, video_id = self._match_valid_url(url).groups()
|
||||
video_id = video_id or username
|
||||
|
||||
metadata_str = self._html_search_regex(
|
||||
r'data-sjs>({.*?ScheduledServerJS.*?target_user_id.*?})</script>',
|
||||
self._download_webpage(url, video_id), 'live metadata', default=None)
|
||||
if not metadata_str:
|
||||
raise UserNotLive(video_id=video_id)
|
||||
|
||||
metadata = self._parse_json(metadata_str, video_id)
|
||||
|
||||
target_user_id = traverse_obj(
|
||||
metadata,
|
||||
('require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., 'rootView', 'props', 'target_user_id', {str}),
|
||||
('require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., 'hostableView', 'props', 'target_user_id', {str}),
|
||||
get_all=False)
|
||||
if not target_user_id:
|
||||
raise ExtractorError('Missing "target_user_id" in metadata')
|
||||
|
||||
app_id = traverse_obj(
|
||||
metadata,
|
||||
('require', ..., ..., ..., '__bbox', 'define', ..., ..., 'customHeaders', 'X-IG-App-ID', {str}),
|
||||
('require', ..., ..., ..., '__bbox', 'define', ..., ..., 'appId', {int}),
|
||||
('require', ..., ..., ..., '__bbox', 'define', ..., ..., 'APP_ID', {str}),
|
||||
('require', ..., ..., ..., '__bbox', 'define', ..., ..., 'app_id', {str}),
|
||||
get_all=False)
|
||||
if not app_id:
|
||||
raise ExtractorError('Missing "app_id" in metadata')
|
||||
|
||||
web_info_json = self._download_json(
|
||||
'https://www.instagram.com/api/v1/live/web_info/', video_id,
|
||||
query={'target_user_id': target_user_id}, headers={'x-ig-app-id': app_id},
|
||||
note='Downloading web_info', errnote='Unable to download web_info')
|
||||
|
||||
video_id = traverse_obj(web_info_json, ('id'))
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': self._extract_mpd_formats(
|
||||
traverse_obj(web_info_json, ('dash_abr_playback_url', {url_or_none})), video_id),
|
||||
'uploader': traverse_obj(web_info_json, ('broadcast_owner', 'full_name')),
|
||||
'uploader_id': username,
|
||||
'live_status': 'is_live',
|
||||
}
|
||||
|
|
|
@ -72,15 +72,15 @@ class YouPornIE(InfoExtractor):
|
|||
'id': '16290308',
|
||||
'age_limit': 18,
|
||||
'categories': [],
|
||||
'description': 'md5:00ea70f642f431c379763c17c2f396bc',
|
||||
'description': str, # TODO: detect/remove SEO spam description in ytdl backport
|
||||
'display_id': 'tinderspecial-trailer1',
|
||||
'duration': 298.0,
|
||||
'ext': 'mp4',
|
||||
'upload_date': '20201123',
|
||||
'uploader': 'Ersties',
|
||||
'tags': [],
|
||||
'thumbnail': 'https://fi1.ypncdn.com/202011/23/16290308/original/8/tinderspecial-trailer1-8(m=eaAaaEPbaaaa).jpg',
|
||||
'timestamp': 1606089600,
|
||||
'thumbnail': r're:https://.+\.jpg',
|
||||
'timestamp': 1606147564,
|
||||
'title': 'Tinder In Real Life',
|
||||
'view_count': int,
|
||||
}
|
||||
|
@ -88,11 +88,17 @@ class YouPornIE(InfoExtractor):
|
|||
|
||||
def _real_extract(self, url):
|
||||
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
|
||||
definitions = self._download_json(
|
||||
f'https://www.youporn.com/api/video/media_definitions/{video_id}/', display_id or video_id)
|
||||
self._set_cookie('.youporn.com', 'age_verified', '1')
|
||||
webpage = self._download_webpage(f'https://www.youporn.com/watch/{video_id}', video_id)
|
||||
definitions = self._search_json(r'\bplayervars\s*:', webpage, 'player vars', video_id)['mediaDefinitions']
|
||||
|
||||
def get_format_data(data, f):
|
||||
return traverse_obj(data, lambda _, v: v['format'] == f and url_or_none(v['videoUrl']))
|
||||
def get_format_data(data, stream_type):
|
||||
info_url = traverse_obj(data, (lambda _, v: v['format'] == stream_type, 'videoUrl', {url_or_none}, any))
|
||||
if not info_url:
|
||||
return []
|
||||
return traverse_obj(
|
||||
self._download_json(info_url, video_id, f'Downloading {stream_type} info JSON', fatal=False),
|
||||
lambda _, v: v['format'] == stream_type and url_or_none(v['videoUrl']))
|
||||
|
||||
formats = []
|
||||
# Try to extract only the actual master m3u8 first, avoiding the duplicate single resolution "master" m3u8s
|
||||
|
@ -123,10 +129,6 @@ def get_format_data(data, f):
|
|||
f['height'] = height
|
||||
formats.append(f)
|
||||
|
||||
webpage = self._download_webpage(
|
||||
'http://www.youporn.com/watch/%s' % video_id, display_id,
|
||||
headers={'Cookie': 'age_verified=1'})
|
||||
|
||||
title = self._html_search_regex(
|
||||
r'(?s)<div[^>]+class=["\']watchVideoTitle[^>]+>(.+?)</div>',
|
||||
webpage, 'title', default=None) or self._og_search_title(
|
||||
|
|
Loading…
Reference in New Issue