mirror of
https://github.com/lalanza808/monero.fail.git
synced 2025-08-14 09:55:30 -04:00
split resources out
This commit is contained in:
parent
726d2766e8
commit
2fb28e90fb
16 changed files with 532 additions and 481 deletions
34
scrape.py
34
scrape.py
|
@ -4,28 +4,28 @@ import os
|
|||
import requests
|
||||
import bs4
|
||||
|
||||
os.system('mkdir -p infodump/thumbs')
|
||||
url = 'https://moneroinfodump.neocities.org/'
|
||||
os.system("mkdir -p infodump/thumbs")
|
||||
url = "https://moneroinfodump.neocities.org/"
|
||||
contents = requests.get(url, timeout=15).content
|
||||
soup = bs4.BeautifulSoup(contents, 'html.parser')
|
||||
images = soup.find_all('img')
|
||||
links = soup.find_all('a')
|
||||
soup = bs4.BeautifulSoup(contents, "html.parser")
|
||||
images = soup.find_all("img")
|
||||
links = soup.find_all("a")
|
||||
|
||||
for image in images:
|
||||
img = image.get('src')
|
||||
if img.startswith('http'):
|
||||
os.system(f'wget -q --no-clobber -O infodump/{os.path.basename(img)} {img}')
|
||||
image['src'] = os.path.basename(img)
|
||||
elif img.startswith('data:image/png'):
|
||||
img = image.get("src")
|
||||
if img.startswith("http"):
|
||||
os.system(f"wget -q --no-clobber -O infodump/{os.path.basename(img)} {img}")
|
||||
image["src"] = os.path.basename(img)
|
||||
elif img.startswith("data:image/png"):
|
||||
pass
|
||||
else:
|
||||
os.system(f'wget -q --no-clobber -O infodump/{img} {img}')
|
||||
image['src'] = img
|
||||
os.system(f"wget -q --no-clobber -O infodump/{img} {img}")
|
||||
image["src"] = img
|
||||
|
||||
for link in links:
|
||||
href = link.get('href')
|
||||
if href and href.startswith('https://i.imgur.com'):
|
||||
link['href'] = os.path.basename(href)
|
||||
href = link.get("href")
|
||||
if href and href.startswith("https://i.imgur.com"):
|
||||
link["href"] = os.path.basename(href)
|
||||
|
||||
with open('infodump/index.html', 'w') as f:
|
||||
f.write(str(soup))
|
||||
with open("infodump/index.html", "w") as f:
|
||||
f.write(str(soup))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue