Changed video url to a public video
[youtube-dl] / youtube_dl / extractor / gorillavid.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8 class GorillaVidIE(InfoExtractor):
9     _VALID_URL = r'https?://(?:www.)?gorillavid.in/(?:embed-)?(?P<id>\w+)(?:\-\d+x\d+)?(?:.html)?'
10     _TEST = {
11         'url': "http://gorillavid.in/z08zf8le23c6",
12         'md5': 'c9e293ca74d46cad638e199c3f3fe604',
13         'info_dict': {
14             'id': 'z08zf8le23c6',
15             'ext': 'mp4',
16             'title': 'Say something nice',
17         }
18     }
19
20     def _real_extract(self, url):
21         mobj = re.match(self._VALID_URL, url)
22         video_id = mobj.group('id')
23
24         webpage = self._download_webpage(url, video_id)
25         title = self._html_search_regex(r"name=['\"]fname['\"]\s+value=['\"](.*?)['\"]", webpage, u"video title")
26
27         # download embed page again with cookies to get url
28         embed_url = "http://gorillavid.in/embed-{0}-960x480.html".format(video_id)
29         webpage = self._download_webpage(embed_url, video_id, note=u'Downloading webpage again (with cookie)')
30         url = self._html_search_regex(r'file:\s+["\'](http://.*?video.\w{3})["\']', webpage, url)
31
32         info_dict = {
33             'id': video_id,
34             'title': title,
35             'url': url,
36         }
37
38         return info_dict