PDA

View Full Version : bash/python question




lynkynpark86
Jun 7, 2011, 03:52 PM
There is a website that has the number of downloads of a file on it, and I want to create a command to return, through echo or print, the number of downloads. How might I go about doing this?
When I view the source of the website, it only shows the number itself, not a data source or anything.



willieva
Jun 7, 2011, 05:13 PM
In a terminal, type:
curl url
where url is the url of the website.

larkost
Jun 8, 2011, 01:05 AM
You would need to write something that took in the html of the website, stripped out the information you are looking for (possibly doing more than just paring for urls), and then returns that as a list.

Python and the urllib2 class would probably be how I would start this.