This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_check.py
55 lines (52 loc) · 2.24 KB
/
start_check.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
from bs4 import BeautifulSoup
import re
import os
import time
import sys
from Main_function import Principal_function
from MyThread import MyThread
from pyhtml import *
def cookie_test():
if not os.path.exists ('cookie.txt'):
return False
def get_html_data(url,url_id):
get_url = MyThread (get_response, (url,))
get_url2 = MyThread (get_route, (url_id,))
get_url.start (), get_url2.start ()
get_url.join (), get_url2.join ()
response = get_url.get_result ()
route = get_url2.get_result ()
return response,route
def start_process(url):
if cookie_test() == False:
sys.exit('无cookie')
url_id = re.search('\d+', url).group()
response ,route=get_html_data(url,url_id)
soup = BeautifulSoup(response.text,'html.parser')
titlemail = soup.select ('.__cf_email__ ', )
subtitle = re.findall('副标题</td><td class="rowfollow" valign="top" align="left">(.*)</td></tr>', response.text)[0]
url_type_tv = re.search ('details_tv', url)
url_type_movie=re.search('details_movie',url)
messagerow = [x.replace(' ','').strip() for x in re.findall ('媒介<.b>:(.*)<b>编码<.b>:(.*)<b>分辨率<.b>:(.*)<b>音频编码<.b>:(.*)<b>地区<.b>:(.*)<b>制作组<.b>:(.*)<b>版本<.b>:(.*)<.td>', response.text)[0]]
Complete=''
email = email_jimi(titlemail[0].attrs['data-cfemail']) if titlemail else None
subtitle = re.sub('<a.*</a>', email, subtitle) if titlemail else subtitle
if url_type_tv:
movie_message_tv = re.findall('类型</b>: (.*) ', response.text)
movie_type = movie_message_tv[0].strip(' ')
Complete=re.search('是否完结</b>:(.*)</td>',response.text)
elif url_type_movie:
movie_message = re.findall ('类型</b>:.(.*)</td>', response.text)
movie_type = movie_message[0]
else:
movie_message = re.findall('类型</b>:.(.*)</td>', response.text)
movie_type = movie_message[0]
return Principal_function (messagerow, soup, route, subtitle, response, movie_type, Complete)
if __name__ == '__main__':
start = time.time ()
url = 'https://lemonhd.org/details_doc.php?id=264675&group_id=264675'
proess = start_process (url)
for o in proess:
print(o)
end = time.time ()
#print (end - start)