]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/xfileshare.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_parse
16 class XFileShareIE(InfoExtractor
):
17 IE_DESC
= 'XFileShare based sites: GorillaVid.in, daclips.in, movpod.in, fastvideo.in, realvid.net, filehoot.com and vidto.me'
19 https?://(?P<host>(?:www\.)?
20 (?:daclips\.in|gorillavid\.in|movpod\.in|fastvideo\.in|realvid\.net|filehoot\.com|vidto\.me))/
21 (?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:-[0-9]+x[0-9]+\.html)?
24 _FILE_NOT_FOUND_REGEX
= r
'>(?:404 - )?File Not Found<'
27 'url': 'http://gorillavid.in/06y9juieqpmi',
28 'md5': '5ae4a3580620380619678ee4875893ba',
32 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
33 'thumbnail': 're:http://.*\.jpg',
36 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
37 'only_matching': True,
39 'url': 'http://daclips.in/3rso4kdn6f9m',
40 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
44 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
45 'thumbnail': 're:http://.*\.jpg',
48 # video with countdown timeout
49 'url': 'http://fastvideo.in/1qmdn1lmsmbw',
50 'md5': '8b87ec3f6564a3108a0e8e66594842ba',
54 'title': 'Man of Steel - Trailer',
55 'thumbnail': 're:http://.*\.jpg',
58 'url': 'http://realvid.net/ctn2y6p2eviw',
59 'md5': 'b2166d2cf192efd6b6d764c18fd3710e',
64 'thumbnail': 're:http://.*\.jpg',
67 'url': 'http://movpod.in/0wguyyxi1yca',
68 'only_matching': True,
70 'url': 'http://filehoot.com/3ivfabn7573c.html',
74 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
75 'thumbnail': 're:http://.*\.jpg',
78 'url': 'http://vidto.me/ku5glz52nqe1.html',
86 def _real_extract(self
, url
):
87 mobj
= re
.match(self
._VALID
_URL
, url
)
88 video_id
= mobj
.group('id')
90 url
= 'http://%s/%s' % (mobj
.group('host'), video_id
)
91 webpage
= self
._download
_webpage
(url
, video_id
)
93 if re
.search(self
._FILE
_NOT
_FOUND
_REGEX
, webpage
) is not None:
94 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
96 fields
= self
._hidden
_inputs
(webpage
)
98 if fields
['op'] == 'download1':
99 countdown
= int_or_none(self
._search
_regex
(
100 r
'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
101 webpage
, 'countdown', default
=None))
103 self
._sleep
(countdown
, video_id
)
105 post
= compat_urllib_parse
.urlencode(encode_dict(fields
))
107 req
= sanitized_Request(url
, post
)
108 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
110 webpage
= self
._download
_webpage
(req
, video_id
, 'Downloading video page')
112 title
= (self
._search
_regex
(
113 [r
'style="z-index: [0-9]+;">([^<]+)</span>',
114 r
'<td nowrap>([^<]+)</td>',
116 r
'<h2 class="video-page-head">([^<]+)</h2>'],
117 webpage
, 'title', default
=None) or self
._og
_search
_title
(webpage
)).strip()
118 video_url
= self
._search
_regex
(
119 [r
'file\s*:\s*["\'](http
[^
"\']+)["\'],',
120 r'file_link\s
*=\s
*\'(https?
:\
/\
/[0-9a
-zA
-z
.\
/\
-_
]+)'],
122 thumbnail = self._search_regex(
123 r'image\s
*:\s
*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
134 'thumbnail': thumbnail,