]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/jpopsukitv.py
debian/control: Add recommends on aria2 | wget | curl to use external downloaders.
[youtubedl] / youtube_dl / extractor / jpopsukitv.py
1 # coding=utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 int_or_none,
7 unified_strdate,
8 )
9
10
11 class JpopsukiIE(InfoExtractor):
12 IE_NAME = 'jpopsuki.tv'
13 _VALID_URL = r'https?://(?:www\.)?jpopsuki\.tv/(?:category/)?video/[^/]+/(?P<id>\S+)'
14
15 _TEST = {
16 'url': 'http://www.jpopsuki.tv/video/ayumi-hamasaki---evolution/00be659d23b0b40508169cdee4545771',
17 'md5': '88018c0c1a9b1387940e90ec9e7e198e',
18 'info_dict': {
19 'id': '00be659d23b0b40508169cdee4545771',
20 'ext': 'mp4',
21 'title': 'ayumi hamasaki - evolution',
22 'description': 'Release date: 2001.01.31\r\n浜崎あゆみ - evolution',
23 'thumbnail': 'http://www.jpopsuki.tv/cache/89722c74d2a2ebe58bcac65321c115b2.jpg',
24 'uploader': 'plama_chan',
25 'uploader_id': '404',
26 'upload_date': '20121101'
27 }
28 }
29
30 def _real_extract(self, url):
31 video_id = self._match_id(url)
32
33 webpage = self._download_webpage(url, video_id)
34
35 video_url = 'http://www.jpopsuki.tv' + self._html_search_regex(
36 r'<source src="(.*?)" type', webpage, 'video url')
37
38 video_title = self._og_search_title(webpage)
39 description = self._og_search_description(webpage)
40 thumbnail = self._og_search_thumbnail(webpage)
41 uploader = self._html_search_regex(
42 r'<li>from: <a href="/user/view/user/(.*?)/uid/',
43 webpage, 'video uploader', fatal=False)
44 uploader_id = self._html_search_regex(
45 r'<li>from: <a href="/user/view/user/\S*?/uid/(\d*)',
46 webpage, 'video uploader_id', fatal=False)
47 upload_date = unified_strdate(self._html_search_regex(
48 r'<li>uploaded: (.*?)</li>', webpage, 'video upload_date',
49 fatal=False))
50 view_count_str = self._html_search_regex(
51 r'<li>Hits: ([0-9]+?)</li>', webpage, 'video view_count',
52 fatal=False)
53 comment_count_str = self._html_search_regex(
54 r'<h2>([0-9]+?) comments</h2>', webpage, 'video comment_count',
55 fatal=False)
56
57 return {
58 'id': video_id,
59 'url': video_url,
60 'title': video_title,
61 'description': description,
62 'thumbnail': thumbnail,
63 'uploader': uploader,
64 'uploader_id': uploader_id,
65 'upload_date': upload_date,
66 'view_count': int_or_none(view_count_str),
67 'comment_count': int_or_none(comment_count_str),
68 }