2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class XFileShareIE(InfoExtractor):
16 IE_DESC = 'XFileShare based sites: GorillaVid.in, daclips.in, movpod.in, fastvideo.in, realvid.net, filehoot.com and vidto.me'
18 https?://(?P<host>(?:www\.)?
19 (?:daclips\.in|gorillavid\.in|movpod\.in|fastvideo\.in|realvid\.net|filehoot\.com|vidto\.me|powerwatch\.pw))/
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 'only_matching': True,
38 'url': 'http://daclips.in/3rso4kdn6f9m',
39 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
43 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
44 'thumbnail': 're:http://.*\.jpg',
47 # video with countdown timeout
48 'url': 'http://fastvideo.in/1qmdn1lmsmbw',
49 'md5': '8b87ec3f6564a3108a0e8e66594842ba',
53 'title': 'Man of Steel - Trailer',
54 'thumbnail': 're:http://.*\.jpg',
57 'url': 'http://realvid.net/ctn2y6p2eviw',
58 'md5': 'b2166d2cf192efd6b6d764c18fd3710e',
63 'thumbnail': 're:http://.*\.jpg',
66 'url': 'http://movpod.in/0wguyyxi1yca',
67 'only_matching': True,
69 'url': 'http://filehoot.com/3ivfabn7573c.html',
73 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
74 'thumbnail': 're:http://.*\.jpg',
77 'url': 'http://vidto.me/ku5glz52nqe1.html',
84 'url': 'http://powerwatch.pw/duecjibvicbu',
88 'title': 'Big Buck Bunny trailer',
92 def _real_extract(self, url):
93 mobj = re.match(self._VALID_URL, url)
94 video_id = mobj.group('id')
96 url = 'http://%s/%s' % (mobj.group('host'), video_id)
97 webpage = self._download_webpage(url, video_id)
99 if re.search(self._FILE_NOT_FOUND_REGEX, webpage) is not None:
100 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
102 fields = self._hidden_inputs(webpage)
104 if fields['op'] == 'download1':
105 countdown = int_or_none(self._search_regex(
106 r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
107 webpage, 'countdown', default=None))
109 self._sleep(countdown, video_id)
111 post = urlencode_postdata(fields)
113 req = sanitized_Request(url, post)
114 req.add_header('Content-type', 'application/x-www-form-urlencoded')
116 webpage = self._download_webpage(req, video_id, 'Downloading video page')
118 title = (self._search_regex(
119 [r'style="z-index: [0-9]+;">([^<]+)</span>',
120 r'<td nowrap>([^<]+)</td>',
121 r'h4-fine[^>]*>([^<]+)<',
123 r'<h2 class="video-page-head">([^<]+)</h2>'],
124 webpage, 'title', default=None) or self._og_search_title(webpage)).strip()
125 video_url = self._search_regex(
126 [r'file\s*:\s*["\'](http[^"\']+)["\'],',
127 r'file_link\s*=\s*\'(https?:\/\/[0-9a-zA-z.\/\-_]+)'],
129 thumbnail = self._search_regex(
130 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
141 'thumbnail': thumbnail,