Initial commit

This commit is contained in:
Anthony Wang 2020-11-27 18:08:09 -06:00
parent 603b6c6e4f
commit f496c54dc1
Signed by: a
GPG key ID: 6FD3502572299774
2 changed files with 20 additions and 0 deletions

18
make_binder.py Normal file
View file

@ -0,0 +1,18 @@
# import pdfkit
import weasyprint
import re
file = open("stars.txt", "r")
links = file.readlines()
for link in links:
print("Downloading: " + link)
# print(re.sub(r'(?u)[^-\w.]', '', link[5:])+".pdf")
try:
# weasyprint seems faster?
# pdfkit.from_url(link, re.sub(r'(?u)[^-\w.]', '', link[5:])+".pdf")
pdf = weasyprint.HTML(link).write_pdf()
open(re.sub(r'(?u)[^-\w.]', '', link[5:]), 'wb').write(pdf)
except:
# Ignore exceptions
# Probably not a good idea
pass

2
stars.txt Normal file
View file

@ -0,0 +1,2 @@
https://en.wikipedia.org/wiki/Hertzsprung%E2%80%93Russell_diagram
https://astronomy.swin.edu.au/cosmos/h/hertzsprung-russell+diagram