projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[xhamster] Fix thumbnail extraction
[youtube-dl]
/
youtube_dl
/
extractor
/
viewster.py
diff --git
a/youtube_dl/extractor/viewster.py
b/youtube_dl/extractor/viewster.py
index 03c8736085d4701c6abc762973176280526d9bd6..cda02ba24b7cc01c317bf5d67ced5f231cfd2a80 100644
(file)
--- a/
youtube_dl/extractor/viewster.py
+++ b/
youtube_dl/extractor/viewster.py
@@
-5,11
+5,13
@@
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
compat_urllib_parse,
from ..compat import (
compat_urllib_request,
compat_urllib_parse,
+ compat_urllib_parse_unquote,
)
from ..utils import (
determine_ext,
int_or_none,
parse_iso8601,
)
from ..utils import (
determine_ext,
int_or_none,
parse_iso8601,
+ HEADRequest,
)
)
@@
-62,7
+64,6
@@
class ViewsterIE(InfoExtractor):
}]
_ACCEPT_HEADER = 'application/json, text/javascript, */*; q=0.01'
}]
_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 _download_json(self, url, video_id, note='Downloading JSON metadata', fatal=True):
request = compat_urllib_request.Request(url)
@@
-72,6
+73,10
@@
class ViewsterIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(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,
info = self._download_json(
'https://public-api.viewster.com/search/%s' % video_id,
@@
-88,7
+93,7
@@
class ViewsterIE(InfoExtractor):
self.url_result(
'http://www.viewster.com/movie/%s' % episode['OriginId'], 'Viewster')
for episode in episodes]
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)
description = info.get('Synopsis', {}).get('Detailed')
return self.playlist_result(entries, video_id, title, description)
@@
-122,7
+127,7
@@
class ViewsterIE(InfoExtractor):
synopsis = info.get('Synopsis', {})
# Prefer title outside synopsis since it's less messy
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'))
description = synopsis.get('Detailed') or info.get('Synopsis', {}).get('Short')
duration = int_or_none(info.get('Duration'))
timestamp = parse_iso8601(info.get('ReleaseDate'))