Created
October 10, 2020 04:09
-
-
Save keithstellyes/896a7de4077e7afaf38b24b80af17116 to your computer and use it in GitHub Desktop.
a script to download articles (like old broken ones from 2012) on overclock.net forums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tested on https://www.overclock.net/threads/haswell-overclocking-guide-with-statistics.1411077/ | |
from bs4 import BeautifulSoup | |
import requests, sys, json | |
r = requests.get(sys.argv[1]) | |
f = open('tmp.html', 'w') | |
f.write(r.text) | |
f.close() | |
soup = BeautifulSoup(open('tmp.html', 'r')) | |
data = json.loads(soup.find('script', type='application/ld+json').contents[0]) | |
body = data['articleBody'] | |
print('writing to out.html') | |
f = open('out.html', 'w') | |
f.write(body) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment