forked from gaotianliuyun/gao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sexpclist.py
executable file
·140 lines (128 loc) · 5.25 KB
/
sexpclist.py
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
# encoding: utf-8
import time,os
from bs4 import BeautifulSoup
import smtplib #smtp服务器
from email.mime.text import MIMEText #邮件文本
from email.header import Header
two = False #切换获取页面方法True:undetected_chromedriver Flase:request
#调整代码
dm=[('纯白视频','chunbai')]
url1="https://bbs.672z.org/2048/"
url3="thread.php?fid=291&woo={}"
path='./'
#('快播四仓','2028d'),('91PORNY仓','91porny'),('网红爆料仓','51cg1'),('欧美18禁仓','xxx18'),('花菀TV仓','kwtkyg'),('百视精品仓','100vod'),('成人娱乐','76119')
def send_email(subject="chinadaily推送提醒",content="chinadaily头条,请查看",recver="[email protected]"):
# 第三方 SMTP 服务
mail_host="smtp.office365.com" #设置服务器
mail_user="[email protected]" #用户名
mail_pass="97JUAN1011xc" #口令
sender = '[email protected]'
receivers = recver # 接收邮件,可设置为你的QQ邮箱或者其他邮箱
message = MIMEText(content, 'plain', 'utf-8')
message['Subject'] = Header(subject, 'utf-8')
smtpObj = smtplib.SMTP(mail_host,port=587)
smtpObj.connect(mail_host,port=587) # 25 为 SMTP 端口号
# 必须先登录
smtpObj.ehlo() # 用户认证
smtpObj.starttls() # 明文通信协议的扩展,能够让明文的通信连线直接成为加密连线(使用SSL或TLS加密),而不需要使用另一个特别的端口来进行加密通信,属于机会性加密
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
print('邮件发送成功')
def web_fw(url):
if two:
global onetime
try:
browser.get(url)
if onetime:
time.sleep(30)
onetime = False
html=browser.page_source
return html
except Exception as e:
print(e)
#browser.quit()
else:
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.39'}
#try:
html = request.Request(url=url,headers=headers)
res = request.urlopen(url=html,timeout=30)
return res
#except Exception as e:
# print(e)
# return False
def savem3(url2,fn,dm_name,x='a'):
soup = BeautifulSoup(web_fw(url2),"html.parser")
linksall = soup.find_all('a',style='display: block;')
for linkall in linksall:
name=linkall.text.strip()
linkall=url1+linkall['href']
# print(name,linkall)
soup = BeautifulSoup(web_fw(linkall),"html.parser")#,from_encoding="utf-8"
#links = soup.find_all('div',class_='colVideoList')
links = soup.find_all('div',class_='colVideoList')
# if x=='w':
# f.write(name+',#genre#\n')
m3u=""
m3u+=name+',#genre#\n'
for link in links:
# print(link.a.text,link.a['href'])
try:
cont = link.a.text
link=url1+link.a['href']
soup = BeautifulSoup(web_fw(link),"html.parser")#,from_encoding="utf-8")
link = soup.iframe['src']
if link.find('http')==0:
pass
else:
link=url1+link
soup = BeautifulSoup(web_fw(link),"html.parser")
wer= str(soup.body.select('script')[2])
wer=wer[wer.find('"src":')+8:wer.find('.m3u8')+5]
#wer=wer[:wer.find('",')]
if wer.find('http')==0:
pass
else:
wer='https://bbs.672z.org'+wer
m3u += cont+','+wer+'\n'
except Exception as e:
print(e)
continue
# print(m3u)
f=open(fn,x, encoding='utf-8')
f.write(m3u)
f.close()
x='a'
return False
sexname=''
if two:
import undetected_chromedriver as uc
chrome_options = uc.ChromeOptions()
chrome_options.add_argument('–headless')
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--profile-directory=Default")
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--disable-plugins-discovery")
chrome_options.add_argument("--incognito")
chrome_options.add_argument('--no-first-run')
chrome_options.add_argument('--no-service-autorun')
chrome_options.add_argument('--no-default-browser-check')
chrome_options.add_argument('--password-store=basic')
chrome_options.add_argument('--no-sandbox')
browser = uc.Chrome(options=chrome_options, version_main=113)
browser.delete_all_cookies()
onetime = True
else:
from urllib import request
l=os.listdir(path)
zt='w'
for dm_one in dm:
filename = 'sexlist.txt'
url=url1+url3.format(dm_one[1])
print(dm_one[0],'going......')
savem3(url,path+filename,dm_one[0],zt)
print(dm_one[0],'ok')
zt='a'
send_email(subject="更新提示",content="更新成功")
if two:
browser.quit()