mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
优化标题获取
This commit is contained in:
@@ -122,6 +122,10 @@ def get_title(markup):
|
|||||||
if h2:
|
if h2:
|
||||||
return h2.text.strip()
|
return h2.text.strip()
|
||||||
|
|
||||||
|
h3 = soup.h3
|
||||||
|
if h2:
|
||||||
|
return h3.text.strip()
|
||||||
|
|
||||||
desc = soup.find('meta', attrs={'name': 'description'})
|
desc = soup.find('meta', attrs={'name': 'description'})
|
||||||
if desc:
|
if desc:
|
||||||
return desc['content'].strip()
|
return desc['content'].strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user