1 Star 0 Fork 0

XieYeMing/python爬虫与自动化脚本

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Bproject.py 802 Bytes
Copy Edit Raw Blame History
XieYeMing authored 2024-02-16 17:44 . 练手脚本
import requests # 导入模块
# 获取地址
url = "https://api.bilibili.com/x/web-interface/wbi/search/type?__refresh__=true&_extra=&context=&page=2&page_size=42" \
"&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&keyword=newbing&qv_id" \
"=EPR9ZzQSvQUFzrgBXoRKRqzSOJCqwQae&ad_resource=5654&source_tag=3&category_id=&search_type=video&dynamic_offset" \
"=30&w_rid=617b36a3365518e0063ecb8a56e3f54a&wts=1678004658 "
# 发送请求并接收
req = requests.get(url)
data = req.json()['data']['result']
print(data)
for info in data:
author = info['author'] # 筛选数据
arcurl = info['arcurl']
typename = info['typename']
# 保存数据
with open("B站.csv", "a+") as f:
f.write('{},{},{}\n'.format(author, arcurl, typename))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/xieyeming/machine-study.git
git@gitee.com:xieyeming/machine-study.git
xieyeming
machine-study
python爬虫与自动化脚本
master

Search