赞
踩
进入正题,首先要搞到资源,我先去了搜索了一番,找到个网站“落霞”。一言不合就按下了F12,翻了下网页源码,超级简单。
from bs4 import BeautifulSoup
from requests import Session
from re import sub,DOTALL
sess = Session()
txt=[]
url = 'https://www.luoxia.com/qing/48416.htm'
def find(url):
res = sess.get(url)
soup = BeautifulSoup(res.content,'html.parser')
title = soup.find('title')
div = soup.find('div',id='nr1')
ps = div.find_all('p')
page = title.text+'\n'
print(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。