Add (dodgy) boolean for title inclusion in fic headers

master
trémeur 2 years ago
parent b87e0fbfbc
commit ec80f04586

@ -15,8 +15,10 @@ thefile = open("ficheader.html", "a")
with requests.Session() as s: with requests.Session() as s:
response = s.post(login_url , data) response = s.post(login_url , data)
print("Work ID: ") print("Work ID:")
id = input() id = input()
print("Use title? (y/n)")
thetitle = input()
url = "https://archiveofourown.org/works/" + str(id) url = "https://archiveofourown.org/works/" + str(id)
ficpage = s.get(url) ficpage = s.get(url)
ficsoup = BeautifulSoup(ficpage.content, "html.parser") ficsoup = BeautifulSoup(ficpage.content, "html.parser")
@ -138,7 +140,10 @@ with requests.Session() as s:
mastersoup = BeautifulSoup(masterlist.content, "html.parser") mastersoup = BeautifulSoup(masterlist.content, "html.parser")
ficno = int(mastersoup.find("span", class_="ficno").text.strip()) + 1 ficno = int(mastersoup.find("span", class_="ficno").text.strip()) + 1
thefile.write("<div class=\"fic\" id=\"fic" + str(ficno) + "\">\n") thefile.write("<div class=\"fic\" id=\"fic" + str(ficno) + "\">\n")
if thetitle == "y":
thefile.write(" <h1><span class=\"ficno\">" + str(ficno) + "</span> <span class=\"fictitle\">" + title + "</span></h1>\n") thefile.write(" <h1><span class=\"ficno\">" + str(ficno) + "</span> <span class=\"fictitle\">" + title + "</span></h1>\n")
else:
thefile.write(" <h1><span class=\"ficno\">" + str(ficno) + "</span></h1>\n")
thefile.write(" <ul class=\"ficmeta\">\n") thefile.write(" <ul class=\"ficmeta\">\n")
thefile.write(" <li class=\"ficdate\">" + prazedate + "</li>\n") thefile.write(" <li class=\"ficdate\">" + prazedate + "</li>\n")
thefile.write(" <li class=\"wordcount\">" + str(words) + "</li>\n") thefile.write(" <li class=\"wordcount\">" + str(words) + "</li>\n")

Loading…
Cancel
Save