From 62ecc8e65fd4e99fe725922427d0f8935a02ad8d Mon Sep 17 00:00:00 2001 From: Tai Chatha Date: Sun, 4 Oct 2015 15:26:43 -0400 Subject: [PATCH 1/3] Qianmo Add New Extractor --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/qianmo.py | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 youtube_dl/extractor/qianmo.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index a73a1317e..138b1ebe3 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -477,6 +477,7 @@ from .promptfile import PromptFileIE from .prosiebensat1 import ProSiebenSat1IE from .puls4 import Puls4IE from .pyvideo import PyvideoIE +from .qianmo import QianmoIE from .qqmusic import ( QQMusicIE, QQMusicSingerIE, diff --git a/youtube_dl/extractor/qianmo.py b/youtube_dl/extractor/qianmo.py new file mode 100644 index 000000000..762e58c51 --- /dev/null +++ b/youtube_dl/extractor/qianmo.py @@ -0,0 +1,48 @@ +# http://qianmo.com/bazingayue/324 +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from lxml import html +import requests + +import re + + +class QianmoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?qianmo\.com/(?P[A-Za-z]+)/(?P[0-9]+)' + _TEST = { + 'url': 'http://qianmo.com/kawaei/281', + 'info_dict': { + 'id': '281', + 'ext': 'mp4', + 'title': '[中字] Google新logo宣传片 「Google, 进化」 - 阡陌视频社区', + # TODO more properties, either as: + # * A value + # * MD5 checksum; start the string with md5: + # * A regular expression; start the string with re: + # * Any Python type (for example int or float) + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + webpage = self._download_webpage(url, video_id) + print type(webpage) + # TODO more code goes here, for example ... + title = self._html_search_regex(r'(.*?)', webpage, 'title') + print title + # postInfo = self._html_search_regex(r'postInfo =(.*?);', webpage, u'postInfo') + # regex = + video_url = self._html_search_regex(r'"urls":\["(.*?)"\],', webpage, 'url') + print video_url + print "Hanh" + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'ext': 'mp4', + # TODO more properties (see youtube_dl/extractor/common.py) + } \ No newline at end of file From 3b053a1fe1377d2d9c780720f82b3ffd22a3f35e Mon Sep 17 00:00:00 2001 From: Tai Chatha Date: Sun, 4 Oct 2015 15:27:15 -0400 Subject: [PATCH 2/3] Qianmo Add New Extractor --- youtube_dl/extractor/qianmo.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/qianmo.py b/youtube_dl/extractor/qianmo.py index 762e58c51..bad5a89ea 100644 --- a/youtube_dl/extractor/qianmo.py +++ b/youtube_dl/extractor/qianmo.py @@ -29,15 +29,10 @@ class QianmoIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - print type(webpage) - # TODO more code goes here, for example ... title = self._html_search_regex(r'(.*?)', webpage, 'title') - print title - # postInfo = self._html_search_regex(r'postInfo =(.*?);', webpage, u'postInfo') - # regex = + video_url = self._html_search_regex(r'"urls":\["(.*?)"\],', webpage, 'url') - print video_url - print "Hanh" + return { 'id': video_id, From 6be00413acb5909d31bb106764d232fc221e9715 Mon Sep 17 00:00:00 2001 From: Tai Chatha Date: Sun, 4 Oct 2015 15:57:50 -0400 Subject: [PATCH 3/3] Qianmo Add New Extractor1 --- youtube_dl/extractor/qianmo.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/qianmo.py b/youtube_dl/extractor/qianmo.py index bad5a89ea..6c921d44e 100644 --- a/youtube_dl/extractor/qianmo.py +++ b/youtube_dl/extractor/qianmo.py @@ -3,10 +3,6 @@ from __future__ import unicode_literals from .common import InfoExtractor -from lxml import html -import requests - -import re class QianmoIE(InfoExtractor):