Python 当有javascript按钮时,如何从internet下载csv文件?
我正在尝试使用python从晨星下载CSV文件。 以下是链接: 有一个“导出CSV”按钮,但我无法访问该链接 这里有一个javascript:exportKeyStat2CSV();但我不知道如何找到CSV文件的URL 我试图下载该文件并获取URL以使用requests/panadas下载该文件,但requests/panadas无法获取任何内容Python 当有javascript按钮时,如何从internet下载csv文件?,python,download,Python,Download,我正在尝试使用python从晨星下载CSV文件。 以下是链接: 有一个“导出CSV”按钮,但我无法访问该链接 这里有一个javascript:exportKeyStat2CSV();但我不知道如何找到CSV文件的URL 我试图下载该文件并获取URL以使用requests/panadas下载该文件,但requests/panadas无法获取任何内容 import pandas as pd URL= ("http://financials.morningstar.com/finan/ajax/ex
import pandas as pd
URL= ("http://financials.morningstar.com/finan/ajax/exportKR2CSV.html?&callback=?&t=XASX:NAB®ion=aus&culture=en-US&cur=&order=asc")
df=pd.read_csv(URL) ( didnt work with pandas)
import requests
print ('Starting to Download!')
r = requests.get(URL)
filename = url.split('/')[-1]
with open(filename, 'wb') as out_file:
out_file.write(r.content)
print("Download complete!")
我得到了密码
如何解决这个问题?您是否尝试过使用Python通过Selenium访问资源 请参见此示例:
您是否尝试过使用Python通过Selenium访问资源 请参见此示例: