import requests
from bs4 import BeautifulSoup

lst = []

url = 'https://www.qiushibaike.com/text/'

headers={
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'
}

res = requests.get(url, headers=headers).text
soup = BeautifulSoup(res, 'lxml')

for div_list in soup.find_all(class_='article'):
    user_name = div_list.find(name='h2').text
    content = div_list.find(name='span').text
    lst.append(content.strip())
    print(user_name, content.strip())

# pip install wxpy
from wxpy import *
import random
bot = Bot(cache_path=True)

@bot.register()
def recv_send_msg(recv_msg):
    print(f'收到消息:', recv_msg.text)
    return random.choice(lst)

embed()

 posted on 2020-04-08 19:27  Rannie`  阅读(179)  评论(0编辑  收藏  举报
去除动画
找回动画