]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gorillavid.py
d23e3eac1aa7a46a82d21a527d06862f245b4e29
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
18 class GorillaVidIE(InfoExtractor
):
19 IE_DESC
= 'GorillaVid.in, daclips.in, movpod.in, fastvideo.in, realvid.net and filehoot.com'
21 https?://(?P<host>(?:www\.)?
22 (?:daclips\.in|gorillavid\.in|movpod\.in|fastvideo\.in|realvid\.net|filehoot\.com))/
23 (?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:-[0-9]+x[0-9]+\.html)?
26 _FILE_NOT_FOUND_REGEX
= r
'>(?:404 - )?File Not Found<'
29 'url': 'http://gorillavid.in/06y9juieqpmi',
30 'md5': '5ae4a3580620380619678ee4875893ba',
34 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
35 'thumbnail': 're:http://.*\.jpg',
38 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
39 'only_matching': True,
41 'url': 'http://daclips.in/3rso4kdn6f9m',
42 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
46 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
47 'thumbnail': 're:http://.*\.jpg',
50 # video with countdown timeout
51 'url': 'http://fastvideo.in/1qmdn1lmsmbw',
52 'md5': '8b87ec3f6564a3108a0e8e66594842ba',
56 'title': 'Man of Steel - Trailer',
57 'thumbnail': 're:http://.*\.jpg',
60 'url': 'http://realvid.net/ctn2y6p2eviw',
61 'md5': 'b2166d2cf192efd6b6d764c18fd3710e',
66 'thumbnail': 're:http://.*\.jpg',
69 'url': 'http://movpod.in/0wguyyxi1yca',
70 'only_matching': True,
72 'url': 'http://filehoot.com/3ivfabn7573c.html',
76 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
77 'thumbnail': 're:http://.*\.jpg',
81 def _real_extract(self
, url
):
82 mobj
= re
.match(self
._VALID
_URL
, url
)
83 video_id
= mobj
.group('id')
85 url
= 'http://%s/%s' % (mobj
.group('host'), video_id
)
86 webpage
= self
._download
_webpage
(url
, video_id
)
88 if re
.search(self
._FILE
_NOT
_FOUND
_REGEX
, webpage
) is not None:
89 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
91 fields
= self
._hidden
_inputs
(webpage
)
93 if fields
['op'] == 'download1':
94 countdown
= int_or_none(self
._search
_regex
(
95 r
'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
96 webpage
, 'countdown', default
=None))
98 self
._sleep
(countdown
, video_id
)
100 post
= compat_urllib_parse
.urlencode(encode_dict(fields
))
102 req
= compat_urllib_request
.Request(url
, post
)
103 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
105 webpage
= self
._download
_webpage
(req
, video_id
, 'Downloading video page')
107 title
= self
._search
_regex
(
108 [r
'style="z-index: [0-9]+;">([^<]+)</span>', r
'<td nowrap>([^<]+)</td>', r
'>Watch (.+) '],
109 webpage
, 'title', default
=None) or self
._og
_search
_title
(webpage
)
110 video_url
= self
._search
_regex
(
111 r
'file\s*:\s*["\'](http
[^
"\']+)["\'],', webpage, 'file url
')
112 thumbnail = self._search_regex(
113 r'image\s
*:\s
*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', fatal=False)
124 'thumbnail': thumbnail,