]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/internetvideoarchive.py
45add007fd99c8bd80f16c1becfb42cf403d45d5
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
15 class InternetVideoArchiveIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://video\.internetvideoarchive\.net/(?:player|flash/players)/.*?\?.*?publishedid.*?'
19 'url': 'http://video.internetvideoarchive.net/player/6/configuration.ashx?customerid=69249&publishedid=194487&reporttag=vdbetatitle&playerid=641&autolist=0&domain=www.videodetective.com&maxrate=high&minrate=low&socialplayer=false',
23 'title': 'KICK-ASS 2',
24 'description': 'md5:c189d5b7280400630a1d3dd17eaa8d8a',
28 'skip_download': True,
33 def _build_json_url(query
):
34 return 'http://video.internetvideoarchive.net/player/6/configuration.ashx?' + query
37 def _build_xml_url(query
):
38 return 'http://video.internetvideoarchive.net/flash/players/flashconfiguration.aspx?' + query
40 def _real_extract(self
, url
):
41 query
= compat_urlparse
.urlparse(url
).query
42 query_dic
= compat_parse_qs(query
)
43 video_id
= query_dic
['publishedid'][0]
46 configuration
= self
._download
_json
(url
, video_id
)
48 # There are multiple videos in the playlist whlie only the first one
49 # matches the video played in browsers
50 video_info
= configuration
['playlist'][0]
53 for source
in video_info
['sources']:
54 file_url
= source
['file']
55 if determine_ext(file_url
) == 'm3u8':
56 formats
.extend(self
._extract
_m
3u8_formats
(
57 file_url
, video_id
, ext
='mp4', m3u8_id
='hls'))
63 if source
.get('label') and source
['label'][-4:] == ' kbs':
64 tbr
= int_or_none(source
['label'][:-4])
67 'format_id': 'http-%d' % tbr
,
69 formats
.append(a_format
)
71 self
._sort
_formats
(formats
)
73 title
= video_info
['title']
74 description
= video_info
.get('description')
75 thumbnail
= video_info
.get('image')
77 configuration
= self
._download
_xml
(url
, video_id
)
79 'url': xpath_text(configuration
, './file', 'file URL', fatal
=True),
81 thumbnail
= xpath_text(configuration
, './image', 'thumbnail')
82 title
= 'InternetVideoArchive video %s' % video_id
89 'thumbnail': thumbnail
,
90 'description': description
,