[英]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.