-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathflaskBljxDz.py
More file actions
1422 lines (1317 loc) · 56 KB
/
Copy pathflaskBljxDz.py
File metadata and controls
1422 lines (1317 loc) · 56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : flaskBljxDz.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2021/11/6
# pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# pip3 install -r requirements.txt -t .
import json
import time
import datetime
from urllib.parse import urljoin,unquote
import ujson
from flask import Flask, jsonify, request,redirect,make_response
import requests
import re
import execjs
import os
from lxml import etree
from base64 import b64encode,b64decode
import base64
import asyncio,aiohttp
# import json
import random
import sys
import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
from concurrent.futures._base import TimeoutError
# D:\soft\python\368\Lib\subprocess.py 将init的编码encoding改成utf-8
app = Flask(__name__)
app.config["JSON_AS_ASCII"] = False # jsonify返回的中文正常显示
MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'
PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
UA = 'Mozilla/5.0'
headers = {
'Referer': 'https://www.bilibili.com/video',
'user-agent': UA,
}
# # 你的年度大会员
# appkey = ''
# access_key = ''
# # 云函数接口key
# Akey = ''
def genSecret():
"""
生成道长解析动态密码
:return:
"""
# 服务器时间要加8个小时
now = datetime.datetime.now()+datetime.timedelta(hours=8)
secret = abs(now.hour-now.minute)*3+now.day*10
return secret
need_secret = False # 全部动态密码
# 道长自己的年度大会员
appkey = '1d8b6e7d45233436'
# access_key = '006f56287f2c709e0c9a3c8f34bb5eb1'
access_key = '9cad220c014c7b6e7fb2854fa21b8981'
Akey = 'daozhangyyds'
#随机json
sjfreeUrls = ['https://jhjx.ptygx.com/tyjx.php/?url=',
'http://m.auuyruyc.com/json/1194447576.php/?url=',
'http://jx.kmys.top:1080/api/?key=JMXZuIOr8yr99oB13N&url=',
'https://json.1920i.com/home/api?type=ys&uid=1605291&key=acfhimortLNQSW0478&url=',
'https://973.cuan.la:5901/973/api/api_best.php?pltfrom=1100&key=973&url=',
]
#随机html
sjUrl = ['http://47.95.28.242/jx/renrenmi/analysis.php?v=',
'http://jiexi.xbjxw.top/player/analysis.php?v=']
fast_time_out = 5
slow_time_out = 8
async def fetch_async(url):
# 教程来源 https://www.cnblogs.com/ssyfj/p/9222342.html
async with aiohttp.ClientSession() as session: #协程嵌套,只需要处理最外层协程即可fetch_async
try:
async with session.get(url,headers=headers,timeout=fast_time_out) as r:
reponse = await r.text(encoding="utf-8") # 或者直接await r.read()不编码,直接读取,适合于图像等无法编码文件
try:
reponse = ujson.loads(reponse)
except Exception as e:
# print(f"请求 {url} 出错:{e}")
reponse = None
finally:
return reponse
except TimeoutError:
# print(f'超时:{url}')
return None
def atob(encodeStr):
"""
base64解码
:param encodeStr:
:return:
"""
return base64.b64decode(encodeStr.encode("utf8")).decode("latin1")
def btoa(Str):
"""
base64编码
:param Str:
:return:
"""
return base64.b64encode(Str.encode("latin1")).decode("utf8")
def mx_jiexi():
info_list = [
# 'http://www.jjsvip.cc/mogai_api.php/v1.vod/detail?vod_id=178715&token=',#锤子,再见时光
# 'https://app.linzhiyuan.xyz/xgapp.php/v1/video_detail?id=12165&token=',#5060,王牌杀手
# 'http://api.xiaoysw.com/api.php/v1.vod/detail?vod_id=102214&token=',#小极影视,烧烤之王
# 'http://3ketv.com/mogai_api.php/v1.vod/detail?vod_id=36534&token=',#小蜻蜓,龙虎风云会
# 'http://xs.78tv.cc/mogai_api.php/v1.vod/detail?vod_id=395876&token=',#悠悠影院,王牌杀手
'https://tv.jindcloud.com/api.php/v1.vod/detail?vod_id=4056&token=',#扶风,筋斗云
]
tasks = [fetch_async(url) for url in info_list]
new_loop = asyncio.new_event_loop()
asyncio.set_event_loop(new_loop)
event_loop = asyncio.get_event_loop()
results = event_loop.run_until_complete(asyncio.gather(*tasks))
event_loop.close()
results = list(filter(lambda x:x,results))
jxs = []
for ret in results:
# print(ret)
# r = re.search('type=ys&uid=(.*?)&key=(.*?)&url=',f'{ret}', re.S).groups()
r = re.search('https://(.*?)byteamone(.*?)key=(.*?)&url=,',f'{ret}', re.S).groups()
# print(r)
# if r and len(r) == 2:
# jxs.append(f"https://vip.mengx.vip/home/api?type=ys&uid={r[0]}&key={r[1]}&url=")
if r and r[-1]:
jxs.append(f"https://vip.byteamone.cn/api/?key={r[-1]}&url=")
jx = random.choice(jxs) if len(jxs)>0 else ''
# print(jxs)
# print(jx)
return jx
@app.route("/",methods=['GET'])
def index():
lists = '蓝莓影视|哔哩哔哩|咪咕|腾讯|爱西瓜|萌新(时好时坏)|淡了(蛋蛋)|影视工厂|扶风买|融兴|淘影|迪迪|奈落麒麟|挚爱江湖|七哥|多多|麒麟道长(麒麟买)|随机免费json(sjfree)|随机免费html(sjfree2)'.split('|')
tips = ''
for i in range(1,len(lists)+1):
tips+=f'{i}.{lists[i-1]}\n'
msg = f"""
欢迎使用b站1080p视频解析,道长海阔视界专用
目前已经自建以下线路\n"""+tips
html = "<p>" + msg.replace("\n", "<br>") + "</p><p>特别鸣谢!!!大佬提供的融兴,扶风,淘影key,道长魔断专用,请勿盗用</p>"
return html
@app.route("/plugin",methods=['GET'])
def plugin():
# name=道长影视模板.js
args = request.args
name = args.get('name')
# if not name or not (name.endswith('.js') or name.endswith('.txt') or name.endswith('.json')):
if not name or not name.split('.')[-1] in ['js','txt','py','json']:
return jsonify({'code': -2, 'msg': f'非法威胁,未指定文件名。必须包含js|txt|json|py'})
try:
return toJs(name)
except Exception as e:
return jsonify({'code': -2, 'msg': f'非法猥亵\n{e}'})
@app.route("/xmftp",methods=['GET'])
def xmftp():
# name=道长影视模板.js
args = request.args
url = args.get('url')
# if not name or not (name.endswith('.js') or name.endswith('.txt') or name.endswith('.json')):
if not url or not url.startswith('http'):
return jsonify({'code': -2, 'msg': f'无效链接{url},必须是http开头'})
value = xmftp_jiexi(url)
# print(value)
# headers = [('Content-Type', 'text/plain;charset=utf-8')]
response = make_response(value)
response.headers['Content-Type'] = 'text/plain;charset=utf-8'
return response
def xmftp_jiexi(url):
s = requests.session()
s.get('https://ftpod.cn/')
r = s.get(url)
# r.encoding = r.apparent_encoding
r.encoding = 'utf-8'
# print(r.encoding)
value = r.text
return value
def getCid(url='https://www.bilibili.com/bangumi/play/ep424178'):
print(url)
url = url.split('?')[0]
if url.endswith('/'):
url = url[:-1]
if url.find('bilibili.com/video/') > -1:
r = requests.get(url, headers=headers)
# print(r.text)
# matchStr = re.search('cid=(.*?)&aid=(.*?)&(.*?)bvid=(.*?)&', r.text, re.S)
# params = matchStr.groups()
# if len(params) > 3:
# cid = params[0]
# avid = params[1]
# bvid = params[3]
# return [cid,avid,bvid]
# else:
# return None
mtext = re.search('window.__INITIAL_STATE__=(.*?);\(function', r.text, re.S).groups()[0]
# print(mtext)
try:
mtext = json.loads(mtext)
avid = mtext['aid']
bvid = mtext['bvid']
cid = mtext['videoData']['cid']
return [cid,avid,bvid]
except Exception as e:
print(f'获取参数发生错误:{e}')
return None
elif url.find('/ep') > 1:
epid = url.split('ep')[1]
data_url = f'https://api.bilibili.com/pgc/view/web/season?ep_id={epid}'
r = requests.get(data_url, headers=headers).json()
if r.get('code') == 0:
episodes = r['result']['episodes']
# print(episodes)
# print(url)
furl = url.replace('https://m.bilibili.com', 'https://www.bilibili.com')
now_ep = list(filter(lambda x: furl in [x['short_link'], x['share_url']] or furl in x['link'], episodes))[0]
avid = now_ep['aid']
cid = now_ep['cid']
return [cid,avid,None]
else:
return None
elif url.find('/ss')>-1:
epUrl = getEpUrl(url)
return getCid(epUrl)
else:
return None
def getEpUrl(ssUrl):
html = requests.get(ssUrl, headers=headers).text
# print(html)
short_link = re.search('short_link(.*?),',html)
short_link = (':'.join(short_link.group().split(':')[1:])).split('"')[1]
epUrl = short_link.encode('latin-1').decode('unicode_escape')
return epUrl
def bljiexi(url='https://www.bilibili.com/bangumi/play/ep424178',appkey='84956560bc028eb7',access_key='a0fa850310e694bee63f49fc5c4c9ab1'):
cids = None
try:
cids = getCid(url)
# print(cids)
except Exception as e:
return f'{e}'
if type(cids) == list:
cid = cids[0]
avid = cids[1]
rurl = f"https://api.bilibili.com/x/player/playurl?avid={avid}&cid={cid}&qn=112&type=&otype=json&appkey={appkey}&access_key={access_key}"
# print(rurl)
r = requests.get(rurl, headers=headers).json()
realUrl = r['data']['durl'][0]['url']
return realUrl
else:
return ''
def dlgw_jx(url,jxApi='http://q16.22web.org/api.php'):
# http://b2.22web.org/jx/index.php
base_path = os.path.dirname(os.path.abspath(__file__))
js_path = os.path.join(base_path,'aes.js')
# print(js_path)
with open(js_path, 'r', encoding='UTF-8') as fp:
ajs = fp.read()
ajs += """
function toNumbers(d) {
var e = [];
d.replace(/(..)/g, function(d) {
e.push(parseInt(d, 16))
});
return e
}
function toHex() {
for (var d = [], d = 1 == arguments.length && arguments[0].constructor == Array ? arguments[0] : arguments, e = "", f = 0; f < d.length; f++)
{
e += (16 > d[f] ? "0" : "") + d[f].toString(16);
}
return e.toLowerCase()
}
"""
s = requests.session()
r = s.get(jxApi,headers={'User-Agent':PC_UA})
ret = r.text
html = etree.HTML(ret)
ecode = 'var document={};' + ''.join(html.xpath('//script[2]/text()')).split('location.href')[
0] + 'function getCk(){return document.cookie}'
ajs += ecode
loader = execjs.compile(ajs)
ck = loader.call('getCk', '')
data = {
# 'url': 'https://www.iqiyi.com/v_1zp7qgh23kg.html'
'url': url
}
ck = ck.split(';')[0]
print(ck)
headers = {'Cookie': ck,'User-Agent':PC_UA}
r = s.post(jxApi, headers=headers, data=data)
# r = s.get(jxApi, headers=headers, params=data)
return r.text
def ysgc_jiexi():
r = requests.get('https://www.ik4.cc/api.php/app/video_detail?id=99&token=',timeout=fast_time_out)
try:
ret = r.json()
return ret['data']['vod_url_with_player'][0]['parse_api']
except Exception as e:
return f'{e}'
def ffm_jiexi():
"""
扶风M解析,m表示买的,money
:return:
"""
return 'https://vip.byteamone.cn/api/?key=92o3rsFdRYek842RRw&url='
def sjfree_jiexi(urls=sjfreeUrls):
"""
随机免费接口
:return:
"""
url = random.choice(urls) if type(urls)==list and len(urls)>0 else ''
return url
def ql_jiexi():
# 麒麟解析,取自app影视gtcv 红牛影视
try:
r = requests.get('http://cmm.218rcw.cn/api.php/gctvapi.vod/detail?vod_id=581499&token=', timeout=slow_time_out)
ret = r.json()
return ret['data']['vod_play_list'][0]['player_info']['parse']
except Exception as e:
# print(f'{e}')
return f'{e}'
def qldz_jiexi(vipUrl):
if not str(vipUrl).startswith('http'):
return f'滚犊子你'
# 麒麟道长解析,道长自己买的
accounts = [
{'key':'bivyzDFKNQRTXY0149','uid':'7146736'},
# {'key':'efjlmnqswHMNOV0138','uid':'7403418'},
]
account = random.choice(accounts) if len(accounts) > 0 else {'key':'bivyzDFKNQRTXY0149','uid':'7146736'}
key = account['key']
uid = account['uid']
try:
url = f'https://api.qilin.best/home/api?type=ys&uid={uid}&key={key}&url={vipUrl}'
# print(url)
r = requests.get(url, timeout=slow_time_out).json()
if str(r['code']) == '200':
return r['url']
else:
return f'解析失败:{r}'
except Exception as e:
# print(f'{e}')
return f'{e}'
def xc_jiexi(vipUrl):#星辰解析
if not str(vipUrl).startswith('http'):
return f'滚犊子你'
# 麒麟道长解析,道长自己买的
accounts = [
{'key':'eCjS1I3JoLmTNJndQ2'},
]
account = random.choice(accounts) if len(accounts) > 0 else {'key':'eCjS1I3JoLmTNJndQ2'}
key = account['key']
headers = {'User-Agent': MOBILE_UA}
try:
url = f'https://svip.spchat.top/api/?key={key}&url={vipUrl}'
print(url)
requests.packages.urllib3.disable_warnings()
r = requests.get(url, timeout=slow_time_out,headers=headers,verify=False).json()
print(r)
if str(r['code']) == '200':
return r['url']
else:
return f'解析失败:{r}'
except Exception as e:
# print(f'{e}')
return f'{e}'
def ty_jiexi(vipUrl):#淘影解析
if not str(vipUrl).startswith('http'):
return f'滚犊子你'
# 麒麟道长解析,道长自己买的
accounts = [
{'key':'zykLjRmuqkAJzyQp02'},
]
account = random.choice(accounts) if len(accounts) > 0 else {'key':'zykLjRmuqkAJzyQp02'}
key = account['key']
headers = {'User-Agent': MOBILE_UA}
try:
url = f'https://www.vodjx.top/api/?key={key}&url={vipUrl}'
print(url)
requests.packages.urllib3.disable_warnings()
r = requests.get(url, timeout=slow_time_out,headers=headers,verify=False).json()
print(r)
if str(r['code']) == '200':
return r['url']
else:
return f'解析失败:{r}'
except Exception as e:
# print(f'{e}')
return f'{e}'
def qg_jiexi(vipUrl):
headers = {
'Referer':f'https://jx.mmkv.cn/tv.php?url={vipUrl}',
'User-Agent': MOBILE_UA
# 'Referer':f'https://vip.mmkv.cn/tv.php?url={vipUrl}'
}
playUrl = f"https://vip.mmkv.cn/jiexiiiii.php?vi={vipUrl}"
try:
r = requests.get(playUrl,headers=headers,timeout=slow_time_out)
except Exception as e:
return f'解析超时错误:{e}'
# print(r.text)
try:
# realUrl = re.search('var qgur1(.*?);',r.text,re.S)
realUrl = re.search('video src="(.*?)"',r.text,re.S)
# return realUrl.groups()[0].split('"')[1].strip()
return realUrl.groups()[0].strip()
except Exception as e:
return f'错误:{e}'
def runJs(jsPath):
base_path = os.path.dirname(os.path.abspath(__file__))
js_path = os.path.join(base_path, jsPath)
with open(js_path, 'r', encoding='UTF-8') as fp:
ajs = fp.read()
# print(ajs)
loader = execjs.compile(ajs)
return loader
def toJs(jsPath):
base_path = os.path.dirname(os.path.abspath(__file__))
js_path = os.path.join(base_path, jsPath)
if not os.path.exists(js_path):
return jsonify({'code': -2, 'msg': f'非法猥亵,文件不存在'})
with open(js_path, 'r', encoding='UTF-8') as fp:
js = fp.read()
response = make_response(js)
response.headers['Content-Type'] = 'text/javascript; charset=utf-8'
return response
def toHtml(jsPath):
base_path = os.path.dirname(os.path.abspath(__file__))
js_path = os.path.join(base_path, jsPath)
with open(js_path, 'r', encoding='UTF-8') as fp:
js = fp.read()
response = make_response(js)
response.headers['Content-Type'] = 'text/html; charset=utf-8'
return response
def ff_jiexi(vipUrl):
headers = {
'User-Agent': MOBILE_UA
}
jxUrl = 'https://q.591zhuiju.com/'
ref = f"{jxUrl}?url={vipUrl}"
headers['Referer'] = ref
api = f"{jxUrl}api.php"
b64id = b64encode(vipUrl.encode('utf-8')).decode('utf-8')
loader = runJs('parse.js')
parseid = loader.call('caesarCipher',b64id,-1)
# print(parseid)
r = requests.post(api,headers=headers,data={'url':parseid},timeout=slow_time_out).json()
# print(r)
url = b64decode(loader.call('caesarCipher',r.get('url'),-1)).decode('utf-8') if r.get('code') == 200 else ""
return url
def jh_jiexi(url,pwd='jhyun9521'):
# url = "LyicZANeaiRbgwU5GB77JWp3jyzjC/w+TJjktXolzoBjn368zS9GdD9NOf0RowNTk0w5hIh1txgpkidM9YVq6S8kh8CIH8ARFDW5T4rxADOM1gzHNt7XVu3LjQ=="
loader = runJs('parse.js')
# 传已经atob后的值进去,返回的值就直接能用
ret = loader.call('jhjx', atob(url),pwd, 1)
return ret
def didi_jiexi(vipUrl):
#网站首页 http://dd88.icu:6080/
# headers = {'User-Agent': UA}
# http://vv.tv758.com:6688/?url=
headers = {'User-Agent': MOBILE_UA,'Referer':f'http://vv.tv758.com:6688/?url={vipUrl}'}
# url = f'http://bp.tv758.com:547/?url={vipUrl}'
# url = f'http://vv.tv758.com:6688/?url={vipUrl}'
# print(url)
url = f'http://vv.tv758.com:6688/analysis.php?v={vipUrl}'
print(url)
try:
r = requests.get(url,headers=headers,timeout=fast_time_out)
# print(r.text)
html = etree.HTML(r.text)
# realUrl = re.search('"url":(.*?)",', r.text, re.S).groups()[0].split('"')[1]
# realUrl = re.search('var urls =(.*?)";', r.text, re.S).groups()[0].split('"')[1]
realUrl = html.xpath('//*[@id="video"]/@src')[0]
# realUrl = jh_jiexi(realUrl)
# print(realUrl)
return realUrl
except Exception as e:
return f'错误:{e}'
def rx_jiexi_old(vipUrl):
headers = {"Referer": "https://www.rongxingvr.com",'User-Agent': MOBILE_UA}
url = f'https://test.rongxingvr.com/test/?url={vipUrl}'
text = ''
try:
r = requests.get(url,headers=headers,timeout=slow_time_out)
text = r.text
realUrl = re.search('"url":(.*?)",',text,re.S).groups()[0].split('"')[1]
return realUrl
except Exception as e:
return f'错误:{e}{text}'
def rx_jiexi(vipUrl):
headers = {"Referer": "https://www.rongxingvr.com",'User-Agent': MOBILE_UA}
if not str(vipUrl).startswith('http'):
return f'滚犊子你'
# 融兴解析,群友!!!自己买的
key = 'sFPQyQSxZKBVfDzfZ9'
try:
url = f'https://fast.rongxingvr.cn:8866/api/?key={key}&url={vipUrl}'
# print(url)
r = requests.get(url, timeout=fast_time_out,headers=headers).json()
if str(r['code']) == '200':
return r['url']
else:
return f'解析失败:{r}'
except Exception as e:
# print(f'{e}')
return f'{e}'
def ixg_jiexi(vipUrl,mflag=None):
"""
爱西瓜
:param vipUrl:
:return:
"""
headers = {'User-Agent': PC_UA, 'referer': 'https://www.ixigua.com'}
s = requests.session()
r = s.get('https://www.ixigua.com/',allow_redirects=False)
print(r.text)
print(r.cookies)
ck = 'ttwid=1%7Ce392ogVf4q4BaIFspoYmsbWtv9_iQd_XxB02tVSD9Tk%7C1634577856%7Caeb02095cc5a6e96454aa690e038a3439b6836ffd11a501ca1e3488bcf2c6d54; __ac_nonce=060d6a4a10085906c6a97; __ac_signature=_02B4Z6wo00f01fFH3ZgAAIDAkk0d8qIntt3xY9kAAByJ8d'
print(ck)
# print(vipUrl)
# vipUrl = 'https://www.ixigua.com/6915990035812581896?logTag=9db16949bf1c9bf9332b'
headers = {'User-Agent': PC_UA, 'Cookie': ck, 'referer': 'https://www.ixigua.com'}
if vipUrl.find('?logTag=') > -1:
vipUrl = vipUrl.split('?logTag=')[0]
elif vipUrl.find('cinema/')>-1:
r = requests.get(vipUrl, headers=headers, timeout=fast_time_out, allow_redirects=False)
vipUrl = urljoin(vipUrl,r.headers['Location'])
text = ''
try:
# print(vipUrl)
r = requests.get(vipUrl,headers=headers,timeout=fast_time_out)
r.encoding = r.apparent_encoding
text = r.text
# print(text)
html = etree.HTML(text)
js = ''.join(html.xpath('//*[@id="SSR_HYDRATED_DATA"]/text()')).replace('window._SSR_HYDRATED_DATA','function getJson(){return json};var json')
# print(js)
loader = execjs.compile(js)
jsd = loader.eval('json.anyVideo.gidInformation.packerData')
# print(jsd)
flag = loader.eval('json.anyVideo.gidInformation.packerData.albumInfo.totalEpisodes')
# print('flag:',flag)
# print(vipUrl)
if flag == 1 or mflag or '?id=' in vipUrl:
data = loader.eval('json.anyVideo.gidInformation.packerData.videoResource.normal.video_list')
data = list(data.values()) # 取所有播放列表
data = max(data, key=lambda x: int(x['definition'].replace('p','').replace('k','0000'))) # 筛选视频里最高清晰度的
realUrl = atob(data['main_url'])
# print(realUrl)
return realUrl
else:
# print(f'第二种情况:{flag}')
url = f'https://www.ixigua.com/api/albumv2/details?_signature=_02B4Z6wo00f01CHX1VQAAIBBcFEZFjy-qvghx9HAAFcod1&albumId={vipUrl.split("com/")[1]}&blockOnly=1'
# print(url)
r = requests.get(url,headers={'referer':'https://www.ixigua.com','User-Agent':MOBILE_UA},timeout=fast_time_out)
# print(r.text)
r = r.json()
playlist = r['data']['playlist']
# 综艺类所有列表
playlist = list(map(lambda i:(i['rank'],vipUrl+'?id='+i['episodeId']),playlist))
# 取其中的一个
first = playlist[0][1]
return ixg_jiexi(first,True)
except Exception as e:
# print(f'{e}')
return f'错误:{e}{text[:120] if len(text)>120 else text}'
def ndkj_jiexi(vipUrl):
headers = {'User-Agent': UA}
url = f'http://cache.languang.icu:88/didi.php?url={vipUrl}'
try:
r = requests.get(url,headers=headers,timeout=fast_time_out).json()
realUrl = r.get('url') or ''
return realUrl.replace('/cache/did/','/cache/didi/')
except Exception as e:
return f'错误:{e}'
def nlql_jiexi(vipUrl):
headers = {"Referer": "https://jx.manmankan.top/",'User-Agent': MOBILE_UA}
data = {
'url': vipUrl,
'ac': 'jx',
}
try:
r = requests.post('https://jx.manmankan.top/api.php',data=data,headers=headers,timeout=fast_time_out).json()
realUrl = r.get('url') or ''
return realUrl
except Exception as e:
return f'错误:{e}'
def zajh_jiexi(vipUrl):
# headers = {"Referer": "http://jx.zhiaiyy.top/?url=",'User-Agent': 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'}
# PC_UA需要解密江湖模板。手机UA直接取
headers = {'User-Agent': MOBILE_UA}
# headers = {'User-Agent': PC_UA}
# url = f'http://jx.zhiaiyy.top/?url={vipUrl}' # 江湖D
# url = f'https://123.xxgcx.cn:4433/jianghu.php?url={vipUrl}' #江湖B
url = f'http://jf.jisutuku.top/api/?key=TVDrWfMwbn1IUtLLWY&url={vipUrl}' #江湖1080直解
# print(url)
try:
"""
r = requests.get(url,headers=headers,timeout=fast_time_out)
# # print(r.text)
# realUrl = re.search('url(.*?):(.*?)"(.*?)"',r.text,re.S).groups()[2] #PC写法
# # print(realUrl)
# realUrl = jh_jiexi(realUrl,'928395479')
realUrl = re.search('source src="(.*?)"',r.text,re.S).groups()[0] #手机写法
print('realUrl:',realUrl)
return realUrl
"""
r = requests.get(url, timeout=fast_time_out, headers=headers).json()
if str(r['code']) == '200':
return r['url']
else:
return f'解析失败:{r}'
except Exception as e:
# print(f'{e}')
return f'错误:{e}'
def dd_jiexi(vipUrl):
headers = {"Referer": "https://www.xhqyy.com/",
'User-Agent': UA
}
url = f'https://dp.dd520.cc/analysis.php?v={vipUrl}'
print(url)
try:
r = requests.get(url, headers=headers, timeout=fast_time_out)
realUrl = re.search('var url = "(.*?)"', r.text, re.S).groups()[0]
return realUrl
except Exception as e:
return f'错误:{e}'
@app.route("/bl",methods=['GET', 'POST'])
def bl_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = bljiexi(url, appkey, access_key)
if realUrl.startswith('https:'):
return jsonify({'url': realUrl,'code': 0,'msg':'解析成功'})
else:
return jsonify({'url': '','code': -2,'msg': '解析失败','detail': realUrl})
@app.route("/dl",methods=['GET', 'POST'])
def dl_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = dlgw_jx(url)
return realUrl
@app.route("/ysgc",methods=['GET', 'POST'])
def ysgc_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
# jxUrl = ysgc_jiexi()
# if jxUrl.startswith('http'):
# try:
# r = requests.get(jxUrl+url).json()
# print(r)
# url = r.get('url') or ''
# if url.find('http') == -1:
# url = atob(url)
# return jsonify({'url': url, 'code': 0, 'msg': f'自建影视工厂解析完毕'})
# except Exception as e:
# return jsonify({'url': '', 'code': -2, 'msg': f'自建影视工厂线路错误:{e}'})
jxUrl = 'https://jx.ysgc.xyz/?url='
playUrl = jxUrl+url
headers = {
# 'Referer': jxUrl,
'user-agent': MOBILE_UA,
}
try:
r = requests.get(playUrl,headers=headers)
url = re.search('url:(.*?)",',r.text,re.S).groups()[0].split('"')[1]
if url.startswith('http'):
return jsonify({'url': url, 'code': 0, 'msg': f'自建影视工厂解析成功'})
else:
return jsonify({'url': '', 'code': -2, 'msg': f'解析失败','detail':url})
except Exception as e:
# print(f'{e}')
return jsonify({'url': '', 'code': -3, 'msg': f'自建影视工厂线路错误:{playUrl}'})
@app.route("/ffm",methods=['GET', 'POST'])
def ffm_jx():
# return mx_jx()
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
# jxUrl = ffm_jiexi()
jxUrl = mx_jiexi()
if jxUrl.startswith('http'):
return redirect(jxUrl+url)
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建扶风m线路错误:{jxUrl}'})
@app.route("/sjfree",methods=['GET', 'POST'])
def sjfree_jx():
# 随机免费json
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
jxUrl = sjfree_jiexi()
if jxUrl.startswith('http'):
return redirect(jxUrl+url)
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建随机json免费线路错误:{jxUrl}'})
@app.route("/sjfree2",methods=['GET', 'POST'])
def sjfree2_jx():
# 随机免费html
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
jxUrl = sjfree_jiexi(sjUrl)
if jxUrl.startswith('http'):
return redirect(jxUrl+url)
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建随机html免费线路错误:{jxUrl}'})
@app.route("/mx",methods=['GET', 'POST'])
def mx_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
jxUrl = mx_jiexi()
if jxUrl.startswith('http'):
return redirect(jxUrl+url)
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建萌新线路错误:{jxUrl}'})
@app.route("/ql",methods=['GET', 'POST'])
def ql_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
jxUrl = ql_jiexi()
if jxUrl.startswith('http'):
return redirect(jxUrl+url)
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自麒麟线路错误:{jxUrl}'})
@app.route("/qldzc",methods=['GET', 'POST'])
def qldz_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = qldz_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建道长麒麟解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建道长麒麟线路错误:{realUrl}'})
@app.route("/xc",methods=['GET', 'POST'])
def xc_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = xc_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建道长星辰解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建道长星辰线路错误:{realUrl}'})
@app.route("/ty",methods=['GET', 'POST'])
def ty_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = ty_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建道长淘影解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建道长淘影线路错误:{realUrl}'})
@app.route("/qg",methods=['GET', 'POST'])
def qg_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = qg_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建七哥解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建线路错误:{realUrl}'})
@app.route("/ff",methods=['GET', 'POST'])
def ff_jx():
url = checkParmas()
if type(url) != str or not url.startswith('http'):
return url
realUrl = ff_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建扶风解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建扶风线路解析失败:{realUrl}'})
def checkParmas(single=False):
args = {}
if request.method == 'POST':
args = request.json
elif request.method == 'GET':
args = request.args
params = ['url','key']
if need_secret or single:
params.append('secret')
for key in params:
if not args.get(key):
return jsonify({'url': '', 'code': -1, 'msg': f'缺少必传参数:{key}!'})
url = args.get('url')
key = args.get('key')
secret = args.get('secret')
if key != Akey:
return jsonify({'url': '', 'code': -2, 'msg': f'请求失败,错误的key值'})
if need_secret or single:
newSecret = str(genSecret())
if secret != newSecret:
return jsonify({'url': '', 'code': -3, 'msg': f'请求失败,你{secret}无权访问此接口,仅限海阔视界用户使用,联系qq 434857{newSecret}'})
return url
def xmly_jiexi(ts,muid):
cookie = '_xmLog=h5&de87f56a-64f5-4a73-ba79-b75a7cecd4e3&process.env.sdkVersion; fds_otp=5312034439796635050; 1&remember_me=y; 1&_token=224172391&194E5D60340N09077D1C91309BE9E2832D019915FE1355322DBA364FB501021D60FAC6E51966248M8C77074ADBFFD88_; login_type=code_mobile; xm-page-viewid=ximalaya-web; x_xmly_traffic=utm_source%253A%2526utm_medium%253A%2526utm_campaign%253A%2526utm_content%253A%2526utm_term%253A%2526utm_from%253A; Hm_lvt_4a7d8ec50cfd6af753c4f8aee3425070=1648041209,1648041310; Hm_lpvt_4a7d8ec50cfd6af753c4f8aee3425070=1648041319'
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
headers = {'User-Agent': ua, 'Cookie': cookie, 'Content-Type': 'application/x-www-form-urlencoded'}
base_url = 'https://mobile.ximalaya.com/mobile-playpage/track/v3/baseInfo/'
url = f'{base_url}{ts}?device=web&trackId={muid}'
r = requests.get(url, headers=headers)
return r.text
def checkXmly():
args = {}
if request.method == 'POST':
args = request.json
elif request.method == 'GET':
args = request.args
params = ['ts','muid']
for key in params:
if not args.get(key):
return jsonify({'url': '', 'code': -1, 'msg': f'缺少必传参数:{key}!'})
ts = args.get('ts')
muid = args.get('muid')
return ts,muid
@app.route("/xmly",methods=['GET', 'POST'])
def xmly_jx():
ret = checkXmly()
if type(ret) not in [str,list,tuple]:
return ret
ts, muid = ret
if not any([ts,muid]):
return {'url': '', 'code': 404, 'msg': f'未填写正确参数'}
ret = xmly_jiexi(ts,muid)
return jsonify(json.loads(ret))
def lmys_jiexi(url):
playUrl = f'https://hikerfans.com/jx27/?url={url}'
try:
r = requests.get(playUrl,timeout=fast_time_out).json()
return r.get('url') or ''
except Exception as e:
return f'错误:{e}'
@app.route("/lmys",methods=['GET', 'POST'])
def lmys_jx():
url = checkParmas(True) # 蓝莓影视解析
# if type(url) != str or not url.startswith('http'):
if type(url) != str:
return url
elif not url or url.startswith('错误'):
return jsonify({'url': '', 'code': -3, 'msg': f'自建蓝莓超强解析失败:{url}'})
realUrl = lmys_jiexi(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建蓝莓影视解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建蓝莓影视解析失败:{realUrl}'})
def lmys_jiexi_vip(url):
playUrl = f'https://hikerfans.com/jx27/nbjx.php/?url={url}'
try:
r = requests.get(playUrl,timeout=fast_time_out).json()
return r.get('url') or ''
except Exception as e:
return f'错误:{e}'
@app.route("/lmys-ltvip",methods=['GET', 'POST'])
def lmys_jx_vip():
url = checkParmas(True) # 蓝莓影视解析
# if type(url) != str or not url.startswith('http'):
if type(url) != str:
return url
elif not url or url.startswith('错误'):
return jsonify({'url': '', 'code': -3, 'msg': f'自建蓝莓超强解析失败:{url}'})
realUrl = lmys_jiexi_vip(url)
if realUrl.startswith('http'):
return jsonify({'url': realUrl, 'code': 0, 'msg': f'自建蓝莓超强解析成功'})
else:
return jsonify({'url': '', 'code': -3, 'msg': f'自建蓝莓超强解析失败:{realUrl}'})
def lm_dz_jiexi_svip(url):
# resp = re.compile(url)
global vflag
vflag = '未知'
def test(text):
searchObj = re.search(rf'{text}', url, re.M | re.I)
global vflag
if searchObj:
vflag = searchObj.group()
return searchObj
if test('iqiyi.com|youku.com|mgtv.com|sohu.com|ixigua.com|pptv.com|le.com|1905.com|fun.tv'): #正版
ret = getUrl('https://hikerfans.com/jx27/jhjx.php/?url=',url)
elif test('qq.com'): # 腾讯
ret = getUrl('https://hikerfans.com/jx27/qq.php/?url=',url)
elif test('miguvideo.com'): # 咪咕
ret = getUrl('https://hikerfans.com/jx27/migu.php/?url=',url)
elif test('bilibili.com'): # 哔哩
ret = getUrl('https://hikerfans.com/jx27/bb.php/?url=',url)
elif test('LT'): # 龙腾
ret = getUrl('https://hikerfans.com/jx27/ltjx.php/?url=',url)
# ret = getUrl('http://json.nokia.press/svip?key=daozhangyyds&url=',url)
elif test('ruifenglb'): # 苍蓝
ret = getUrl('https://hikerfans.com/jx27/cl.php/?url=',url)
elif test('suoyo'): # 多多资源
ret = getUrl('https://hikerfans.com/jx27/duoduo.php/?url=',url)
elif test('xfy'): # 旋风
ret = getUrl('https://hikerfans.com/jx27/xfy.php/?url=',url)
elif test('renrenmi'): # 人人线路
ret = getUrl('https://hikerfans.com/jx27/rrm.php/?url=',url)
elif test('RongXingVR'): # 融兴
ret = getUrl('https://hikerfans.com/jx27/rx.php/?url=',url)
elif test('xueren'): # 雪人
ret = getUrl('https://hikerfans.com/jx27/xueren.php/?url=',url)
elif test('wuduyun'): # 五毒云
ret = getUrl('https://hikerfans.com/jx27/wudu.php/?url=',url)
elif test('laodi'): # 老弟
ret = getUrl('https://hikerfans.com/jx27/laodi.php/?url=',url)
elif test('Naifeimi'): # 奈非
ret = getUrl('https://hikerfans.com/jx27/naifei.php/?url=',url)
elif test('daodm|XMMT|v020c'): # 其他
ret = getUrl('https://hikerfans.com/jx27/qita.php/?url=',url)
elif test('duoduozy|leduo'):
ret = f'错误:暂不支持的切片:{vflag}'
else:
ret = f'错误:未知标志的链接:{url}'
return ret,vflag
def dz_buy_jiexi_svip(url):
# 道长买的解析
global vflag
vflag = '未知'
def test(text):
searchObj = re.search(rf'{text}', url, re.M | re.I)
global vflag
if searchObj:
vflag = searchObj.group()
return searchObj
api = 'https://svip.daina.hk/api/?uid=11235&key=KUNQFsOGSHzKDtHe55&url='
if test('iqiyi.com|youku.com|mgtv.com|sohu.com|ixigua.com|pptv.com|le.com|1905.com'): #正版