import base64
import functools
-import re
import itertools
+import re
from .common import InfoExtractor
from ..compat import compat_str, compat_urlparse
from ..networking import HEADRequest, Request
from ..networking.exceptions import HTTPError
from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
clean_html,
determine_ext,
- ExtractorError,
get_element_by_class,
- js_to_json,
int_or_none,
+ js_to_json,
merge_dicts,
- OnDemandPagedList,
parse_filesize,
parse_iso8601,
parse_qs,
smuggle_url,
str_or_none,
+ traverse_obj,
try_get,
unified_timestamp,
unsmuggle_url,
urlencode_postdata,
- urljoin,
urlhandle_detect_ext,
+ urljoin,
)
return url, data, headers
def _perform_login(self, username, password):
- webpage = self._download_webpage(
- self._LOGIN_URL, None, 'Downloading login page')
- token, vuid = self._extract_xsrft_and_vuid(webpage)
+ viewer = self._download_json('https://vimeo.com/_next/viewer', None, 'Downloading login token')
data = {
'action': 'login',
'email': username,
'password': password,
'service': 'vimeo',
- 'token': token,
+ 'token': viewer['xsrft'],
}
- self._set_vimeo_cookie('vuid', vuid)
+ self._set_vimeo_cookie('vuid', viewer['vuid'])
try:
self._download_webpage(
self._LOGIN_URL, None, 'Logging in',
video_data = config['video']
video_title = video_data.get('title')
live_event = video_data.get('live_event') or {}
- is_live = live_event.get('status') == 'started'
+ live_status = {
+ 'pending': 'is_upcoming',
+ 'active': 'is_upcoming',
+ 'started': 'is_live',
+ 'ended': 'post_live',
+ }.get(live_event.get('status'))
+ is_live = live_status == 'is_live'
request = config.get('request') or {}
formats = []
'chapters': chapters or None,
'formats': formats,
'subtitles': subtitles,
- 'is_live': is_live,
+ 'live_status': live_status,
+ 'release_timestamp': traverse_obj(live_event, ('ingest', 'scheduled_start_time', {parse_iso8601})),
# Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
# at the same time without actual units specified.
'_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'),
'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']}
+ headers = {'Authorization': 'jwt %s' % jwt_response['jwt'], 'Accept': 'application/json'}
original_response = self._download_json(
f'https://api.vimeo.com/videos/{video_id}', video_id,
headers=headers, fatal=False, expected_status=(403, 404)) or {}
'uploader_url': r're:https?://(?:www\.)?vimeo\.com/businessofsoftware',
'uploader_id': 'businessofsoftware',
'duration': 3610,
- 'description': None,
'thumbnail': 'https://i.vimeocdn.com/video/376682406-f34043e7b766af6bef2af81366eacd6724f3fc3173179a11a97a1e26587c9529-d_1280',
},
'params': {
video = self._download_json(
api_url, video_id, headers={
'Authorization': 'jwt ' + token,
+ 'Accept': 'application/json',
}, query={
'fields': 'config_url,created_time,description,license,metadata.connections.comments.total,metadata.connections.likes.total,release_time,stats.plays',
})
jwt = viewer['jwt']
album = self._download_json(
'https://api.vimeo.com/albums/' + album_id,
- album_id, headers={'Authorization': 'jwt ' + jwt},
+ album_id, headers={'Authorization': 'jwt ' + jwt, 'Accept': 'application/json'},
query={'fields': 'description,name,privacy'})
if try_get(album, lambda x: x['privacy']['view']) == 'password':
password = self.get_param('videopassword')
'https://api.vimeo.com/albums/%s/videos' % album_id,
album_id, 'Downloading page %d' % api_page, query=query, headers={
'Authorization': 'jwt ' + authorization,
+ 'Accept': 'application/json',
})['data']
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
return
+ raise
for video in videos:
link = video.get('link')
if not link:
jwt = viewer['jwt']
album = self._download_json(
'https://api.vimeo.com/albums/' + album_id,
- album_id, headers={'Authorization': 'jwt ' + jwt},
+ album_id, headers={'Authorization': 'jwt ' + jwt, 'Accept': 'application/json'},
query={'fields': 'description,name,privacy'})
hashed_pass = None
if try_get(album, lambda x: x['privacy']['view']) == 'password':