1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
6 from .common import InfoExtractor
10 compat_urllib_request,
14 class GorillaVidIE(InfoExtractor):
15 IE_DESC = 'GorillaVid.in and daclips.in'
18 (?:daclips\.in|gorillavid\.in)/
19 (?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:-[0-9]+x[0-9]+\.html)?
23 'url': 'http://gorillavid.in/06y9juieqpmi',
24 'md5': '5ae4a3580620380619678ee4875893ba',
28 'title': 'Rebecca Black My Moment Official Music Video Reaction',
29 'thumbnail': 're:http://.*\.jpg',
32 'url': 'http://gorillavid.in/embed-z08zf8le23c6-960x480.html',
33 'md5': 'c9e293ca74d46cad638e199c3f3fe604',
37 'title': 'Say something nice',
38 'thumbnail': 're:http://.*\.jpg',
41 'url': 'http://daclips.in/3rso4kdn6f9m',
45 'title': 'Micro Pig piglets ready on 16th July 2009',
46 'thumbnail': 're:http://.*\.jpg',
50 def _real_extract(self, url):
51 mobj = re.match(self._VALID_URL, url)
52 video_id = mobj.group('id')
54 webpage = self._download_webpage(url, video_id)
56 fields = dict(re.findall(r'''(?x)<input\s+
63 if fields['op'] == 'download1':
64 post = compat_urllib_parse.urlencode(fields)
66 req = compat_urllib_request.Request(url, post)
67 req.add_header('Content-type', 'application/x-www-form-urlencoded')
69 webpage = self._download_webpage(req, video_id, 'Downloading video page')
71 title = self._search_regex(r'style="z-index: [0-9]+;">([0-9a-zA-Z ]+)(?:-.+)?</span>', webpage, 'title')
72 thumbnail = self._search_regex(r'image:\'(http[^\']+)\',', webpage, 'thumbnail')
73 url = self._search_regex(r'file: \'(http[^\']+)\',', webpage, 'file url')
78 'ext': determine_ext(url),
85 'thumbnail': thumbnail,