Compare commits
No commits in common. "f901c89a64f11c4902d6649b0011e23594150309" and "42bcf5a16aa044dacb50e7235bc445312d7189f9" have entirely different histories.
f901c89a64
...
42bcf5a16a
4 changed files with 5 additions and 29 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2024 Liam Steckler
|
Copyright (c) 2023 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:
|
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:
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
mastodon:
|
|
||||||
client_id:
|
|
||||||
client_secret:
|
|
||||||
access_token:
|
|
||||||
api_base_url:
|
|
|
@ -1,5 +1,4 @@
|
||||||
import requests
|
import requests
|
||||||
import yaml
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
|
||||||
|
@ -9,18 +8,10 @@ url = (
|
||||||
+ "/fragments?name=story_grid&source=homepage&view_id=1&page=1&per_page=12"
|
+ "/fragments?name=story_grid&source=homepage&view_id=1&page=1&per_page=12"
|
||||||
)
|
)
|
||||||
log_file = "kuow_bot_logfile.txt"
|
log_file = "kuow_bot_logfile.txt"
|
||||||
config = yaml.safe_load(open("config.yml"))
|
mastodon = Mastodon(access_token="kuow_bot_mastodon.secret")
|
||||||
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"],
|
|
||||||
)
|
|
||||||
|
|
||||||
kuow_response = requests.get(url)
|
r = requests.get(url)
|
||||||
soup = BeautifulSoup(kuow_response.content, "html.parser")
|
soup = BeautifulSoup(r.content, "html.parser")
|
||||||
articles = soup.find_all("span", class_="txt")
|
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
|
# Reverse articles, so that if multiple new ones have been found, they'll be posted in order of when published
|
||||||
articles.reverse()
|
articles.reverse()
|
||||||
|
|
|
@ -1,13 +1,3 @@
|
||||||
beautifulsoup4==4.12.2
|
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
|
Mastodon.py==1.8.0
|
||||||
python-dateutil==2.8.2
|
|
||||||
python-magic==0.4.27
|
|
||||||
requests==2.28.2
|
requests==2.28.2
|
||||||
six==1.16.0
|
|
||||||
soupsieve==2.5
|
|
||||||
urllib3==1.26.18
|
|
||||||
|
|
Loading…
Reference in a new issue