开发者

How can I download files form web pages?

开发者 https://www.devze.com 2023-01-07 04:23 出处:网络
Some web pages, having their urls, have \"Download\" Text, which are hyperlinks. How can I g开发者_开发技巧et the hyperlinks form the urls/pages by python or ironpython.

Some web pages, having their urls, have "Download" Text, which are hyperlinks.

How can I g开发者_开发技巧et the hyperlinks form the urls/pages by python or ironpython.

And can I download the files with these hyperlinks by python or ironpython? How can I do that?

Are there any C# tools?

I am not native english speaker, so sorry for my english.


You should be able to use the BeautifulSoup library with CPython (normal Python) and IronPython. Check out the findAll() method. This should pull out a list of all the links.

soup.findAll('a')


The easiest way would be to pass the HTML page into an XML/HTML parser, and then call getElementsByTagName("A") on the root node. Once you get that, iterate through the list and pull out the href parameter.

0

精彩评论

暂无评论...
验证码 换一张
取 消