diff --git a/kuow_fetcher.py b/kuow_fetcher.py index 0c329cf..293cf9c 100644 --- a/kuow_fetcher.py +++ b/kuow_fetcher.py @@ -1,4 +1,5 @@ import requests +import yaml from bs4 import BeautifulSoup from mastodon import Mastodon @@ -8,10 +9,18 @@ url = ( + "/fragments?name=story_grid&source=homepage&view_id=1&page=1&per_page=12" ) log_file = "kuow_bot_logfile.txt" -mastodon = Mastodon(access_token="kuow_bot_mastodon.secret") +config = yaml.safe_load(open("config.yml")) +stadiamaps_api_key = config["stadiamaps"]["api_key"] +nominatim_url = config["nominatim"]["api_base_url"] +mastodon = Mastodon( + client_id=config["mastodon"]["client_id"], + client_secret=config["mastodon"]["client_secret"], + access_token=config["mastodon"]["access_token"], + api_base_url=config["mastodon"]["api_base_url"], +) -r = requests.get(url) -soup = BeautifulSoup(r.content, "html.parser") +kuow_response = requests.get(url) +soup = BeautifulSoup(kuow_response.content, "html.parser") articles = soup.find_all("span", class_="txt") # Reverse articles, so that if multiple new ones have been found, they'll be posted in order of when published articles.reverse()