将需要爬的网址输入在提示位置即可
下面是代码
import requests
import ybc_box as box
# 获取网页源代码
def getHtml(url):
# 发送请求,r:response
res = requests.get(url)
# 判断是否请求成功
if res.status_code == 200:
# 设置编码
res.encoding = res.apparent_encoding
# 获取html文本数据,t:text
return res.text
else:
print('请求失败')
return ''
# 目标网址
url = '在这里输入哦'
html = getHtml(url)
# 输出网页源代码
print(html)
以后会继续更新,优化使用界面和用户体验 |
点评
使用道具 举报
哟西
使用道具 举报
使用道具 举报