简体   繁体   English

通过使用Python单击下载按钮来下载文件

[英]Download a file by clicking on download button using Python

I'd like to download a file, which DOESN'T have a url using mechanize. 我想下载一个文件,该文件没有使用机械化的网址。 I tried .read() but it gave me html file, which is obvious. 我尝试了.read(),但是它给了我html文件,这是显而易见的。 This is the url http://www.ncbi.nlm.nih.gov/sra?term=SRP000714 where I need to do send to> file> accessionlist and click on create file. 这是URL http://www.ncbi.nlm.nih.gov/sra?term=SRP000714 ,我需要在其中发送到> file> accessionlist,然后单击create file。

A very, very, very, very lazy way to solve your problem is to use a tool for web scraping. 解决问题的一种非常非常非常懒惰的方法是使用一种工具进行Web抓取。 One which I use when I don't want to think about requests is splinter . 当我不想考虑请求时,我会使用一个碎片 Although it was developed for web application testing, it is suitable enough to do some web scraping. 尽管它是为Web应用程序测试而开发的,但它足以进行某些Web抓取。 Take a look at Splinter documentation, everything is very well explained there. 看看Splinter文档,那里的所有内容都很好地解释了。

Oh, and it works only with Python 2, which is not so cool. 哦,而且它仅适用于Python 2,它不是很酷。

(certainly there is also a better answer too) (当然也有更好的答案)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击提交按钮后,使用python下载文件 - Using python to download a file after clicking the submit button 通过使用 Python 单击网站按钮下载 xlsx 文件 - Download a xlsx file by clicking a website button using Python 单击 href 在 python 中下载文件 - Download file in python on clicking on href 如何在不单击保存按钮的情况下使用 Python 和 Selenium 自动下载文件? - How do i automatically download file using Python and Selenium without clicking Save button? 如何通过单击按钮并使用 Python 从特定网站下载 excel 文件? - How to download excel file from a specific website by clicking a button and using Python? 使用python填写网站文本框,点击按钮下载 - Using python to fill in text boxes on websites, and clicking button to download 单击生成图标后,使用python下载文件 - Using python to download a file after clicking the generate icon 通过单击不使用 url 使用 Selenium 和 Python 下载文件 - Download a file by clicking without url using Selenium and Python 如何通过使用 python 脚本单击 email 中的链接来下载文件 - How to download the file by clicking the link in email by using the python script 使用 chromedriver python 单击下载按钮的问题 - Issue with clicking download button with chromedriver python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM