Handle exceptions properly in prompt scraper

master
trémeur 11 months ago
parent bd85f72186
commit 31f4a80ddc

@ -18,20 +18,23 @@ today = int(date.today().strftime("%d"))
month = str(date.today().strftime("%B"))
monthstring = ".*" + month + ".*"
cent = "https://100words.dreamwidth.org/tag/!prompt?style=light&tag=%21prompt"
centpage = requests.get(cent)
centsoup = BeautifulSoup(centpage.content, "html.parser")
centprompts = centsoup.find_all("h3", string=lambda text: "prompt:" in text.lower())
centsubsoup = BeautifulSoup(str(centprompts[0]), "html.parser")
centurl = centsubsoup.find("a")
centprompt = (centurl["href"])
centpromptnew = (centurl["href"] + "?style=light")
centpromptpage = requests.get(centpromptnew)
centpromptsoup = BeautifulSoup(centpromptpage.content, "html.parser")
centprompttext = centpromptsoup.find(class_="entry-content")
centtheprompt = centprompttext.find("strong")
print("100words (100 words): \033[1m" + centtheprompt.text.lower() + "\033[0m (" + centprompt + ")\n")
thefile.write("- [[" + centprompt + "][100words]] (100 words): *" + centtheprompt.text.lower() + "*\n")
try:
cent = "https://100words.dreamwidth.org/tag/!prompt?style=light&tag=%21prompt"
centpage = requests.get(cent)
centsoup = BeautifulSoup(centpage.content, "html.parser")
centprompts = centsoup.find_all("h3", string=lambda text: "prompt:" in text.lower())
centsubsoup = BeautifulSoup(str(centprompts[0]), "html.parser")
centurl = centsubsoup.find("a")
centprompt = (centurl["href"])
centpromptnew = (centurl["href"] + "?style=light")
centpromptpage = requests.get(centpromptnew)
centpromptsoup = BeautifulSoup(centpromptpage.content, "html.parser")
centprompttext = centpromptsoup.find(class_="entry-content")
centtheprompt = centprompttext.find("strong")
print("100words (100 words): \033[1m" + centtheprompt.text.lower() + "\033[0m (" + centprompt + ")\n")
thefile.write("- [[" + centprompt + "][100words]] (100 words): *" + centtheprompt.text.lower() + "*\n")
except:
pass
# for this one we need to extract the right entry from a list, which may be an <ol> but may not be. also, need to use the right month, as next months prompts are posted in advance
# now defunct??
@ -65,40 +68,47 @@ thefile.write("- [[" + centprompt + "][100words]] (100 words): *" + centthepromp
# thefile.write("- [[" + thirtyoneprompt + "][31-days]] (any): *" + thirtyonetheprompt.lower() + "*\n")
ad = "https://anythingdrabble.dreamwidth.org/tag/mod!+post?style=light&tag=mod%21+post"
adpage = requests.get(ad)
adsoup = BeautifulSoup(adpage.content, "html.parser")
adprompts = adsoup.find_all("h3", string=lambda text: "prompt post" in text.lower())
adsubsoup = BeautifulSoup(str(adprompts[0]), "html.parser")
adurl = adsubsoup.find("a")
adprompt = (adurl["href"])
adpromptnew = (adurl["href"] + "?style=light")
adpromptpage = requests.get(adpromptnew)
adpromptsoup = BeautifulSoup(adpromptpage.content, "html.parser")
adprompttext = adpromptsoup.find(class_="entry-content")
adtheprompt = adprompttext.find("center")
adstrippable = str(adtheprompt.text)
while adstrippable[-1] == " ":
try:
ad = "https://anythingdrabble.dreamwidth.org/tag/mod!+post?style=light&tag=mod%21+post"
adpage = requests.get(ad)
adsoup = BeautifulSoup(adpage.content, "html.parser")
adprompts = adsoup.find_all("h3", string=lambda text: "prompt post" in text.lower())
adsubsoup = BeautifulSoup(str(adprompts[0]), "html.parser")
adurl = adsubsoup.find("a")
adprompt = (adurl["href"])
adpromptnew = (adurl["href"] + "?style=light")
adpromptpage = requests.get(adpromptnew)
adpromptsoup = BeautifulSoup(adpromptpage.content, "html.parser")
adprompttext = adpromptsoup.find(class_="entry-content")
adtheprompt = adprompttext.find("center")
adstrippable = str(adtheprompt.text)
while adstrippable[-1] == " ":
adstrippable = adstrippable[:-1]
print("anythingdrabble (100, 200, 300, 400, or 500 words): \033[1m" + adstrippable.lower() + "\033[0m (" + adprompt + ")\n")
thefile.write("- [[" + adprompt + "][anythingdrabble]] (100, 200, 300, 400, or 500 words): *" + adstrippable.lower() + "*\n")
print("anythingdrabble (100, 200, 300, 400, or 500 words): \033[1m" + adstrippable.lower() + "\033[0m (" + adprompt + ")\n")
thefile.write("- [[" + adprompt + "][anythingdrabble]] (100, 200, 300, 400, or 500 words): *" + adstrippable.lower() + "*\n")
except:
pass
dove = "https://dove-drabbles.dreamwidth.org/?style=light"
dovepage = requests.get(dove)
dovesoup = BeautifulSoup(dovepage.content, "html.parser")
doveprompts = dovesoup.find_all("h3", string=lambda text: "prompt post" in text.lower())
dovesubsoup = BeautifulSoup(str(doveprompts[0]), "html.parser")
doveurl = dovesubsoup.find("a")
doveprompt = (doveurl["href"])
dovepromptnew = (doveurl["href"] + "?style=light")
dovepromptpage = requests.get(dovepromptnew)
dovepromptsoup = BeautifulSoup(dovepromptpage.content, "html.parser")
doveprompttext = dovepromptsoup.find(class_="entry-content")
dovetheprompt = doveprompttext.find("i")
print("dove-drabbles (any): \033[1m" + dovetheprompt.text.lower() + "\033[0m (" + doveprompt + ")\n")
thefile.write("- [[" + doveprompt + "][dove-drabbles]] (any): *" + dovetheprompt.text.lower() + "*\n")
try:
dove = "https://dove-drabbles.dreamwidth.org/?style=light"
dovepage = requests.get(dove)
dovesoup = BeautifulSoup(dovepage.content, "html.parser")
doveprompts = dovesoup.find_all("h3", string=lambda text: "prompt post" in text.lower())
dovesubsoup = BeautifulSoup(str(doveprompts[0]), "html.parser")
doveurl = dovesubsoup.find("a")
doveprompt = (doveurl["href"])
dovepromptnew = (doveurl["href"] + "?style=light")
dovepromptpage = requests.get(dovepromptnew)
dovepromptsoup = BeautifulSoup(dovepromptpage.content, "html.parser")
doveprompttext = dovepromptsoup.find(class_="entry-content")
dovetheprompt = doveprompttext.find("i")
print("dove-drabbles (any): \033[1m" + dovetheprompt.text.lower() + "\033[0m (" + doveprompt + ")\n")
thefile.write("- [[" + doveprompt + "][dove-drabbles]] (any): *" + dovetheprompt.text.lower() + "*\n")
except:
pass
with requests.Session() as s:
try:
with requests.Session() as s:
response = s.post(login_url , data)
zone = "https://drabble-zone.dreamwidth.org/tag/mod-post?style=light&tag=mod-post"
zonepage = s.get(zone)
@ -128,25 +138,28 @@ with requests.Session() as s:
emotiontheprompt = emotionprompttext.find_all("span")[-1]
print("emotion100 (100 words or a multiple of 100): \033[1m" + emotiontheprompt.text.lower() + "\033[0m (" + emotionprompt + ")\n")
thefile.write("- [[" + emotionprompt + "][emotion100]] (100 words or a multiple of 100): *" + emotiontheprompt.text.lower() + "*\n")
except:
pass
# for this one, have to get prompts from comments
ffa = "https://fail-fandomanon.dreamwidth.org/?style=light"
ffapage = requests.get(ffa)
ffasoup = BeautifulSoup(ffapage.content, "html.parser")
ffaprompts = ffasoup.find_all("h3", string=lambda text: "ffa dw post" in text.lower())
ffapromptstrim = [x for x in ffaprompts if "Placeholder" not in str(x)]
ffasubsoup = BeautifulSoup(str(ffapromptstrim[0]), "html.parser")
ffaurl = ffasubsoup.find("a")
ffaprompt = (ffaurl["href"])
ffapromptnew = (ffaprompt + "?style=light")
ffapromptpage = requests.get(ffapromptnew)
ffapromptsoup = BeautifulSoup(ffapromptpage.content, "html.parser")
ffaprompttext = ffapromptsoup.find(id="comments")
ffaresoup = BeautifulSoup(str(ffaprompttext), "html.parser")
ffatheprompt = ffaresoup.find_all("h4",text=True)
ffacent = []
i = 1
while i < 8:
try:
ffa = "https://fail-fandomanon.dreamwidth.org/?style=light"
ffapage = requests.get(ffa)
ffasoup = BeautifulSoup(ffapage.content, "html.parser")
ffaprompts = ffasoup.find_all("h3", string=lambda text: "ffa dw post" in text.lower())
ffapromptstrim = [x for x in ffaprompts if "Placeholder" not in str(x)]
ffasubsoup = BeautifulSoup(str(ffapromptstrim[0]), "html.parser")
ffaurl = ffasubsoup.find("a")
ffaprompt = (ffaurl["href"])
ffapromptnew = (ffaprompt + "?style=light")
ffapromptpage = requests.get(ffapromptnew)
ffapromptsoup = BeautifulSoup(ffapromptpage.content, "html.parser")
ffaprompttext = ffapromptsoup.find(id="comments")
ffaresoup = BeautifulSoup(str(ffaprompttext), "html.parser")
ffatheprompt = ffaresoup.find_all("h4",text=True)
ffacent = []
i = 1
while i < 8:
ffapromptnew = (ffaprompt + "?page=" + str(i) + "&style=light")
ffapromptpage = requests.get(ffapromptnew)
ffapromptsoup = BeautifulSoup(ffapromptpage.content, "html.parser")
@ -158,7 +171,7 @@ while i < 8:
if "Re:" not in (str(each.get_text())) and "catch-up" not in (str(each.get_text())) and "Catch-Up" not in (str(each.get_text())):
ffacent.append(str(each.get_text()))
i += 1
if ffacent:
if ffacent:
ffacent = list(dict.fromkeys(ffacent))
ffacentnew = []
for x in ffacent:
@ -168,11 +181,14 @@ if ffacent:
ffaformat = "; ".join(ffacentnew)
print("fail-fandomanon (any): \033[1m" + ffaformat.lower() + "\033[0m (" + ffaprompt + ")\n")
thefile.write("- [[" + ffaprompt + "][fail-fandomanon]] (any): *" + ffaformat.lower() + "*\n")
except:
pass
# for this one, prompts are unavailable on tuesdays and wednesdays
weekprogress = datetime.now().weekday()
if not 0 < weekprogress < 3:
try:
weekprogress = datetime.now().weekday()
if not 0 < weekprogress < 3:
fandom = "https://fandomweekly.dreamwidth.org/?style=light&tag=%23challenge"
fandompage = requests.get(fandom)
fandomsoup = BeautifulSoup(fandompage.content, "html.parser")
@ -187,39 +203,48 @@ if not 0 < weekprogress < 3:
fandomtheprompt = fandomprompttext.find("td")
print("fandomweekly (any, competitive): \033[1m" + fandomtheprompt.text.lower() + "\033[0m (" + fandomprompt + ")\n")
thefile.write("- [[" + fandomprompt + "][fandomweekly]] (any, competitive): *" + fandomtheprompt.text.lower() + "*\n")
except:
pass
flash = "https://fan-flashworks.dreamwidth.org/?style=light&tag=admin"
flashpage = requests.get(flash)
flashsoup = BeautifulSoup(flashpage.content, "html.parser")
flashprompts = flashsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
flashsubsoup = BeautifulSoup(str(flashprompts[0]), "html.parser")
flashurl = flashsubsoup.find("a")
flashprompt = (flashurl["href"])
flashpromptnew = (flashurl["href"] + "?style=light")
flashpromptpage = requests.get(flashpromptnew)
flashpromptsoup = BeautifulSoup(flashpromptpage.content, "html.parser")
flashprompttext = flashpromptsoup.find(class_="entry-content")
flashtheprompt = flashprompttext.find("center")
print("fan-flashworks (any, cant post elsewhere until round is closed): \033[1m" + flashtheprompt.text.lower() + "\033[0m (" + flashprompt + ")\n")
thefile.write("- [[" + flashprompt + "][fan-flashworks]] (any, cant post elsewhere until round is closed): *" + flashtheprompt.text.lower() + "*\n")
try:
flash = "https://fan-flashworks.dreamwidth.org/?style=light&tag=admin"
flashpage = requests.get(flash)
flashsoup = BeautifulSoup(flashpage.content, "html.parser")
flashprompts = flashsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
flashsubsoup = BeautifulSoup(str(flashprompts[0]), "html.parser")
flashurl = flashsubsoup.find("a")
flashprompt = (flashurl["href"])
flashpromptnew = (flashurl["href"] + "?style=light")
flashpromptpage = requests.get(flashpromptnew)
flashpromptsoup = BeautifulSoup(flashpromptpage.content, "html.parser")
flashprompttext = flashpromptsoup.find(class_="entry-content")
flashtheprompt = flashprompttext.find("center")
print("fan-flashworks (any, cant post elsewhere until round is closed): \033[1m" + flashtheprompt.text.lower() + "\033[0m (" + flashprompt + ")\n")
thefile.write("- [[" + flashprompt + "][fan-flashworks]] (any, cant post elsewhere until round is closed): *" + flashtheprompt.text.lower() + "*\n")
except:
pass
femslash = "https://femslashficlets.dreamwidth.org/tag/challenges?style=light&tag=challenges"
femslashpage = requests.get(femslash)
femslashsoup = BeautifulSoup(femslashpage.content, "html.parser")
femslashprompts = femslashsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
femslashsubsoup = BeautifulSoup(str(femslashprompts[0]), "html.parser")
femslashurl = femslashsubsoup.find("a")
femslashprompt = (femslashurl["href"])
femslashpromptnew = (femslashurl["href"] + "?style=light")
femslashpromptpage = requests.get(femslashpromptnew)
femslashpromptsoup = BeautifulSoup(femslashpromptpage.content, "html.parser")
femslashprompttext = femslashpromptsoup.find(class_="entry-content")
femslashtheprompt = femslashprompttext.find("i")
if femslashtheprompt is not None:
try:
femslash = "https://femslashficlets.dreamwidth.org/tag/challenges?style=light&tag=challenges"
femslashpage = requests.get(femslash)
femslashsoup = BeautifulSoup(femslashpage.content, "html.parser")
femslashprompts = femslashsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
femslashsubsoup = BeautifulSoup(str(femslashprompts[0]), "html.parser")
femslashurl = femslashsubsoup.find("a")
femslashprompt = (femslashurl["href"])
femslashpromptnew = (femslashurl["href"] + "?style=light")
femslashpromptpage = requests.get(femslashpromptnew)
femslashpromptsoup = BeautifulSoup(femslashpromptpage.content, "html.parser")
femslashprompttext = femslashpromptsoup.find(class_="entry-content")
femslashtheprompt = femslashprompttext.find("i")
if femslashtheprompt is not None:
print("femslash-ficlets (1001000 words, F/F): \033[1m" + femslashtheprompt.text.lower() + "\033[0m (" + femslashprompt + ")\n")
thefile.write("- [[" + femslashprompt + "][femslashficlets]] (100 words or a multiple of 100): *" + femslashtheprompt.text.lower() + "*\n")
except:
pass
with requests.Session() as s:
try:
with requests.Session() as s:
response = s.post(login_url , data)
fffc = "https://fffc.dreamwidth.org/tag/!challenges?style=light&tag=%21challenges"
fffcpage = s.get(fffc)
@ -267,27 +292,33 @@ with requests.Session() as s:
fffcregulartheprompt = fffcregularprompttext.find("b")
print("fffc regular challenge (at least 100 words): \033[1m" + fffcregulartheprompt.text.lower() + "\033[0m (" + fffcregularprompt + ")\n")
thefile.write("- [[" + fffcregularprompt + "][fffc regular challenge]] (at least 100 words): *" + fffcregulartheprompt.text.lower() + "*\n")
except:
pass
ficlet = "https://ficlet-zone.dreamwidth.org/tag/challenge+post?style=light&tag=challenge+post"
ficletpage = requests.get(ficlet)
ficletsoup = BeautifulSoup(ficletpage.content, "html.parser")
ficletprompts = ficletsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
ficletsubsoup = BeautifulSoup(str(ficletprompts[0]), "html.parser")
ficleturl = ficletsubsoup.find("a")
ficletprompt = (ficleturl["href"])
ficletpromptnew = (ficleturl["href"] + "?style=light")
ficletpromptpage = requests.get(ficletpromptnew)
ficletpromptsoup = BeautifulSoup(ficletpromptpage.content, "html.parser")
ficletprompttext = ficletpromptsoup.find(class_="entry-content")
ficlettheprompt = ficletprompttext.find("a")
print("ficlet-zone (any): \033[1m" + ficlettheprompt.text.lower() + "\033[0m (" + ficletprompt + ")\n")
thefile.write("- [[" + ficletprompt + "][ficlet-zone]] (any): *" + ficlettheprompt.text.lower() + "*\n")
try:
ficlet = "https://ficlet-zone.dreamwidth.org/tag/challenge+post?style=light&tag=challenge+post"
ficletpage = requests.get(ficlet)
ficletsoup = BeautifulSoup(ficletpage.content, "html.parser")
ficletprompts = ficletsoup.find_all("h3", string=lambda text: "challenge" in text.lower())
ficletsubsoup = BeautifulSoup(str(ficletprompts[0]), "html.parser")
ficleturl = ficletsubsoup.find("a")
ficletprompt = (ficleturl["href"])
ficletpromptnew = (ficleturl["href"] + "?style=light")
ficletpromptpage = requests.get(ficletpromptnew)
ficletpromptsoup = BeautifulSoup(ficletpromptpage.content, "html.parser")
ficletprompttext = ficletpromptsoup.find(class_="entry-content")
ficlettheprompt = ficletprompttext.find("a")
print("ficlet-zone (any): \033[1m" + ficlettheprompt.text.lower() + "\033[0m (" + ficletprompt + ")\n")
thefile.write("- [[" + ficletprompt + "][ficlet-zone]] (any): *" + ficlettheprompt.text.lower() + "*\n")
except:
pass
# first calculate the hour of the month …
hourselapsed = (today - 1) * 24
hourstoday = int(datetime.now().strftime("%H"))
currenthour = (hourselapsed + hourstoday)
with requests.Session() as s:
try:
hourselapsed = (today - 1) * 24
hourstoday = int(datetime.now().strftime("%H"))
currenthour = (hourselapsed + hourstoday)
with requests.Session() as s:
response = s.post(login_url , data)
hourly = "https://hourlyprompts.dreamwidth.org/?style=light"
hourlypage = s.get(hourly)
@ -305,8 +336,11 @@ with requests.Session() as s:
hourlypromptthishour = str(hourlypromptmedian[0])[5:-5]
print("hourlyprompts (any): \033[1m" + hourlypromptthishour.lower() + "\033[0m (" + hourlyprompt + ")\n")
thefile.write("- [[" + hourlyprompt + "][hourlyprompts]] (any): *" + hourlypromptthishour.lower() + "*\n")
except:
pass
if 30 > today > 21:
try:
if 30 > today > 21:
ssbingo = "https://sweetandshort.dreamwidth.org/tag/challenge:+bingo?style=light&tag=challenge:+bingo"
ssbingopage = requests.get(ssbingo)
ssbingosoup = BeautifulSoup(ssbingopage.content, "html.parser")
@ -326,8 +360,11 @@ if 30 > today > 21:
ssbingofinal = "; ".join(ssbingoclean).lower()
print("sweet and short bingo (up to 300 words for two prompts, up to 600 words for four prompts): \033[1m" + ssbingofinal + "\033[0m (" + ssbingoprompt + ")\n")
thefile.write("- [[" + ssbingoprompt + "][sweet and short bingo]] (up to 300 words for two prompts, up to 600 words for four prompts): *" + ssbingofinal + "*\n")
except:
pass
if 16 > today > 7:
try:
if 16 > today > 7:
ssquicky = "https://sweetandshort.dreamwidth.org/tag/!new+challenge,challenge:+comment+quicky?mode=and&style=light&tag=%21new+challenge,challenge:+comment+quicky"
ssquickypage = requests.get(ssquicky)
ssquickysoup = BeautifulSoup(ssquickypage.content, "html.parser")
@ -351,27 +388,33 @@ if 16 > today > 7:
ssquickycprompt = "; ".join(ssquickycomments)
print("sweet and short comment quicky (up to 99 words): \033[1m" + ssquickycprompt.lower() + "\033[0m (" + ssquickyprompt + ")\n")
thefile.write("- [[" + ssquickyprompt + "][sweet and short comment quicky]] (up to 99 words): *" + ssquickycprompt.lower() + "*\n")
except:
pass
ssmonthly = "https://sweetandshort.dreamwidth.org/tag/!new+challenge,challenge:+10+out+of+20?mode=and&style=light&tag=%21new+challenge,challenge:+10+out+of+20"
ssmonthlypage = requests.get(ssmonthly)
ssmonthlysoup = BeautifulSoup(ssmonthlypage.content, "html.parser")
ssmonthlyprompts = ssmonthlysoup.find_all("h3")
ssmonthlysubsoup = BeautifulSoup(str(ssmonthlyprompts[0]), "html.parser")
ssmonthlyurl = ssmonthlysubsoup.find("a")
ssmonthlyprompt = (ssmonthlyurl["href"])
ssmonthlypromptnew = (ssmonthlyurl["href"] + "?style=light")
ssmonthlypromptpage = requests.get(ssmonthlypromptnew)
ssmonthlypromptsoup = BeautifulSoup(ssmonthlypromptpage.content, "html.parser")
ssmonthlyprompttext = ssmonthlypromptsoup.find(class_="entry-content")
ssmonthlypromptmedian = re.findall(r"<a name=\"cutid1\">.*", str(ssmonthlyprompttext))
ssmonthlypromptstripone = re.sub("<.*?>","",str(ssmonthlypromptmedian))
ssmonthlypromptstriptwo = re.sub("([a-z])- ","\\1; ",str(ssmonthlypromptstripone))
ssmonthlypromptstripthree = re.sub("- ","",str(ssmonthlypromptstriptwo))
ssmonthlypromptfinal = str(ssmonthlypromptstripthree)[2:-2]
print("sweet and short monthly prompts (up to 300 words [09 prompts], up to 900 words [1019 prompts], any [20 prompts]): \033[1m" + ssmonthlypromptfinal + "\033[0m (" + ssmonthlyprompt + ")\n")
thefile.write("- [[" + ssmonthlyprompt + "][sweet and short monthly prompts]] (up to 300 words [09 prompts], up to 900 words [1019 prompts], any [20 prompts]): *" + ssmonthlypromptfinal + "*\n")
try:
ssmonthly = "https://sweetandshort.dreamwidth.org/tag/!new+challenge,challenge:+10+out+of+20?mode=and&style=light&tag=%21new+challenge,challenge:+10+out+of+20"
ssmonthlypage = requests.get(ssmonthly)
ssmonthlysoup = BeautifulSoup(ssmonthlypage.content, "html.parser")
ssmonthlyprompts = ssmonthlysoup.find_all("h3")
ssmonthlysubsoup = BeautifulSoup(str(ssmonthlyprompts[0]), "html.parser")
ssmonthlyurl = ssmonthlysubsoup.find("a")
ssmonthlyprompt = (ssmonthlyurl["href"])
ssmonthlypromptnew = (ssmonthlyurl["href"] + "?style=light")
ssmonthlypromptpage = requests.get(ssmonthlypromptnew)
ssmonthlypromptsoup = BeautifulSoup(ssmonthlypromptpage.content, "html.parser")
ssmonthlyprompttext = ssmonthlypromptsoup.find(class_="entry-content")
ssmonthlypromptmedian = re.findall(r"<a name=\"cutid1\">.*", str(ssmonthlyprompttext))
ssmonthlypromptstripone = re.sub("<.*?>","",str(ssmonthlypromptmedian))
ssmonthlypromptstriptwo = re.sub("([a-z])- ","\\1; ",str(ssmonthlypromptstripone))
ssmonthlypromptstripthree = re.sub("- ","",str(ssmonthlypromptstriptwo))
ssmonthlypromptfinal = str(ssmonthlypromptstripthree)[2:-2]
print("sweet and short monthly prompts (up to 300 words [09 prompts], up to 900 words [1019 prompts], any [20 prompts]): \033[1m" + ssmonthlypromptfinal + "\033[0m (" + ssmonthlyprompt + ")\n")
thefile.write("- [[" + ssmonthlyprompt + "][sweet and short monthly prompts]] (up to 300 words [09 prompts], up to 900 words [1019 prompts], any [20 prompts]): *" + ssmonthlypromptfinal + "*\n")
except:
pass
if today > 14:
try:
if today > 14:
sspicture = "https://sweetandshort.dreamwidth.org/tag/!new+challenge,challenge:+picture+prompt+fun?mode=and&style=light&tag=%21new+challenge,challenge:+picture+prompt+fun"
sspicturepage = requests.get(sspicture)
sspicturesoup = BeautifulSoup(sspicturepage.content, "html.parser")
@ -386,18 +429,23 @@ if today > 14:
sspictureprompttext = sspicturepromptsoup.find("h3")
print("sweet and short picture prompts (up to 300 words): \033[1m" + sspictureprompttext.text.lower() + "\033[0m (" + sspictureprompt + ")\n")
thefile.write("- [[" + sspictureprompt + "][sweet and short picture prompts]] (up to 300 words): *" + sspictureprompttext.text.lower() + "*\n")
except:
pass
vocab = "https://vocab-drabbles.dreamwidth.org/?style=light&tag=challenge"
vocabpage = requests.get(vocab)
vocabsoup = BeautifulSoup(vocabpage.content, "html.parser")
vocabprompts = vocabsoup.find_all("h3")
vocabsubsoup = BeautifulSoup(str(vocabprompts[0]), "html.parser")
vocaburl = vocabsubsoup.find("a")
vocabprompt = (vocaburl["href"])
vocabpromptnew = (vocaburl["href"] + "?style=light")
vocabpromptpage = requests.get(vocabpromptnew)
vocabpromptsoup = BeautifulSoup(vocabpromptpage.content, "html.parser")
vocabprompttext = vocabpromptsoup.find(class_="entry-content")
vocabtheprompt = vocabprompttext.find("strong")
print("vocab-drabbles (50500 words): \033[1m" + vocabtheprompt.text.lower() + "\033[0m (" + vocabprompt + ")\n")
thefile.write("- [[" + vocabprompt + "][vocab-drabbles]] (50500 words): *" + vocabtheprompt.text.lower() + "*\n")
try:
vocab = "https://vocab-drabbles.dreamwidth.org/?style=light&tag=challenge"
vocabpage = requests.get(vocab)
vocabsoup = BeautifulSoup(vocabpage.content, "html.parser")
vocabprompts = vocabsoup.find_all("h3")
vocabsubsoup = BeautifulSoup(str(vocabprompts[0]), "html.parser")
vocaburl = vocabsubsoup.find("a")
vocabprompt = (vocaburl["href"])
vocabpromptnew = (vocaburl["href"] + "?style=light")
vocabpromptpage = requests.get(vocabpromptnew)
vocabpromptsoup = BeautifulSoup(vocabpromptpage.content, "html.parser")
vocabprompttext = vocabpromptsoup.find(class_="entry-content")
vocabtheprompt = vocabprompttext.find("strong")
print("vocab-drabbles (50500 words): \033[1m" + vocabtheprompt.text.lower() + "\033[0m (" + vocabprompt + ")\n")
thefile.write("- [[" + vocabprompt + "][vocab-drabbles]] (50500 words): *" + vocabtheprompt.text.lower() + "*\n")
except:
pass

Loading…
Cancel
Save