From b969ab48d9d06991c088b3b0bee441bda5b42ce8 Mon Sep 17 00:00:00 2001 From: Anton Larionov Date: Wed, 1 Jan 2014 17:59:54 +0400 Subject: [PATCH 1/2] Add support for jpopsuki.tv --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/jpopsukitv.py | 64 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 youtube_dl/extractor/jpopsukitv.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index a39a1e2f4..b59110b15 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -91,6 +91,7 @@ from .ivi import ( from .jeuxvideo import JeuxVideoIE from .jukebox import JukeboxIE from .justintv import JustinTVIE +from .jpopsukitv import JpopsukiIE from .kankan import KankanIE from .keezmovies import KeezMoviesIE from .kickstarter import KickStarterIE diff --git a/youtube_dl/extractor/jpopsukitv.py b/youtube_dl/extractor/jpopsukitv.py new file mode 100644 index 000000000..2def13659 --- /dev/null +++ b/youtube_dl/extractor/jpopsukitv.py @@ -0,0 +1,64 @@ +import re +from ..utils import unified_strdate +from .common import InfoExtractor + + +class JpopsukiIE(InfoExtractor): + IE_NAME = u'jpopsuki.tv' + _VALID_URL = r'https?://(?:www\.)?jpopsuki\.tv/video/(.*?)/(?P\S+)' + + _TEST = { + u'url': u'http://www.jpopsuki.tv/video/ayumi-hamasaki---evolution/00be659d23b0b40508169cdee4545771', + u'md5': u'88018c0c1a9b1387940e90ec9e7e198e', + u'file': u'00be659d23b0b40508169cdee4545771.mp4', + u'info_dict': { + u'id': u'00be659d23b0b40508169cdee4545771', + u'title': u'ayumi hamasaki - evolution', + 'description': u'Release date: 2001.01.31\r 浜崎あゆみ - evolution', + 'thumbnail': u'http://www.jpopsuki.tv/cache/89722c74d2a2ebe58bcac65321c115b2.jpg', + 'uploader': u'plama_chan', + 'uploader_id': u'404', + 'upload_date': u'20121101' + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + + video_url = 'http://www.jpopsuki.tv' + self._html_search_regex( + r'', webpage, u'video title') + description = self._html_search_regex( + r'', webpage, u'video description', flags=re.DOTALL) + thumbnail = self._html_search_regex( + r'', webpage, u'video thumbnail') + uploader = self._html_search_regex( + r'
  • from: uploaded: (.*?)
  • ', webpage, u'video upload_date') + if upload_date is not None: + upload_date = unified_strdate(upload_date) + view_count = self._html_search_regex( + r'
  • Hits: (\d*?)
  • ', webpage, u'video view_count') + comment_count = self._html_search_regex( + r'

    (\d*?) comments

    ', webpage, u'video comment_count') + + return { + 'id': video_id, + 'url': video_url, + 'title': video_title, + 'description': description, + 'thumbnail': thumbnail, + 'uploader': uploader, + 'uploader_id': uploader_id, + 'upload_date': upload_date, + 'view_count': view_count, + 'comment_count': comment_count, + } \ No newline at end of file From 4a9c9b6fdba3782e6342d43769d5dd777797d640 Mon Sep 17 00:00:00 2001 From: Anton Larionov Date: Wed, 1 Jan 2014 18:27:02 +0400 Subject: [PATCH 2/2] [jpopsuki] Add script encoding definition for python2 --- youtube_dl/extractor/jpopsukitv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/jpopsukitv.py b/youtube_dl/extractor/jpopsukitv.py index 2def13659..5e8f91d51 100644 --- a/youtube_dl/extractor/jpopsukitv.py +++ b/youtube_dl/extractor/jpopsukitv.py @@ -1,3 +1,4 @@ +# coding=utf-8 import re from ..utils import unified_strdate from .common import InfoExtractor