from ..compat import (
compat_urllib_request,
compat_urllib_parse,
+ compat_urllib_parse_unquote,
)
from ..utils import (
determine_ext,
int_or_none,
parse_iso8601,
+ HEADRequest,
)
}]
_ACCEPT_HEADER = 'application/json, text/javascript, */*; q=0.01'
- _AUTH_TOKEN = '/YqhSYsx8EaU9Bsta3ojlA=='
def _download_json(self, url, video_id, note='Downloading JSON metadata', fatal=True):
request = compat_urllib_request.Request(url)
def _real_extract(self, url):
video_id = self._match_id(url)
+ # Get 'api_token' cookie
+ self._request_webpage(HEADRequest(url), video_id)
+ cookies = self._get_cookies(url)
+ self._AUTH_TOKEN = compat_urllib_parse_unquote(cookies['api_token'].value)
info = self._download_json(
'https://public-api.viewster.com/search/%s' % video_id,
self.url_result(
'http://www.viewster.com/movie/%s' % episode['OriginId'], 'Viewster')
for episode in episodes]
- title = info.get('Title') or info['Synopsis']['Title']
+ title = (info.get('Title') or info['Synopsis']['Title']).strip()
description = info.get('Synopsis', {}).get('Detailed')
return self.playlist_result(entries, video_id, title, description)
synopsis = info.get('Synopsis', {})
# Prefer title outside synopsis since it's less messy
- title = info.get('Title') or synopsis['Title'].strip()
+ title = (info.get('Title') or synopsis['Title']).strip()
description = synopsis.get('Detailed') or info.get('Synopsis', {}).get('Short')
duration = int_or_none(info.get('Duration'))
timestamp = parse_iso8601(info.get('ReleaseDate'))