2 from __future__ import unicode_literals
6 from .common import InfoExtractor
12 class THVideoIE(InfoExtractor):
13 _VALID_URL = r'http://(?:www\.)?thvideo\.tv/(?:v/th|mobile\.php\?cid=)(?P<id>[0-9]+)'
15 'url': 'http://thvideo.tv/v/th1987/',
16 'md5': 'fa107b1f73817e325e9433505a70db50',
20 'title': '【动画】秘封活动记录 ~ The Sealed Esoteric History.分镜稿预览',
21 'display_id': 'th1987',
22 'thumbnail': 'http://thvideo.tv/uploadfile/2014/0722/20140722013459856.jpg',
23 'description': '社团京都幻想剧团的第一个东方二次同人动画作品「秘封活动记录 ~ The Sealed Esoteric History.」 本视频是该动画第一期的分镜草稿...',
24 'upload_date': '20140722'
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id = mobj.group('id')
32 # extract download link from mobile player page
33 webpage_player = self._download_webpage(
34 'http://thvideo.tv/mobile.php?cid=%s-0' % (video_id),
35 video_id, note='Downloading video source page')
36 video_url = self._html_search_regex(
37 r'<source src="(.*?)" type', webpage_player, 'video url')
39 # extract video info from main page
40 webpage = self._download_webpage(
41 'http://thvideo.tv/v/th%s' % (video_id), video_id)
42 title = self._og_search_title(webpage)
43 display_id = 'th%s' % video_id
44 thumbnail = self._og_search_thumbnail(webpage)
45 description = self._og_search_description(webpage)
46 upload_date = unified_strdate(self._html_search_regex(
47 r'span itemprop="datePublished" content="(.*?)">', webpage,
48 'upload date', fatal=False))
55 'display_id': display_id,
56 'thumbnail': thumbnail,
57 'description': description,
58 'upload_date': upload_date