3 from .common
import InfoExtractor
12 _x
= lambda p
: xpath_with_ns(p
, {'xspf': 'http://xspf.org/ns/0/'}
)
15 class NosVideoIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?nosvideo\.com/' + \
17 r
'(?:embed/|\?v=)(?P<id>[A-Za-z0-9]{12})/?'
18 _PLAYLIST_URL
= 'http://nosvideo.com/xml/{xml_id:s}.xml'
19 _FILE_DELETED_REGEX
= r
'<b>File Not Found</b>'
21 'url': 'http://nosvideo.com/?v=mu8fle7g7rpq',
22 'md5': '6124ed47130d8be3eacae635b071e6b6',
26 'title': 'big_buck_bunny_480p_surround-fix.avi.mp4',
27 'thumbnail': r
're:^https?://.*\.jpg$',
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
37 'method_free': 'Continue to Video',
39 req
= sanitized_Request(url
, urlencode_postdata(fields
))
40 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
41 webpage
= self
._download
_webpage
(req
, video_id
,
42 'Downloading download page')
43 if re
.search(self
._FILE
_DELETED
_REGEX
, webpage
) is not None:
44 raise ExtractorError('Video %s does not exist' % video_id
,
47 xml_id
= self
._search
_regex
(r
'php\|([^\|]+)\|', webpage
, 'XML ID')
48 playlist_url
= self
._PLAYLIST
_URL
.format(xml_id
=xml_id
)
49 playlist
= self
._download
_xml
(playlist_url
, video_id
)
51 track
= playlist
.find(_x('.//xspf:track'))
54 'XML playlist is missing the \'track\' element',
56 title
= xpath_text(track
, _x('./xspf:title'), 'title')
57 url
= xpath_text(track
, _x('./xspf:file'), 'URL', fatal
=True)
58 thumbnail
= xpath_text(track
, _x('./xspf:image'), 'thumbnail')
70 'thumbnail': thumbnail
,