May-20-2018, 07:17 PM
I have adapted the working Code, for a different Flight Sim Website Link, but when I run the Code, there are no Traceback Errors, but on investigation no .zip Files appear to be downloading. unless they are ? Have I gone wrong somewhere ? :-
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_model.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") td = soup.find_all('td', class_="text", colspan="2", bgcolour="#FFFF99", href="download_model.php?fileid=") for h in td: h.a.get('href') link_root = 'http://web.archive.org/web/20050308033321/http://www.projectai.com:80/packages/fde.php'