May-20-2018, 01:04 PM
(This post was last modified: May-20-2018, 01:04 PM by eddywinch82.)
I need help, with finishing of the following code :- which is not all my own work, i am not this good at programming,
but had help with it yesterday :-
But there are several, where the last part of the path is always :- /repaints.php?ac=Two Digit Number@cat=6
What do i need to type, to download all the .zip Files from http://web.archive.org/web/2005031511271...c=89&cat=6, without having to type each different ac=Two Digit Number@cat=6 for that path each time? Any help would be much appreciated.
but had help with it yesterday :-
from bs4 import BeautifulSoup import requests, wget, re, zipfile, io def get_zips(link_root, zips_suffix): # 'http://web.archive.org/web/20050315112710/http://www.projectai.com:80/libraries/repaints.php?ac=89&cat=6' zips_page = link_root + zips_suffix # print zips_page zips_source = requests.get(zips_page).text zip_soup = BeautifulSoup(zips_source, "html.parser") for zip_file in zip_soup.select("a[href*=download.php?fileid=]"): zip_url = link_root + zip_file['href'] print('downloading', zip_file.text, '...',) r = requests.get(zip_url) with open(zip_file.text, 'wb') as zipFile: zipFile.write(r.content) def download_links(root, cat): url = ''.join([root, cat]) source_code = requests.get(url) plain_text = source_code.text soup = BeautifulSoup(plain_text, "html.parser") for zips_suffix in soup.select("a[href*=repaints.php?ac=]"): get_zips(root, zips_suffix['href']) link_root = 'http://web.archive.org/web/20041225023002/http://www.projectai.com:80/libraries/' # Example category, need to read all categories from first page into a list and iterate categories category = 'acfiles.php?cat=6' download_links(link_root, category)This is the path for one of the Aircraft catagories :- 'http://web.archive.org/web/20050315112710/http://www.projectai.com:80/libraries/repaints.php?ac=89&cat=6'
But there are several, where the last part of the path is always :- /repaints.php?ac=Two Digit Number@cat=6
What do i need to type, to download all the .zip Files from http://web.archive.org/web/2005031511271...c=89&cat=6, without having to type each different ac=Two Digit Number@cat=6 for that path each time? Any help would be much appreciated.