mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-25 01:52:06 +00:00
Compare commits
No commits in common. "c78591187080e7316c0042309fe956bfd0d38d30" and "8562218350a79d4709da8593bb0c538aa0824acf" have entirely different histories.
c785911870
...
8562218350
@ -24,7 +24,6 @@ from ..utils import (
|
|||||||
merge_dicts,
|
merge_dicts,
|
||||||
OnDemandPagedList,
|
OnDemandPagedList,
|
||||||
parse_filesize,
|
parse_filesize,
|
||||||
parse_iso8601,
|
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
@ -279,7 +278,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
)?
|
)?
|
||||||
(?:videos?/)?
|
(?:videos?/)?
|
||||||
(?P<id>[0-9]+)
|
(?P<id>[0-9]+)
|
||||||
(?:/(?P<unlisted_hash>[\da-f]{10}))?
|
(?:/[\da-f]+)?
|
||||||
/?(?:[?&].*)?(?:[#].*)?$
|
/?(?:[?&].*)?(?:[#].*)?$
|
||||||
'''
|
'''
|
||||||
IE_NAME = 'vimeo'
|
IE_NAME = 'vimeo'
|
||||||
@ -578,37 +577,11 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
if 'Referer' not in headers:
|
if 'Referer' not in headers:
|
||||||
headers['Referer'] = url
|
headers['Referer'] = url
|
||||||
|
|
||||||
# Extract ID from URL
|
channel_id = self._search_regex(
|
||||||
video_id, unlisted_hash = re.match(self._VALID_URL, url).groups()
|
r'vimeo\.com/channels/([^/]+)', url, 'channel id', default=None)
|
||||||
if unlisted_hash:
|
|
||||||
token = self._download_json(
|
|
||||||
'https://vimeo.com/_rv/jwt', video_id, headers={
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
})['token']
|
|
||||||
video = self._download_json(
|
|
||||||
'https://api.vimeo.com/videos/%s:%s' % (video_id, unlisted_hash),
|
|
||||||
video_id, headers={
|
|
||||||
'Authorization': 'jwt ' + token,
|
|
||||||
}, query={
|
|
||||||
'fields': 'config_url,created_time,description,license,metadata.connections.comments.total,metadata.connections.likes.total,release_time,stats.plays',
|
|
||||||
})
|
|
||||||
info = self._parse_config(self._download_json(
|
|
||||||
video['config_url'], video_id), video_id)
|
|
||||||
self._vimeo_sort_formats(info['formats'])
|
|
||||||
get_timestamp = lambda x: parse_iso8601(video.get(x + '_time'))
|
|
||||||
info.update({
|
|
||||||
'description': video.get('description'),
|
|
||||||
'license': video.get('license'),
|
|
||||||
'release_timestamp': get_timestamp('release'),
|
|
||||||
'timestamp': get_timestamp('created'),
|
|
||||||
'view_count': int_or_none(try_get(video, lambda x: x['stats']['plays'])),
|
|
||||||
})
|
|
||||||
connections = try_get(
|
|
||||||
video, lambda x: x['metadata']['connections'], dict) or {}
|
|
||||||
for k in ('comment', 'like'):
|
|
||||||
info[k + '_count'] = int_or_none(try_get(connections, lambda x: x[k + 's']['total']))
|
|
||||||
return info
|
|
||||||
|
|
||||||
|
# Extract ID from URL
|
||||||
|
video_id = self._match_id(url)
|
||||||
orig_url = url
|
orig_url = url
|
||||||
is_pro = 'vimeopro.com/' in url
|
is_pro = 'vimeopro.com/' in url
|
||||||
is_player = '://player.vimeo.com/video/' in url
|
is_player = '://player.vimeo.com/video/' in url
|
||||||
@ -783,8 +756,6 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
r'<link[^>]+rel=["\']license["\'][^>]+href=(["\'])(?P<license>(?:(?!\1).)+)\1',
|
r'<link[^>]+rel=["\']license["\'][^>]+href=(["\'])(?P<license>(?:(?!\1).)+)\1',
|
||||||
webpage, 'license', default=None, group='license')
|
webpage, 'license', default=None, group='license')
|
||||||
|
|
||||||
channel_id = self._search_regex(
|
|
||||||
r'vimeo\.com/channels/([^/]+)', url, 'channel id', default=None)
|
|
||||||
channel_url = 'https://vimeo.com/channels/%s' % channel_id if channel_id else None
|
channel_url = 'https://vimeo.com/channels/%s' % channel_id if channel_id else None
|
||||||
|
|
||||||
info_dict = {
|
info_dict = {
|
||||||
|
@ -24,7 +24,6 @@ from ..jsinterp import JSInterpreter
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
clean_html,
|
clean_html,
|
||||||
dict_get,
|
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
@ -2542,14 +2541,13 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|||||||
continuation = self._extract_continuation(continuation_renderer)
|
continuation = self._extract_continuation(continuation_renderer)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
on_response_received = dict_get(response, ('onResponseReceivedActions', 'onResponseReceivedEndpoints'))
|
|
||||||
continuation_items = try_get(
|
continuation_items = try_get(
|
||||||
on_response_received, lambda x: x[0]['appendContinuationItemsAction']['continuationItems'], list)
|
response, lambda x: x['onResponseReceivedActions'][0]['appendContinuationItemsAction']['continuationItems'], list)
|
||||||
if continuation_items:
|
if continuation_items:
|
||||||
continuation_item = continuation_items[0]
|
continuation_item = continuation_items[0]
|
||||||
if not isinstance(continuation_item, dict):
|
if not isinstance(continuation_item, dict):
|
||||||
continue
|
continue
|
||||||
renderer = self._extract_grid_item_renderer(continuation_item)
|
renderer = continuation_item.get('gridVideoRenderer')
|
||||||
if renderer:
|
if renderer:
|
||||||
grid_renderer = {'items': continuation_items}
|
grid_renderer = {'items': continuation_items}
|
||||||
for entry in self._grid_entries(grid_renderer):
|
for entry in self._grid_entries(grid_renderer):
|
||||||
@ -2563,13 +2561,6 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|||||||
yield entry
|
yield entry
|
||||||
continuation = self._extract_continuation(video_list_renderer)
|
continuation = self._extract_continuation(video_list_renderer)
|
||||||
continue
|
continue
|
||||||
renderer = continuation_item.get('backstagePostThreadRenderer')
|
|
||||||
if renderer:
|
|
||||||
continuation_renderer = {'contents': continuation_items}
|
|
||||||
for entry in self._post_thread_continuation_entries(continuation_renderer):
|
|
||||||
yield entry
|
|
||||||
continuation = self._extract_continuation(continuation_renderer)
|
|
||||||
continue
|
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user