4 from .common import InfoExtractor
7 class NineGagIE(InfoExtractor):
9 _VALID_URL = r'^https?://(?:www\.)?9gag\.tv/v/(?P<id>[0-9]+)'
12 u"url": u"http://9gag.tv/v/1912",
15 u"description": u"This 3-minute video will make you smile and then make you feel untalented and insignificant. Anyway, you should share this awesomeness. (Thanks, Dino!)",
16 u"title": u"\"People Are Awesome 2013\" Is Absolutely Awesome"
18 u'add_ie': [u'Youtube']
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23 video_id = mobj.group('id')
25 webpage = self._download_webpage(url, video_id)
26 data_json = self._html_search_regex(r'''(?x)
27 <div\s*id="tv-video"\s*data-video-source="youtube"\s*
28 data-video-meta="([^"]+)"''', webpage, u'video metadata')
30 data = json.loads(data_json)
33 '_type': 'url_transparent',
34 'url': data['youtubeVideoId'],
37 'title': data['title'],
38 'description': data['description'],
39 'view_count': int(data['view_count']),
40 'like_count': int(data['statistic']['like']),
41 'dislike_count': int(data['statistic']['dislike']),
42 'thumbnail': data['thumbnail_url'],