1 Star 0 Fork 2

jackfrued/spider2002

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
example09.py 734 Bytes
一键复制 编辑 原始数据 按行查看 历史
"""
抓取动态内容
方法1:JavaScript逆向
"""
from concurrent.futures.thread import ThreadPoolExecutor
import requests
def download_picture(url):
resp = requests.get(url)
if resp.status_code == 200:
filename = url[url.rfind('/') + 1:]
with open(f'images/{filename}', 'wb') as file:
file.write(resp.content)
def main():
with ThreadPoolExecutor(max_workers=16) as pool:
for num in range(0, 100, 10):
resp = requests.get(f'https://image.so.com/zjl?ch=beauty&sn={num}&listtype=new&temp=1')
result = resp.json()
for data in result['list']:
pool.submit(download_picture, data['imgurl'])
if __name__ == '__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jackfrued/spider2002.git
git@gitee.com:jackfrued/spider2002.git
jackfrued
spider2002
spider2002
master

搜索帮助