2 from __future__ import unicode_literals
6 from .common import InfoExtractor
17 class XFileShareIE(InfoExtractor):
19 (r'daclips\.(?:in|com)', 'DaClips'),
20 (r'filehoot\.com', 'FileHoot'),
21 (r'gorillavid\.(?:in|com)', 'GorillaVid'),
22 (r'movpod\.in', 'MovPod'),
23 (r'powerwatch\.pw', 'PowerWatch'),
24 (r'rapidvideo\.ws', 'Rapidvideo.ws'),
25 (r'thevideobee\.to', 'TheVideoBee'),
26 (r'vidto\.me', 'Vidto'),
27 (r'streamin\.to', 'Streamin.To'),
28 (r'xvidstage\.com', 'XVIDSTAGE'),
29 (r'vidabc\.com', 'Vid ABC'),
30 (r'vidbom\.com', 'VidBom'),
31 (r'vidlo\.us', 'vidlo'),
32 (r'rapidvideo\.(?:cool|org)', 'RapidVideo.TV'),
33 (r'fastvideo\.me', 'FastVideo.me'),
36 IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
37 _VALID_URL = (r'https?://(?P<host>(?:www\.)?(?:%s))/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
38 % '|'.join(site for site in list(zip(*_SITES))[0]))
40 _FILE_NOT_FOUND_REGEXES = (
41 r'>(?:404 - )?File Not Found<',
42 r'>The file was removed by administrator<',
46 'url': 'http://gorillavid.in/06y9juieqpmi',
47 'md5': '5ae4a3580620380619678ee4875893ba',
51 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
52 'thumbnail': r're:http://.*\.jpg',
55 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
56 'only_matching': True,
58 'url': 'http://daclips.in/3rso4kdn6f9m',
59 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
63 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
64 'thumbnail': r'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': r're:http://.*\.jpg',
77 'skip': 'Video removed',
79 'url': 'http://vidto.me/ku5glz52nqe1.html',
86 'url': 'http://powerwatch.pw/duecjibvicbu',
90 'title': 'Big Buck Bunny trailer',
93 'url': 'http://xvidstage.com/e0qcnl03co6z',
97 'title': 'Chucky Prank 2015.mp4',
100 # removed by administrator
101 'url': 'http://xvidstage.com/amfy7atlkx25',
102 'only_matching': True,
104 'url': 'http://vidabc.com/i8ybqscrphfv',
106 'id': 'i8ybqscrphfv',
108 'title': 're:Beauty and the Beast 2017',
111 'skip_download': True,
114 'url': 'http://www.rapidvideo.cool/b667kprndr8w',
115 'only_matching': True,
117 'url': 'http://www.fastvideo.me/k8604r8nk8sn/FAST_FURIOUS_8_-_Trailer_italiano_ufficiale.mp4.html',
118 'only_matching': True
122 def _extract_urls(webpage):
125 for mobj in re.finditer(
126 r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:%s)/embed-[0-9a-zA-Z]+.*?)\1'
127 % '|'.join(site for site in list(zip(*XFileShareIE._SITES))[0]),
130 def _real_extract(self, url):
131 mobj = re.match(self._VALID_URL, url)
132 video_id = mobj.group('id')
134 url = 'http://%s/%s' % (mobj.group('host'), video_id)
135 webpage = self._download_webpage(url, video_id)
137 if any(re.search(p, webpage) for p in self._FILE_NOT_FOUND_REGEXES):
138 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
140 fields = self._hidden_inputs(webpage)
142 if fields['op'] == 'download1':
143 countdown = int_or_none(self._search_regex(
144 r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
145 webpage, 'countdown', default=None))
147 self._sleep(countdown, video_id)
149 webpage = self._download_webpage(
150 url, video_id, 'Downloading video page',
151 data=urlencode_postdata(fields), headers={
153 'Content-type': 'application/x-www-form-urlencoded',
156 title = (self._search_regex(
157 (r'style="z-index: [0-9]+;">([^<]+)</span>',
158 r'<td nowrap>([^<]+)</td>',
159 r'h4-fine[^>]*>([^<]+)<',
161 r'<h2 class="video-page-head">([^<]+)</h2>',
162 r'<h2 style="[^"]*color:#403f3d[^"]*"[^>]*>([^<]+)<'), # streamin.to
163 webpage, 'title', default=None) or self._og_search_title(
164 webpage, default=None) or video_id).strip()
166 def extract_formats(default=NO_DEFAULT):
169 r'(?:file|src)\s*:\s*(["\'])(?P<url>http(?:(?!\1).)+\.(?:m3u8|mp4|flv)(?:(?!\1).)*)\1',
170 r'file_link\s*=\s*(["\'])(?P<url>http(?:(?!\1).)+)\1',
171 r'addVariable\((\\?["\'])file\1\s*,\s*(\\?["\'])(?P<url>http(?:(?!\2).)+)\2\)',
172 r'<embed[^>]+src=(["\'])(?P<url>http(?:(?!\1).)+\.(?:m3u8|mp4|flv)(?:(?!\1).)*)\1'):
173 for mobj in re.finditer(regex, webpage):
174 video_url = mobj.group('url')
175 if video_url not in urls:
176 urls.append(video_url)
178 for video_url in urls:
179 if determine_ext(video_url) == 'm3u8':
180 formats.extend(self._extract_m3u8_formats(
181 video_url, video_id, 'mp4',
182 entry_protocol='m3u8_native', m3u8_id='hls',
189 if not formats and default is not NO_DEFAULT:
191 self._sort_formats(formats)
194 formats = extract_formats(default=None)
197 webpage = decode_packed_codes(self._search_regex(
198 r"(}\('(.+)',(\d+),(\d+),'[^']*\b(?:file|embed)\b[^']*'\.split\('\|'\))",
199 webpage, 'packed code'))
200 formats = extract_formats()
202 thumbnail = self._search_regex(
203 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
208 'thumbnail': thumbnail,