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|powerwatch\.pw))/
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',
85 'url': 'http://powerwatch.pw/duecjibvicbu',
89 'title': 'Big Buck Bunny trailer',
93 def _real_extract(self, url):
94 mobj = re.match(self._VALID_URL, url)
95 video_id = mobj.group('id')
97 url = 'http://%s/%s' % (mobj.group('host'), video_id)
98 webpage = self._download_webpage(url, video_id)
100 if re.search(self._FILE_NOT_FOUND_REGEX, webpage) is not None:
101 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
103 fields = self._hidden_inputs(webpage)
105 if fields['op'] == 'download1':
106 countdown = int_or_none(self._search_regex(
107 r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
108 webpage, 'countdown', default=None))
110 self._sleep(countdown, video_id)
112 post = compat_urllib_parse.urlencode(encode_dict(fields))
114 req = sanitized_Request(url, post)
115 req.add_header('Content-type', 'application/x-www-form-urlencoded')
117 webpage = self._download_webpage(req, video_id, 'Downloading video page')
119 title = (self._search_regex(
120 [r'style="z-index: [0-9]+;">([^<]+)</span>',
121 r'<td nowrap>([^<]+)</td>',
122 r'h4-fine[^>]*>([^<]+)<',
124 r'<h2 class="video-page-head">([^<]+)</h2>'],
125 webpage, 'title', default=None) or self._og_search_title(webpage)).strip()
126 video_url = self._search_regex(
127 [r'file\s*:\s*["\'](http[^"\']+)["\'],',
128 r'file_link\s*=\s*\'(https?:\/\/[0-9a-zA-z.\/\-_]+)'],
130 thumbnail = self._search_regex(
131 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
142 'thumbnail': thumbnail,