Python - 在没有链接的情况下在网站上下载 csv 文件 [英] Python - Download a csv file in website without link
问题描述
我在使用 python 下载 csv 文件时遇到问题.
I am having problem on downloading a csv file using python.
文件位置:https://www.hkex.com.hk/eng/sorc/options/statistics_hv_iv.aspx?ucode=00001
下载按钮导出到 csv"显示没有链接的 javascript.
The download button "export to csv" show javascript without a link.
如何下载文件?非常感谢!
How can I download the file? Thanks a lot!
推荐答案
从提供的 URL 中您无法直接提取下载链接.但是,下载 CSV 会产生以下 URL:https://www.hkex.com.hk/eng/sorc/options/statistics_hv_iv.aspx?action=csv&type=3&ucode=00001
.使其可预测.
From the URL provided you cannot extract the download link directly. However, downloading the CSV yields the following URL:
https://www.hkex.com.hk/eng/sorc/options/statistics_hv_iv.aspx?action=csv&type=3&ucode=00001
. Making it predictable.
所以根据您的用例,您可以使用它吗?ucode
的值可以从您的第一个 url 的选择框中提取.
So depending on your usecase, you can use that? The values for ucode
can be extracted from select box in your first url.
这篇关于Python - 在没有链接的情况下在网站上下载 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!