1 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class NineGagIE(InfoExtractor):
11 _VALID_URL = r'^https?://(?:www\.)?9gag\.tv/v/(?P<id>[0-9]+)'
14 "url": "http://9gag.tv/v/1912",
17 "description": "This 3-minute video will make you smile and then make you feel untalented and insignificant. Anyway, you should share this awesomeness. (Thanks, Dino!)",
18 "title": "\"People Are Awesome 2013\" Is Absolutely Awesome",
20 "thumbnail": "re:^https?://",
25 def _real_extract(self, url):
26 mobj = re.match(self._VALID_URL, url)
27 video_id = mobj.group('id')
29 webpage = self._download_webpage(url, video_id)
31 youtube_id = self._html_search_regex(
32 r'(?s)id="jsid-video-post-container".*?data-external-id="([^"]+)"',
34 description = self._html_search_regex(
35 r'(?s)<div class="video-caption">.*?<p>(.*?)</p>', webpage,
36 'description', fatal=False)
37 view_count_str = self._html_search_regex(
38 r'<p><b>([0-9][0-9,]*)</b> views</p>', webpage, 'view count',
41 None if view_count_str is None
42 else int(view_count_str.replace(',', '')))
45 '_type': 'url_transparent',
49 'title': self._og_search_title(webpage),
50 'description': description,
51 'view_count': view_count,
52 'thumbnail': self._og_search_thumbnail(webpage),