projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
18b4e9e
)
[ivi] Modernize
author
Sergey M․
<dstftw@gmail.com>
Wed, 28 Jan 2015 17:58:14 +0000
(23:58 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Wed, 28 Jan 2015 17:58:14 +0000
(23:58 +0600)
youtube_dl/extractor/ivi.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/ivi.py
b/youtube_dl/extractor/ivi.py
index 7a400323dc4df3807057a77b25f7401ce5e2a3b8..e825944443392153d8a0d456f5ad5dc80b2c9f77 100644
(file)
--- a/
youtube_dl/extractor/ivi.py
+++ b/
youtube_dl/extractor/ivi.py
@@
-16,7
+16,7
@@
from ..utils import (
class IviIE(InfoExtractor):
IE_DESC = 'ivi.ru'
IE_NAME = 'ivi'
class IviIE(InfoExtractor):
IE_DESC = 'ivi.ru'
IE_NAME = 'ivi'
- _VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?:[^/]+/)?|video/player\?.*?videoId=)(?P<
video
id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?:[^/]+/)?|video/player\?.*?videoId=)(?P<id>\d+)'
_TESTS = [
# Single movie
_TESTS = [
# Single movie
@@
-63,29
+63,34
@@
class IviIE(InfoExtractor):
return int(m.group('commentcount')) if m is not None else 0
def _real_extract(self, url):
return int(m.group('commentcount')) if m is not None else 0
def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
- video_id = mobj.group('videoid')
+ video_id = self._match_id(url)
api_url = 'http://api.digitalaccess.ru/api/json/'
api_url = 'http://api.digitalaccess.ru/api/json/'
- data = {'method': 'da.content.get',
- 'params': [video_id, {'site': 's183',
- 'referrer': 'http://www.ivi.ru/watch/%s' % video_id,
- 'contentid': video_id
- }
- ]
+ data = {
+ 'method': 'da.content.get',
+ 'params': [
+ video_id, {
+ 'site': 's183',
+ 'referrer': 'http://www.ivi.ru/watch/%s' % video_id,
+ 'contentid': video_id
}
}
+ ]
+ }
request = compat_urllib_request.Request(api_url, json.dumps(data))
request = compat_urllib_request.Request(api_url, json.dumps(data))
- video_json_page = self._download_webpage(request, video_id, 'Downloading video JSON')
+ video_json_page = self._download_webpage(
+ request, video_id, 'Downloading video JSON')
video_json = json.loads(video_json_page)
if 'error' in video_json:
error = video_json['error']
if error['origin'] == 'NoRedisValidData':
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
video_json = json.loads(video_json_page)
if 'error' in video_json:
error = video_json['error']
if error['origin'] == 'NoRedisValidData':
raise ExtractorError('Video %s does not exist' % video_id, expected=True)
- raise ExtractorError('Unable to download video %s: %s' % (video_id, error['message']), expected=True)
+ raise ExtractorError(
+ 'Unable to download video %s: %s' % (video_id, error['message']),
+ expected=True)
result = video_json['result']
result = video_json['result']