Initial commit
This commit is contained in:
parent
603b6c6e4f
commit
f496c54dc1
2 changed files with 20 additions and 0 deletions
18
make_binder.py
Normal file
18
make_binder.py
Normal 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
2
stars.txt
Normal 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
|
Loading…
Reference in a new issue