2 from __future__ import unicode_literals
6 from .common import InfoExtractor
17 class XFileShareIE(InfoExtractor):
19 ('daclips.in', 'DaClips'),
20 ('filehoot.com', 'FileHoot'),
21 ('gorillavid.in', 'GorillaVid'),
22 ('movpod.in', 'MovPod'),
23 ('powerwatch.pw', 'PowerWatch'),
24 ('rapidvideo.ws', 'Rapidvideo.ws'),
25 ('thevideobee.to', 'TheVideoBee'),
26 ('vidto.me', 'Vidto'),
27 ('streamin.to', 'Streamin.To'),
28 ('xvidstage.com', 'XVIDSTAGE'),
31 IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
32 _VALID_URL = (r'https?://(?P<host>(?:www\.)?(?:%s))/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
33 % '|'.join(re.escape(site) for site in list(zip(*_SITES))[0]))
35 _FILE_NOT_FOUND_REGEX = r'>(?:404 - )?File Not Found<'
38 'url': 'http://gorillavid.in/06y9juieqpmi',
39 'md5': '5ae4a3580620380619678ee4875893ba',
43 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
44 'thumbnail': 're:http://.*\.jpg',
47 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
48 'only_matching': True,
50 'url': 'http://daclips.in/3rso4kdn6f9m',
51 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
55 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
56 'thumbnail': 're:http://.*\.jpg',
59 'url': 'http://movpod.in/0wguyyxi1yca',
60 'only_matching': True,
62 'url': 'http://filehoot.com/3ivfabn7573c.html',
66 'title': 'youtube-dl test video \'äBaW_jenozKc.mp4.mp4',
67 'thumbnail': 're:http://.*\.jpg',
69 'skip': 'Video removed',
71 'url': 'http://vidto.me/ku5glz52nqe1.html',
78 'url': 'http://powerwatch.pw/duecjibvicbu',
82 'title': 'Big Buck Bunny trailer',
85 'url': 'http://xvidstage.com/e0qcnl03co6z',
89 'title': 'Chucky Prank 2015.mp4',
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 = urlencode_postdata(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()
127 def extract_video_url(default=NO_DEFAULT):
128 return self._search_regex(
129 (r'file\s*:\s*(["\'])(?P<url>http.+?)\1,',
130 r'file_link\s*=\s*(["\'])(?P<url>http.+?)\1',
131 r'addVariable\((\\?["\'])file\1\s*,\s*(\\?["\'])(?P<url>http.+?)\2\)',
132 r'<embed[^>]+src=(["\'])(?P<url>http.+?)\1'),
133 webpage, 'file url', default=default, group='url')
135 video_url = extract_video_url(default=None)
138 webpage = decode_packed_codes(self._search_regex(
139 r"(}\('(.+)',(\d+),(\d+),'[^']*\b(?:file|embed)\b[^']*'\.split\('\|'\))",
140 webpage, 'packed code'))
141 video_url = extract_video_url()
143 thumbnail = self._search_regex(
144 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
155 'thumbnail': thumbnail,