aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish <39122144+Ashish0804@users.noreply.github.com>2021-08-02 07:23:12 +0530
committerGitHub <noreply@github.com>2021-08-02 07:23:12 +0530
commit605cad0be7540e974812073641c5a654973b70e4 (patch)
tree752358861f2b8793d839bde0448973c4cd451573
parent0855702f3f3855974609cf3e99334de0d5d166e3 (diff)
downloadhypervideo-pre-605cad0be7540e974812073641c5a654973b70e4.tar.lz
hypervideo-pre-605cad0be7540e974812073641c5a654973b70e4.tar.xz
hypervideo-pre-605cad0be7540e974812073641c5a654973b70e4.zip
[Vimeo] Better extraction of original file (#599)
Authored by: Ashish0804
-rw-r--r--yt_dlp/extractor/vimeo.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py
index 785dcc457..8ddd1d298 100644
--- a/yt_dlp/extractor/vimeo.py
+++ b/yt_dlp/extractor/vimeo.py
@@ -253,6 +253,30 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'quality': 1,
}
+ jwt_response = self._download_json(
+ 'https://vimeo.com/_rv/viewer', video_id, note='Downloading jwt token', fatal=False) or {}
+ if not jwt_response.get('jwt'):
+ return
+ headers = {'Authorization': 'jwt %s' % jwt_response['jwt']}
+ original_response = self._download_json(
+ f'https://api.vimeo.com/videos/{video_id}', video_id,
+ headers=headers, fatal=False) or {}
+ for download_data in original_response.get('download') or {}:
+ download_url = download_data.get('link')
+ if not download_url or download_data.get('quality') != 'source':
+ continue
+ query = compat_urlparse.parse_qs(compat_urlparse.urlparse(download_url).query)
+ return {
+ 'url': download_url,
+ 'ext': determine_ext(query.get('filename', [''])[0].lower()),
+ 'format_id': download_data.get('public_name', 'Original'),
+ 'width': int_or_none(download_data.get('width')),
+ 'height': int_or_none(download_data.get('height')),
+ 'fps': int_or_none(download_data.get('fps')),
+ 'filesize': int_or_none(download_data.get('size')),
+ 'quality': 1,
+ }
+
class VimeoIE(VimeoBaseInfoExtractor):
"""Information extractor for vimeo.com."""
@@ -427,6 +451,22 @@ class VimeoIE(VimeoBaseInfoExtractor):
},
},
{
+ 'note': 'Contains original format not accessible in webpage',
+ 'url': 'https://vimeo.com/393756517',
+ 'md5': 'c464af248b592190a5ffbb5d33f382b0',
+ 'info_dict': {
+ 'id': '393756517',
+ 'ext': 'mov',
+ 'timestamp': 1582642091,
+ 'uploader_id': 'frameworkla',
+ 'title': 'Straight To Hell - Sabrina: Netflix',
+ 'uploader': 'Framework Studio',
+ 'description': 'md5:f2edc61af3ea7a5592681ddbb683db73',
+ 'upload_date': '20200225',
+ },
+ 'expected_warnings': ['Unable to download JSON metadata'],
+ },
+ {
# only available via https://vimeo.com/channels/tributes/6213729 and
# not via https://vimeo.com/6213729
'url': 'https://vimeo.com/channels/tributes/6213729',