]>
Commit | Line | Data |
---|---|---|
3647136f S |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..compat import compat_urllib_request | |
5 | ||
6 | ||
7 | class ViewsterIE(InfoExtractor): | |
8 | _VALID_URL = r'http://(?:www\.)?viewster\.com/movie/(?P<id>\d+-\d+-\d+)' | |
9 | _TEST = { | |
10 | 'url': 'http://www.viewster.com/movie/1293-19341-000/hout-wood/', | |
11 | 'md5': '8f9d94b282d80c42b378dffdbb11caf3', | |
12 | 'info_dict': { | |
13 | 'id': '1293-19341-000', | |
14 | 'ext': 'flv', | |
15 | 'title': "'Hout' (Wood)", | |
16 | 'description': 'md5:925733185a9242ef96f436937683f33b', | |
17 | }, | |
18 | } | |
19 | ||
20 | _ACCEPT_HEADER = 'application/json, text/javascript, */*; q=0.01' | |
21 | ||
22 | def _real_extract(self, url): | |
23 | video_id = self._match_id(url) | |
24 | ||
25 | request = compat_urllib_request.Request( | |
26 | 'http://api.live.viewster.com/api/v1/movielink?movieid=%s&action=movierent&paymethod=fre&price=0¤cy=&language=en&subtitlelanguage=x&ischromecast=false' % video_id) | |
27 | request.add_header('Accept', self._ACCEPT_HEADER) | |
28 | ||
29 | movie_link = self._download_json( | |
30 | request, video_id, 'Downloading movie link JSON') | |
31 | ||
32 | formats = self._extract_f4m_formats( | |
33 | movie_link['url'] + '&hdcore=3.2.0&plugin=flowplayer-3.2.0.1', video_id) | |
34 | self._sort_formats(formats) | |
35 | ||
36 | request = compat_urllib_request.Request( | |
37 | 'http://api.live.viewster.com/api/v1/movie/%s' % video_id) | |
38 | request.add_header('Accept', self._ACCEPT_HEADER) | |
39 | ||
40 | movie = self._download_json( | |
41 | request, video_id, 'Downloading movie metadata JSON') | |
42 | ||
43 | title = movie.get('title') or movie['original_title'] | |
44 | description = movie.get('synopsis') | |
45 | thumbnail = movie.get('large_artwork') or movie.get('artwork') | |
46 | ||
47 | return { | |
48 | 'id': video_id, | |
49 | 'title': title, | |
50 | 'description': description, | |
51 | 'thumbnail': thumbnail, | |
52 | 'formats': formats, | |
53 | } |