mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-10-28 19:55:52 +08:00
标题信息获取处理
This commit is contained in:
@@ -100,13 +100,16 @@ def request_callback(future, index, datas):
|
|||||||
datas[index]['banner'] = banner
|
datas[index]['banner'] = banner
|
||||||
soup = BeautifulSoup(text, 'lxml')
|
soup = BeautifulSoup(text, 'lxml')
|
||||||
title = soup.title
|
title = soup.title
|
||||||
|
desc = soup.find('meta', attrs={'name': 'description'})
|
||||||
head = soup.head
|
head = soup.head
|
||||||
if title:
|
if title:
|
||||||
datas[index]['title'] = title.text
|
datas[index]['title'] = title.text.strip()
|
||||||
|
elif desc:
|
||||||
|
datas[index]['title'] = desc['content'].strip()
|
||||||
elif head:
|
elif head:
|
||||||
datas[index]['title'] = head.text
|
datas[index]['title'] = head.text.strip()
|
||||||
elif len(text) <= 200:
|
elif len(text) <= 200:
|
||||||
datas[index]['title'] = text
|
datas[index]['title'] = text.strip()
|
||||||
|
|
||||||
|
|
||||||
async def bulk_get_request(datas, port):
|
async def bulk_get_request(datas, port):
|
||||||
|
|||||||
Reference in New Issue
Block a user