-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZhuiXinFan.py
More file actions
62 lines (49 loc) · 1.72 KB
/
Copy pathZhuiXinFan.py
File metadata and controls
62 lines (49 loc) · 1.72 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
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Thanks: CodesW(https://www.cnblogs.com/tp1226/p/8419564.html)
import requests
import lxml
from bs4 import BeautifulSoup
domain = 'http://www.zhuixinfan.com/'
emule = []
baidu = []
weiyun = []
tv_urldata = input('请输入剧集地址中的数字\n格式为: http://www.zhuixinfan.com/viewtvplay-[数字].html\n')
tv_url = 'http://www.zhuixinfan.com/viewtvplay-'+ tv_urldata +'.html'
with requests.Session() as session:
resp = session.get(tv_url, timeout=10)
resp.raise_for_status()
soup = BeautifulSoup(resp.content, 'lxml', from_encoding=resp.encoding)
tag_resources = soup.find(id='ajax_tbody')
for res in tag_resources.find_all('tr'):
tag_a = res.find('a')
res_url = domain + tag_a.get('href')
resp = session.get(res_url, timeout=10)
resp.raise_for_status()
soup = BeautifulSoup(resp.content, 'lxml', from_encoding=resp.encoding)
emule_url = soup.find(id='emule_url')
emule.append(emule_url.get_text())
baidu_text = soup.find(text='网盘下载1')
if baidu_text != None:
baidu_parent = baidu_text.parent
baidu.append(baidu_parent.get('href'))
weiyun_text = soup.find(text='网盘下载2')
if weiyun_text != None:
weiyun_parent = weiyun_text.parent
weiyun.append(weiyun_parent.get('href'))
print('ed2k:')
for i in range(len(emule)):
print(emule[i])
if baidu == []:
print('无百度云链接')
else:
print('百度云:')
for i in range(len(baidu)):
print(baidu[i])
if weiyun == []:
print('无微云链接')
else:
print('微云:')
for i in range(len(weiyun)):
print(weiyun[i])
input('Press ENTER to exit …')