gpt4 book ai didi

python - 使用 Python 从带有 cloudflare 的网站下载文件

转载 作者:行者123 更新时间:2023-11-28 21:47:08 30 4
gpt4 key购买 nike

我正在尝试使用 python 从具有 Cloud Flare 的网站下载 mp3 文件。我知道 python 的“cfscrape”模块,但我如何使用它从 url 下载文件。

最佳答案

我明白了。

import cfscrape

scraper = cfscrape.create_scraper()

url = 'the website url'
cfurl = scraper.get(url).content
name = url.split('/')[-1]

with open(name, 'wb') as f:
f.write(cfurl)

关于python - 使用 Python 从带有 cloudflare 的网站下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36948573/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com