]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gorillavid.py
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
11 compat_urllib_request
,
15 class GorillaVidIE(InfoExtractor
):
16 IE_DESC
= 'GorillaVid.in, daclips.in and movpod.in'
18 https?://(?P<host>(?:www\.)?
19 (?:daclips\.in|gorillavid\.in|movpod\.in))/
20 (?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:-[0-9]+x[0-9]+\.html)?
23 _FILE_NOT_FOUND_REGEX
= r
'>(?:404 - )?File Not Found<'
26 'url': 'http://gorillavid.in/06y9juieqpmi',
27 'md5': '5ae4a3580620380619678ee4875893ba',
31 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
32 'thumbnail': 're:http://.*\.jpg',
35 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
36 'md5': 'c9e293ca74d46cad638e199c3f3fe604',
40 'title': 'Say something nice',
41 'thumbnail': 're:http://.*\.jpg',
44 'url': 'http://daclips.in/3rso4kdn6f9m',
45 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
49 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
50 'thumbnail': 're:http://.*\.jpg',
53 'url': 'http://movpod.in/0wguyyxi1yca',
54 'only_matching': True,
57 def _real_extract(self
, url
):
58 mobj
= re
.match(self
._VALID
_URL
, url
)
59 video_id
= mobj
.group('id')
61 webpage
= self
._download
_webpage
('http://%s/%s' % (mobj
.group('host'), video_id
), video_id
)
63 if re
.search(self
._FILE
_NOT
_FOUND
_REGEX
, webpage
) is not None:
64 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
66 fields
= dict(re
.findall(r
'''(?x)<input\s+
73 if fields
['op'] == 'download1':
74 post
= compat_urllib_parse
.urlencode(fields
)
76 req
= compat_urllib_request
.Request(url
, post
)
77 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
79 webpage
= self
._download
_webpage
(req
, video_id
, 'Downloading video page')
81 title
= self
._search
_regex
(r
'style="z-index: [0-9]+;">([^<]+)</span>', webpage
, 'title')
82 video_url
= self
._search
_regex
(r
'file\s*:\s*\'(http
[^
\']+)\',', webpage, 'file url
')
83 thumbnail = self._search_regex(r'image\s
*:\s
*\'(http
[^
\']+)\',', webpage, 'thumbnail
', fatal=False)
88 'ext
': determine_ext(video_url),
95 'thumbnail
': thumbnail,