mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-16 14:36:47 +00:00
Compare commits
3 Commits
cfeba5d17f
...
3e4e338133
Author | SHA1 | Date | |
---|---|---|---|
|
3e4e338133 | ||
|
be19ae11fd | ||
|
59d63d8d4a |
@ -10,6 +10,8 @@ from ..utils import (
|
|||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
js_to_json,
|
||||||
|
merge_dicts,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
@ -98,6 +100,26 @@ class CSpanIE(InfoExtractor):
|
|||||||
bc_attr['data-bcid'])
|
bc_attr['data-bcid'])
|
||||||
return self.url_result(smuggle_url(bc_url, {'source_url': url}))
|
return self.url_result(smuggle_url(bc_url, {'source_url': url}))
|
||||||
|
|
||||||
|
def add_referer(formats):
|
||||||
|
for f in formats:
|
||||||
|
f.setdefault('http_headers', {})['Referer'] = url
|
||||||
|
|
||||||
|
# As of 01.12.2020 this path looks to cover all cases making the rest
|
||||||
|
# of the code unnecessary
|
||||||
|
jwsetup = self._parse_json(
|
||||||
|
self._search_regex(
|
||||||
|
r'(?s)jwsetup\s*=\s*({.+?})\s*;', webpage, 'jwsetup',
|
||||||
|
default='{}'),
|
||||||
|
video_id, transform_source=js_to_json, fatal=False)
|
||||||
|
if jwsetup:
|
||||||
|
info = self._parse_jwplayer_data(
|
||||||
|
jwsetup, video_id, require_title=False, m3u8_id='hls',
|
||||||
|
base_url=url)
|
||||||
|
add_referer(info['formats'])
|
||||||
|
ld_info = self._search_json_ld(webpage, video_id, default={})
|
||||||
|
return merge_dicts(info, ld_info)
|
||||||
|
|
||||||
|
# Obsolete
|
||||||
# We first look for clipid, because clipprog always appears before
|
# We first look for clipid, because clipprog always appears before
|
||||||
patterns = [r'id=\'clip(%s)\'\s*value=\'([0-9]+)\'' % t for t in ('id', 'prog')]
|
patterns = [r'id=\'clip(%s)\'\s*value=\'([0-9]+)\'' % t for t in ('id', 'prog')]
|
||||||
results = list(filter(None, (re.search(p, webpage) for p in patterns)))
|
results = list(filter(None, (re.search(p, webpage) for p in patterns)))
|
||||||
@ -165,6 +187,7 @@ class CSpanIE(InfoExtractor):
|
|||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
path, video_id, 'mp4', entry_protocol='m3u8_native',
|
path, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
m3u8_id='hls') if determine_ext(path) == 'm3u8' else [{'url': path, }]
|
m3u8_id='hls') if determine_ext(path) == 'm3u8' else [{'url': path, }]
|
||||||
|
add_referer(formats)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
entries.append({
|
entries.append({
|
||||||
'id': '%s_%d' % (video_id, partnum + 1),
|
'id': '%s_%d' % (video_id, partnum + 1),
|
||||||
|
@ -602,7 +602,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
'description': 'SUBSCRIBE: http://www.youtube.com/saturninefilms\n\nEven Obama has taken a stand against freedom on this issue: http://www.huffingtonpost.com/2010/09/09/obama-gma-interview-quran_n_710282.html',
|
'description': 'SUBSCRIBE: http://www.youtube.com/saturninefilms\n\nEven Obama has taken a stand against freedom on this issue: http://www.huffingtonpost.com/2010/09/09/obama-gma-interview-quran_n_710282.html',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# Normal age-gate video (No vevo, embed allowed)
|
# Normal age-gate video (No vevo, embed allowed), available via embed page
|
||||||
{
|
{
|
||||||
'url': 'https://youtube.com/watch?v=HtVdAasjOgU',
|
'url': 'https://youtube.com/watch?v=HtVdAasjOgU',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -618,6 +618,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# Age-gated video only available with authentication (unavailable
|
||||||
|
# via embed page workaround)
|
||||||
|
'url': 'XgnwCQzjau8',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
# video_info is None (https://github.com/ytdl-org/youtube-dl/issues/4421)
|
# video_info is None (https://github.com/ytdl-org/youtube-dl/issues/4421)
|
||||||
# YouTube Red ad is not captured for creator
|
# YouTube Red ad is not captured for creator
|
||||||
{
|
{
|
||||||
@ -1637,8 +1643,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
# Get video info
|
# Get video info
|
||||||
video_info = {}
|
video_info = {}
|
||||||
embed_webpage = None
|
embed_webpage = None
|
||||||
if (self._og_search_property('restrictions:age', video_webpage, default=None) == '18+'
|
|
||||||
or re.search(r'player-age-gate-content">', video_webpage) is not None):
|
if re.search(r'["\']status["\']\s*:\s*["\']LOGIN_REQUIRED', video_webpage) is not None:
|
||||||
age_gate = True
|
age_gate = True
|
||||||
# We simulate the access to the video from www.youtube.com/v/{video_id}
|
# We simulate the access to the video from www.youtube.com/v/{video_id}
|
||||||
# this can be viewed without login into Youtube
|
# this can be viewed without login into Youtube
|
||||||
|
Loading…
Reference in New Issue
Block a user