Skip to content

Instantly share code, notes, and snippets.

@okiwan
Created May 20, 2022 18:34
Show Gist options
  • Select an option

  • Save okiwan/ad24116c1a9033eaa0c81b44631b71d3 to your computer and use it in GitHub Desktop.

Select an option

Save okiwan/ad24116c1a9033eaa0c81b44631b71d3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re
import os
handler = open("index.html", "r")
data = handler.readlines()
expression = re.compile(r'".*/(pc-engine-fan-.*)/.*"')
final_links = []
for line in data:
if not 'pc-engine-fan' in line:
continue
links = line.split("<li>")
for link in links:
matches = expression.findall(link)
if matches:
final_links.append(matches[0])
print("#!/usr/bin/env bash")
for idx, link in enumerate(final_links):
parts = link.split("-")
command = f"wget https://archive.org/download/{link}/{parts[0].upper()}%20{parts[1].capitalize()}%20{parts[2].capitalize()}%20-%20{parts[3].capitalize()}%20{parts[4]}.pdf"
print(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment