From 7fb654821eb4c961df7513cc225694afb7490d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Sat, 11 May 2024 20:36:58 +0100 Subject: [PATCH] Add femslashfete to the prompt scraper --- promptscrape.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/promptscrape.py b/promptscrape.py index 8c155cb..047b255 100644 --- a/promptscrape.py +++ b/promptscrape.py @@ -242,6 +242,27 @@ try: except: pass +try: + with requests.Session() as s: + response = s.post(login_url , data) + fsf = "https://femslashfete.dreamwidth.org/tag/admin?style=light&tag=admin" + fsfpage = s.get(fsf) + fsfsoup = BeautifulSoup(fsfpage.content, "html.parser") + fsfprompts = fsfsoup.find_all("h3", string=lambda text: "challenge" in text.lower()) + fsfsubsoup = BeautifulSoup(str(fsfprompts[0]), "html.parser") + fsfurl = fsfsubsoup.find("a") + fsfprompt = (fsfurl["href"]) + fsfpromptnew = (fsfurl["href"] + "?style=light") + fsfpromptpage = s.get(fsfpromptnew) + fsfpromptsoup = BeautifulSoup(fsfpromptpage.content, "html.parser") + fsfprompttext = fsfpromptsoup.find(class_="entry-content") + fsftheprompt = fsfprompttext.find("b") + print("femslashfete (at least 100 words, must be femslash): \033[1m" + fsftheprompt.text.lower() + "\033[0m (" + fsfprompt + ")\n") + thefile.write("- [[" + fsfprompt + "][femslashfete]] (at least 100 words, must be femslash): *" + fsftheprompt.text.lower() + "*\n") + prompts.append({"source":"femslashfete","type":"comm","notes":"at least 100 words, must be femslash","prompt":fsftheprompt.text.lower(),"url":fsfprompt}) +except: + pass + # seems dead # try: # femslash = "https://femslashficlets.dreamwidth.org/tag/challenges?style=light&tag=challenges" @@ -447,7 +468,7 @@ if themonth != 4 and themonth != 8 and themonth != 12: 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") - prompts.append({"source":"sweetandshort","type":"comm","notes":"up to 300 words","prompt":sspictureprompttext.text.lower(),"url":sspictureprompts,"challenge":"picture prompt fun"}) + prompts.append({"source":"sweetandshort","type":"comm","notes":"up to 300 words","prompt":sspictureprompttext.text.lower(),"url":sspictureprompt,"challenge":"picture prompt fun"}) except: pass