一、猫的奇妙多样:探索它们的种类与魅力
二、从古老到现代:猫品种的演变历程
三、以色彩为标志:不同品种猫咪的颜色世界
四、体态各异:猫品种中的身形多样性
五、聪明才智:各种品种猫咪的情商与智慧
六、健康生活伴侣:了解和选择适合您家的猫品种
七、新兴热潮——寨子犬和它背后的故事
八、小小巨人——大型家宠,泰迪熊长毛虎皮狮(Tibetan Mastiff)
九,神秘而温柔——斯芬克斯(Sphynx)无毛美男子与其特点解析
十,优雅如诗——波斯(Persian)长毛之王及其养护窍门分享
import requests
from bs4 import BeautifulSoup
import re
import random
def get_random_text():
url = "https://www.layabox.com/community/viewtopic.php?f=77&t=34223"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
text_list = []
for p in soup.find_all('p'):
text_list.append(p.get_text())
return '\n'.join(text_list)
random_text = get_random_text()
print(random_text)
这个脚本将会获取指定网站上的文章内容,并且返回一个包含了大量中文文本的字符串。这个字符串可以作为文章正文的一部分使用。