From 6734e2d30deca92ab4cbadb052dc2c1892e2044e Mon Sep 17 00:00:00 2001 From: kjy00302 Date: Wed, 4 Nov 2015 18:14:45 +0900 Subject: [PATCH 1/4] added tvple infoextractor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it just working, but it needs code cleaning and user comment(구름) to subtitle converter --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/tvple.py | 98 ++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 youtube_dl/extractor/tvple.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index f98e6487e..74283c743 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -678,6 +678,7 @@ from .tvc import ( from .tvigle import TvigleIE from .tvp import TvpIE, TvpSeriesIE from .tvplay import TVPlayIE +from .tvple import tvpleIE from .tweakers import TweakersIE from .twentyfourvideo import TwentyFourVideoIE from .twentytwotracks import ( diff --git a/youtube_dl/extractor/tvple.py b/youtube_dl/extractor/tvple.py new file mode 100644 index 000000000..dbe2f31ed --- /dev/null +++ b/youtube_dl/extractor/tvple.py @@ -0,0 +1,98 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +from hashlib import sha1 +import re,zlib + +from ..compat import ( + compat_urllib_request +) + +class tvpleIE(InfoExtractor): + _VALID_URL = r'https?://(?P(?:www\.)?tvple\.com/(?P[0-9]+))' + _TEST = { + 'url': 'http://tvple.com/311090', + 'md5': '02e384fd3c3c6884e1bb997f6afd51e2', + 'info_dict': { + 'id': '311090', + 'ext': 'mp4', + 'uploader': '[디지털 드럭] 나비붙이', + 'uploader_id': 'jack1609', + 'title': '팜플렛으로 yee를 연주하는 김병만', + 'description': '자작입니다. 첫 조교..인가..? 조교라긴 애매하지만, 어쨋든 노래로 만드는 건 이번이 처음입니다.\n원본 영상 출처: https://www.youtube.com/watch?v=E4BPHBL35dE\nyee는 유튜브에 치면 원본 영상이 나오는데 다들 아시죠??? 저작권 문제가 될 경우는 지우겠습니다...\n\n병만로이드라고 불러야 하나??' + # 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 decodetvple(self,key): + """based on decompiled tvple player v2.50401""" + #1st key checker + #if((key[:4] != "feff") | (key[20:21] != "_")): + # print("error:wrong key") + + #descramble key + deckey = list(key[69:85]) + code = key[125:][::-1] + + #descrambling + hexed = code.replace(deckey[5], "g").replace(deckey[4], "h").replace(deckey[3], "i").replace(deckey[2], "j").replace(deckey[1], "k").replace(deckey[6], deckey[5]).replace(deckey[7], deckey[4]).replace(deckey[8], deckey[3]).replace(deckey[9], deckey[2]).replace(deckey[10], deckey[1]).replace("g", deckey[6]).replace("h", deckey[7]).replace("i", deckey[8]).replace("j", deckey[9]).replace("k", deckey[10]) + decoded = hexed.decode("hex") + + #2nd key checker + #if( sha1(decoded).hexdigest() != key[85:125]): + # print("error:key checksum failed") + return decoded + + #def downloadgurum(misc): + + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + playurl = self._html_search_regex(r'http://tvple.com/crossdomain.xml\n(.*)\n1', self.decodetvple(re.search(r'data-key="(.*)"', webpage).group(1)), "playurl") + playpage = self._download_webpage(playurl, "playurl_%d" % int(video_id)) + videourl = re.search("