diff --git a/LICENSE b/LICENSE index 5baee6c..f795c23 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Liam Steckler +Copyright (c) 2024 Liam Steckler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/config-sample.yml b/config-sample.yml new file mode 100644 index 0000000..61137b9 --- /dev/null +++ b/config-sample.yml @@ -0,0 +1,5 @@ +mastodon: + client_id: + client_secret: + access_token: + api_base_url: 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() diff --git a/requirements.txt b/requirements.txt index 4029575..f406dab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,13 @@ beautifulsoup4==4.12.2 +blurhash==1.1.4 +certifi==2023.11.17 +charset-normalizer==3.3.2 +decorator==5.1.1 +idna==3.6 Mastodon.py==1.8.0 -requests==2.28.2 \ No newline at end of file +python-dateutil==2.8.2 +python-magic==0.4.27 +requests==2.28.2 +six==1.16.0 +soupsieve==2.5 +urllib3==1.26.18