]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/viewster.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..compat
import compat_urllib_request
7 class ViewsterIE(InfoExtractor
):
8 _VALID_URL
= r
'http://(?:www\.)?viewster\.com/movie/(?P<id>\d+-\d+-\d+)'
10 # movielink, paymethod=fre
11 'url': 'http://www.viewster.com/movie/1293-19341-000/hout-wood/',
13 'md5': '8f9d94b282d80c42b378dffdbb11caf3',
15 'id': '1293-19341-000-movie',
17 'title': "'Hout' (Wood) - Movie",
21 'id': '1293-19341-000',
22 'title': "'Hout' (Wood)",
23 'description': 'md5:925733185a9242ef96f436937683f33b',
26 # movielink, paymethod=adv
27 'url': 'http://www.viewster.com/movie/1140-11855-000/the-listening-project/',
29 'md5': '77a005453ca7396cbe3d35c9bea30aef',
31 'id': '1140-11855-000-movie',
33 'title': "THE LISTENING PROJECT - Movie",
37 'id': '1140-11855-000',
38 'title': "THE LISTENING PROJECT",
39 'description': 'md5:714421ae9957e112e672551094bf3b08',
42 # direct links, no movielink
43 'url': 'http://www.viewster.com/movie/1198-56411-000/sinister/',
45 'md5': '0307b7eac6bfb21ab0577a71f6eebd8f',
47 'id': '1198-56411-000-trailer',
49 'title': "Sinister - Trailer",
52 'md5': '80b9ee3ad69fb368f104cb5d9732ae95',
54 'id': '1198-56411-000-behind-scenes',
56 'title': "Sinister - Behind Scenes",
59 'md5': '3b3ea897ecaa91fca57a8a94ac1b15c5',
61 'id': '1198-56411-000-scene-from-movie',
63 'title': "Sinister - Scene from movie",
67 'id': '1198-56411-000',
69 'description': 'md5:014c40b0488848de9683566a42e33372',
73 _ACCEPT_HEADER
= 'application/json, text/javascript, */*; q=0.01'
75 def _real_extract(self
, url
):
76 video_id
= self
._match
_id
(url
)
78 request
= compat_urllib_request
.Request(
79 'http://api.live.viewster.com/api/v1/movie/%s' % video_id
)
80 request
.add_header('Accept', self
._ACCEPT
_HEADER
)
82 movie
= self
._download
_json
(
83 request
, video_id
, 'Downloading movie metadata JSON')
85 title
= movie
.get('title') or movie
['original_title']
86 description
= movie
.get('synopsis')
87 thumbnail
= movie
.get('large_artwork') or movie
.get('artwork')
90 for clip
in movie
['play_list']:
94 link_request
= clip
.get('link_request')
96 request
= compat_urllib_request
.Request(
97 'http://api.live.viewster.com/api/v1/movielink?movieid=%(movieid)s&action=%(action)s&paymethod=%(paymethod)s&price=%(price)s¤cy=%(currency)s&language=%(language)s&subtitlelanguage=%(subtitlelanguage)s&ischromecast=%(ischromecast)s'
99 request
.add_header('Accept', self
._ACCEPT
_HEADER
)
101 movie_link
= self
._download
_json
(
102 request
, video_id
, 'Downloading movie link JSON', fatal
=False)
105 formats
= self
._extract
_f
4m
_formats
(
106 movie_link
['url'] + '&hdcore=3.2.0&plugin=flowplayer-3.2.0.1', video_id
)
107 self
._sort
_formats
(formats
)
113 clip_url
= clip
.get('clip_data', {}).get('url')
122 'id': '%s-%s' % (video_id
, clip
['canonical_title']),
123 'title': '%s - %s' % (title
, clip
['title']),
125 entries
.append(entry
)
127 playlist
= self
.playlist_result(entries
, video_id
, title
, description
)
128 playlist
['thumbnail'] = thumbnail