-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
461 additions
and
1,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5bb1b3da70a69cd175cb83de1dafde41 addons.xml | ||
66eb21924d62f198cf8e0aceceedb88c addons.xml |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import sqlite3 | ||
import json | ||
import urllib | ||
conn = sqlite3.connect('test.db') | ||
|
||
c = conn.cursor() | ||
c.execute('''CREATE TABLE MJINDEX | ||
(ID INT PRIMARY KEY NOT NULL, | ||
NAME TEXT NOT NULL);''') | ||
|
||
f = open('jss', 'r') | ||
x = f.read() | ||
|
||
js = json.loads(x) | ||
for x in js: | ||
name = x.encode('utf-8') | ||
cmd = "INSERT INTO MJINDEX (ID, NAME) VALUES ({0}, \"{1}\")".format(js[x], name) | ||
print cmd | ||
c.execute(cmd) | ||
|
||
conn.commit() | ||
conn.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file renamed
BIN
+159 KB
...in.video.rrsp/plugin.video.rrsp-1.0.3.zip → ...in.video.rrsp/plugin.video.rrsp-1.0.4.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/usr/bin/env python | ||
|
||
from common import get_html, r1, match1 | ||
from json import loads | ||
import re | ||
import base64 | ||
import time | ||
|
||
def rc4(key, data): | ||
c = list(range(256)) | ||
g = 0 | ||
for j in range(256): | ||
g = (g + c[j] + ord(key[j % len(key)])) & 0xff | ||
c[j], c[g] = c[g], c[j] | ||
|
||
g = j = 0 | ||
f = '' | ||
for m in range(len(data)): | ||
j = (j + 1) & 0xff | ||
g = (g + c[j]) & 0xff | ||
c[j], c[g] = c[g], c[j] | ||
|
||
t = data[m] if isinstance(data[m], int) else ord(data[m]) | ||
f += chr(t ^ c[(c[j] + c[g]) & 0xff]) | ||
return f | ||
|
||
|
||
class ACfun(): | ||
def get_srt_json(self, id): | ||
url = 'http://danmu.aixifan.com/V2/%s' % id | ||
return get_html(url) | ||
|
||
def youku_acfun_proxy(self, vid, sign, ref): | ||
endpoint = 'http://player.acfun.cn/flash_data?vid={}&ct=85&ev=3&sign={}&time={}' | ||
url = endpoint.format(vid, sign, str(int(time.time() * 1000))) | ||
json_data = loads(get_html(url, headers=dict(referer=ref)))['data'] | ||
enc_text = base64.b64decode(json_data) | ||
dec_text = rc4(b'8bdc7e1a', enc_text).decode('utf8') | ||
youku_json = loads(dec_text) | ||
|
||
yk_streams = {} | ||
for stream in youku_json['stream']: | ||
tp = stream['stream_type'] | ||
yk_streams[tp] = [], stream['total_size'] | ||
if stream.get('segs'): | ||
for seg in stream['segs']: | ||
yk_streams[tp][0].append(seg['url']) | ||
else: | ||
yk_streams[tp] = stream['m3u8'], stream['total_size'] | ||
|
||
return yk_streams | ||
|
||
def video_from_vid(self, vid, **kwargs): | ||
"""str, str, str, bool, bool ->None | ||
Download Acfun video by vid. | ||
Call Acfun API, decide which site to use, and pass the job to its | ||
extractor. | ||
""" | ||
|
||
#first call the main parasing API | ||
info = loads(get_html('http://www.acfun.tv/video/getVideo.aspx?id=' + vid)) | ||
|
||
sourceType = info['sourceType'] | ||
|
||
#decide sourceId to know which extractor to use | ||
sourceId = info.get('sourceId', '') | ||
# danmakuId = info['danmakuId'] | ||
|
||
#call extractor decided by sourceId | ||
if sourceType == 'sina': | ||
sina_download_by_vid(sourceId) | ||
elif sourceType == 'youku': | ||
youku_download_by_vid(sourceId, **kwargs) | ||
elif sourceType == 'tudou': | ||
tudou_download_by_iid(sourceId) | ||
elif sourceType == 'qq': | ||
qq_download_by_vid(sourceId) | ||
elif sourceType == 'letv': | ||
letvcloud_download_by_vu(sourceId, '2d8c027396') | ||
elif sourceType == 'zhuzhan': | ||
#As in Jul.28.2016, Acfun is using embsig to anti hotlink so we need to pass this | ||
#In Mar. 2017 there is a dedicated ``acfun_proxy'' in youku cloud player | ||
#old code removed | ||
url = 'http://www.acfun.cn/v/ac' + vid | ||
yk_streams = self.youku_acfun_proxy(info['sourceId'], info['encode'], url) | ||
seq = ['mp4hd3', 'mp4hd2', 'mp4hd', 'flvhd', 'm3u8_flv'] | ||
for t in seq: | ||
if yk_streams.get(t): | ||
preferred = yk_streams[t] | ||
break | ||
|
||
return preferred[0] | ||
else: | ||
raise NotImplementedError(sourceType) | ||
|
||
|
||
def video_from_url(self, url, **kwargs): | ||
assert re.match(r'http://[^\.]*\.*acfun\.[^\.]+/\D/\D\D(\d+)', url) | ||
html = get_html(url) | ||
|
||
title = r1(r'data-title="([^"]+)"', html) | ||
assert title | ||
if match1(url, r'_(\d+)$'): # current P | ||
title = title + " " + r1(r'active">([^<]*)', html) | ||
|
||
vid = r1('data-vid="(\d+)"', html) | ||
up = r1('data-name="([^"]+)"', html) | ||
p_title = r1('active">([^<]+)', html) | ||
title = '%s (%s)' % (title, up) | ||
if p_title: | ||
title = '%s - %s' % (title, p_title) | ||
return self.video_from_vid(vid, **kwargs) | ||
|
||
site = ACfun() | ||
video_from_url = site.video_from_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
import urllib2 | ||
from urllib import urlencode | ||
import json | ||
import gzip | ||
import StringIO | ||
import re | ||
|
||
SERVER = "https://api.rr.tv" | ||
TOKEN = '0cd2626c822d49d5a27c4424a299dbaa' | ||
TOKEN = 'a65cb45354614c23bf3e30ca12e043d3' | ||
TOKEN = '8e575ee9b50643368d1c0792eb1a3f22' | ||
#TOKEN = '1d71c7d377bc4b81b0c607b622b84b4b' | ||
#TOKEN = "79e7dc7de5814908bc11e62972b6b819" | ||
TOKEN = '6b6cfdd3e90843c0a0914425638db7ef' | ||
FAKE_HEADERS = { | ||
"clientType": "android_RRMJ", | ||
"clientVersion": "3.6.2", | ||
"token": TOKEN, | ||
'deviceId': '861134030056126', | ||
'signature': '643c184f77372e364550e77adc0360cd', | ||
"Authentication": "RRTV 470164b995ea4aa5a53f9e5cbceded472:IxIYBj:LPWfRb:I9gvePR5R2N8muXD7NWPCj" | ||
}; | ||
|
||
|
||
UserAgent = 'PUClient/3.5.5 (iPhone; iOS 10.0.1; Scale/2.00)' | ||
UserAgent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0' | ||
|
||
def GetHttpData(url, data=None, cookie=None, headers=None): | ||
# print 'url: %s, data: %s, headers: %s' % (url, data, headers) | ||
req = urllib2.Request(url, data) | ||
req.add_header('User-Agent', UserAgent) | ||
req.add_header('Accept-encoding', 'gzip') | ||
if cookie is not None: | ||
req.add_header('Cookie', cookie) | ||
if headers is not None: | ||
for header in headers: | ||
req.add_header(header, headers[header]) | ||
|
||
response = urllib2.urlopen(req, timeout=3) | ||
httpdata = response.read() | ||
if response.headers.get('content-encoding', None) == 'gzip': | ||
httpdata = gzip.GzipFile(fileobj=StringIO.StringIO(httpdata)).read() | ||
response.close() | ||
match = re.compile('encoding=(.+?)"').findall(httpdata) | ||
if not match: | ||
match = re.compile('meta charset="(.+?)"').findall(httpdata) | ||
if match: | ||
charset = match[0].lower() | ||
if (charset != 'utf-8') and (charset != 'utf8'): | ||
httpdata = unicode(httpdata, charset).encode('utf8') | ||
# print httpdata | ||
return httpdata | ||
|
||
|
||
class RenRenMeiJu(): | ||
"""docstring for RenRenMeiJu""" | ||
|
||
def __init__(self): | ||
self.header = FAKE_HEADERS | ||
|
||
def get_json(self, api, data=None, pretty=False): | ||
headers = self.header | ||
html = GetHttpData(SERVER+api, data=data, headers=FAKE_HEADERS) | ||
s = json.loads(html) | ||
if pretty: | ||
print headers | ||
print json.dumps(s, sort_keys=True, | ||
indent=4, separators=(',', ': ')) | ||
return html | ||
|
||
def func(self, API='/v3plus', **kwargs): | ||
return self.get_json(API, data=urlencode(kwargs)) | ||
|
||
#x = GetTokenX() | ||
meiju=RenRenMeiJu() | ||
API='/v3plus/season/detail' | ||
|
||
for x in range(13000,14000): | ||
html = meiju.func(API=API,seasonId=x) | ||
js = json.loads(html) | ||
if js['code'] != '0000': | ||
print js['msg'] | ||
continue | ||
print js['data']['season']['title'], js['data']['season']['id'] | ||
|
Oops, something went wrong.