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'),
35 IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
36 _VALID_URL = (r'https?://(?P<host>(?:www\.)?(?:%s))/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
37 % '|'.join(site for site in list(zip(*_SITES))[0]))
39 _FILE_NOT_FOUND_REGEXES = (
40 r'>(?:404 - )?File Not Found<',
41 r'>The file was removed by administrator<',
45 'url': 'http://gorillavid.in/06y9juieqpmi',
46 'md5': '5ae4a3580620380619678ee4875893ba',
50 'title': 'Rebecca Black My Moment Official Music Video Reaction-6GK87Rc8bzQ',
51 'thumbnail': r're:http://.*\.jpg',
54 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
55 'only_matching': True,
57 'url': 'http://daclips.in/3rso4kdn6f9m',
58 'md5': '1ad8fd39bb976eeb66004d3a4895f106',
62 'title': 'Micro Pig piglets ready on 16th July 2009-bG0PdrCdxUc',
63 'thumbnail': r'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': r're:http://.*\.jpg',
76 'skip': 'Video removed',
78 'url': 'http://vidto.me/ku5glz52nqe1.html',
85 'url': 'http://powerwatch.pw/duecjibvicbu',
89 'title': 'Big Buck Bunny trailer',
92 'url': 'http://xvidstage.com/e0qcnl03co6z',
96 'title': 'Chucky Prank 2015.mp4',
99 # removed by administrator
100 'url': 'http://xvidstage.com/amfy7atlkx25',
101 'only_matching': True,
103 'url': 'http://vidabc.com/i8ybqscrphfv',
105 'id': 'i8ybqscrphfv',
107 'title': 're:Beauty and the Beast 2017',
110 'skip_download': True,
113 'url': 'http://www.rapidvideo.cool/b667kprndr8w',
114 'only_matching': True,
117 def _real_extract(self, url):
118 mobj = re.match(self._VALID_URL, url)
119 video_id = mobj.group('id')
121 url = 'http://%s/%s' % (mobj.group('host'), video_id)
122 webpage = self._download_webpage(url, video_id)
124 if any(re.search(p, webpage) for p in self._FILE_NOT_FOUND_REGEXES):
125 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
127 fields = self._hidden_inputs(webpage)
129 if fields['op'] == 'download1':
130 countdown = int_or_none(self._search_regex(
131 r'<span id="countdown_str">(?:[Ww]ait)?\s*<span id="cxc">(\d+)</span>\s*(?:seconds?)?</span>',
132 webpage, 'countdown', default=None))
134 self._sleep(countdown, video_id)
136 webpage = self._download_webpage(
137 url, video_id, 'Downloading video page',
138 data=urlencode_postdata(fields), headers={
140 'Content-type': 'application/x-www-form-urlencoded',
143 title = (self._search_regex(
144 (r'style="z-index: [0-9]+;">([^<]+)</span>',
145 r'<td nowrap>([^<]+)</td>',
146 r'h4-fine[^>]*>([^<]+)<',
148 r'<h2 class="video-page-head">([^<]+)</h2>',
149 r'<h2 style="[^"]*color:#403f3d[^"]*"[^>]*>([^<]+)<'), # streamin.to
150 webpage, 'title', default=None) or self._og_search_title(
151 webpage, default=None) or video_id).strip()
153 def extract_formats(default=NO_DEFAULT):
156 r'file\s*:\s*(["\'])(?P<url>http(?:(?!\1).)+\.(?:m3u8|mp4|flv)(?:(?!\1).)*)\1',
157 r'file_link\s*=\s*(["\'])(?P<url>http(?:(?!\1).)+)\1',
158 r'addVariable\((\\?["\'])file\1\s*,\s*(\\?["\'])(?P<url>http(?:(?!\2).)+)\2\)',
159 r'<embed[^>]+src=(["\'])(?P<url>http(?:(?!\1).)+\.(?:m3u8|mp4|flv)(?:(?!\1).)*)\1'):
160 for mobj in re.finditer(regex, webpage):
161 video_url = mobj.group('url')
162 if video_url not in urls:
163 urls.append(video_url)
165 for video_url in urls:
166 if determine_ext(video_url) == 'm3u8':
167 formats.extend(self._extract_m3u8_formats(
168 video_url, video_id, 'mp4',
169 entry_protocol='m3u8_native', m3u8_id='hls',
176 if not formats and default is not NO_DEFAULT:
178 self._sort_formats(formats)
181 formats = extract_formats(default=None)
184 webpage = decode_packed_codes(self._search_regex(
185 r"(}\('(.+)',(\d+),(\d+),'[^']*\b(?:file|embed)\b[^']*'\.split\('\|'\))",
186 webpage, 'packed code'))
187 formats = extract_formats()
189 thumbnail = self._search_regex(
190 r'image\s*:\s*["\'](http[^"\']+)["\'],', webpage, 'thumbnail', default=None)
195 'thumbnail': thumbnail,