Skip to content

Instantly share code, notes, and snippets.

Created May 6, 2022
What would you like to do?
anagram words
import pathlib
import sys
from icecream import ic
import requests
term = "weather"
words = set([])
api_url = "{}&t=500&a=n".format(term)
response = requests.get(api_url)
pat_head = "Displaying all:"
pat_done = "<script>document.body"
ignore = True
for i, line in enumerate(response.text.split("\n")):
if pat_done in line:
ignore = True
if not ignore:
for word in line.strip().lstrip("</b><br>").rstrip("<br>").split(" "):
if ignore and pat_head in line:
ignore = False
print(len(words), words)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment