diff --git a/promptscrape.py b/promptscrape.py index 6a4a6f4..cb4ec4b 100644 --- a/promptscrape.py +++ b/promptscrape.py @@ -259,7 +259,7 @@ 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") -# slightly different format here, taking prompt from the post title +# grabbing two different instances of the same tag within the post vocab = "https://vocab-drabbles.dreamwidth.org/?style=light&tag=challenge" vocabpage = requests.get(vocab) vocabsoup = BeautifulSoup(vocabpage.content, "html.parser") @@ -270,6 +270,9 @@ vocabprompt = (vocaburl["href"]) vocabpromptnew = (vocaburl["href"] + "?style=light") vocabpromptpage = requests.get(vocabpromptnew) vocabpromptsoup = BeautifulSoup(vocabpromptpage.content, "html.parser") -vocabtheprompt = vocabpromptsoup.find(class_="entry-title") -print("vocab-drabbles (50–500 words): \033[1m" + vocabtheprompt.text.lower() + "\033[0m (" + vocabprompt + ")\n") -thefile.write("- [[" + vocabprompt + "][vocab-drabbles]] (50–500 words): *" + vocabtheprompt.text.lower() + "*\n") +vocablist = [] +for listitem in vocabpromptsoup.find_all("strong"): + vocablist.append(listitem.text.lower()) +vocabformat = "; ".join(vocablist) +print("vocab-drabbles (50–500 words): \033[1m" + vocabformat + "\033[0m (" + vocabprompt + ")\n") +thefile.write("- [[" + vocabprompt + "][vocab-drabbles]] (50–500 words): *" + vocabformat + "*\n")