优化标题获取

This commit is contained in:
shmilylty
2019-10-25 15:46:27 +08:00
parent baf394fc0b
commit 893e6628e6
+4
View File
@@ -122,6 +122,10 @@ def get_title(markup):
if h2:
return h2.text.strip()
h3 = soup.h3
if h2:
return h3.text.strip()
desc = soup.find('meta', attrs={'name': 'description'})
if desc:
return desc['content'].strip()