2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class XFileShareIE(InfoExtractor):
17 ('daclips.in', 'DaClips'),
18 ('filehoot.com', 'FileHoot'),
19 ('gorillavid.in', 'GorillaVid'),
20 ('movpod.in', 'MovPod'),
21 ('powerwatch.pw', 'PowerWatch'),
22 ('rapidvideo.ws', 'Rapidvideo.ws'),
23 ('thevideobee.to', 'TheVideoBee'),
24 ('vidto.me', 'Vidto'),
25 ('streamin.to', 'Streamin.To'),
28 IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
29 _VALID_URL = (r'https?://(?P<host>(?:www\.)?(?:%s))/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
30 % '|'.join(re.escape(site) for site in list(zip(*_SITES))[0]))
32 _FILE_NOT_FOUND_REGEX = r'>(?:404 - )?File Not Found<'
35 'url': 'http://gorillavid.in/06y9juieqpmi',
36 'md5': '5ae4a3580620380619678ee4875893ba',
40 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
41 'thumbnail': 're:http://.*\.jpg',
44 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
45 'only_matching': True,
47 'url': 'http://daclips.in/3rso4kdn6f9m',
48 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
52 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
53 'thumbnail': 're:http://.*\.jpg',
56 'url': 'http://movpod.in/0wguyyxi1yca',
57 'only_matching': True,
59 'url': 'http://filehoot.com/3ivfabn7573c.html',
63 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
64 'thumbnail': 're:http://.*\.jpg',
66 'skip': 'Video removed',
68 'url': 'http://vidto.me/ku5glz52nqe1.html',
75 'url': 'http://powerwatch.pw/duecjibvicbu',
79 'title': 'Big Buck Bunny trailer',
83 def _real_extract(self, url):
84 mobj = re.match(self._VALID_URL, url)
85 video_id = mobj.group('id')
87 url = 'http://%s/%s' % (mobj.group('host'), video_id)
88 webpage = self._download_webpage(url, video_id)
90 if re.search(self._FILE_NOT_FOUND_REGEX, webpage) is not None:
91 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
93 fields = self._hidden_inputs(webpage)
95 if fields['op'] == 'download1':
96 countdown = int_or_none(self._search_regex(
97 r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
98 webpage, 'countdown', default=None))
100 self._sleep(countdown, video_id)
102 post = urlencode_postdata(fields)
104 req = sanitized_Request(url, post)
105 req.add_header('Content-type', 'application/x-www-form-urlencoded')
107 webpage = self._download_webpage(req, video_id, 'Downloading video page')
109 title = (self._search_regex(
110 [r'style="z-index: [0-9]+;">([^<]+)</span>',
111 r'<td nowrap>([^<]+)</td>',
112 r'h4-fine[^>]*>([^<]+)<',
114 r'<h2 class="video-page-head">([^<]+)</h2>'],
115 webpage, 'title', default=None) or self._og_search_title(webpage)).strip()
116 video_url = self._search_regex(
117 [r'file\s*:\s*["\'](http[^"\']+)["\'],',
118 r'file_link\s*=\s*\'(https?:\/\/[0-9a-zA-z.\/\-_]+)'],
120 thumbnail = self._search_regex(
121 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
132 'thumbnail': thumbnail,