Compare commits
No commits in common. "42bcf5a16aa044dacb50e7235bc445312d7189f9" and "f901c89a64f11c4902d6649b0011e23594150309" have entirely different histories.
42bcf5a16a
...
f901c89a64
4 changed files with 29 additions and 5 deletions
2
LICENSE
2
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:
|
||||
|
||||
|
|
5
config-sample.yml
Normal file
5
config-sample.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
mastodon:
|
||||
client_id:
|
||||
client_secret:
|
||||
access_token:
|
||||
api_base_url:
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue