I'm making a package management utility for Minecraft mods, a lot of which are distributed using MediaFire. I'd like to be able to download the mod files directly off MediaFire. I tried poking around in the page source, but I don't know enough HTML or Javascript for that to be useful. How would I go about downloading a file off MediaFire given the URL for the download page?
Asked
Active
Viewed 4,185 times
1
-
1You have to evaluate JavaScript from Python. That's not too difficult, see http://stackoverflow.com/questions/5356948/scraping-javascript-driven-web-pages-with-pyqt4-how-to-access-pages-that-need-a or http://stackoverflow.com/questions/6630214/download-html-of-url-with-python-but-with-javascript-enabled – rubik Jul 11 '11 at 07:19
2 Answers
2
It starts and ends with reading MediaFire Acceptable Use Policy
You agree while using MediaFire Services, that you may not:
Use the Services for any illegal purpose;
Use any robot, spider, site search and/or retrieval application, or other device to retrieve or index any portion of the Services, with the exception of public search engines;

Jochen Ritzel
- 104,512
- 31
- 200
- 194
1
I know its been 2 years, but had to do just that.
Here is the code.
below code requires selenium and phantomjs
from selenium import webdriver
url = "http://www.mediafire.com/download/X/Y.pdf"
driver = webdriver.PhantomJS()
driver.set_window_size(1120, 550)
driver.get(url)
div = driver.find_element_by_class_name('download_link')
print div.find_element_by_css_selector('a').get_attribute('href')
driver.quit()

taesu
- 4,482
- 4
- 23
- 41