Fix webmention and sorting

This commit is contained in:
Fundor333
2025-01-24 00:46:53 +01:00
parent 0b12ab243e
commit 3f14e8dccf
5 changed files with 12 additions and 9 deletions

View File

@@ -91,14 +91,15 @@ class WriterSyndication:
with open(path_file + ".json") as fp: with open(path_file + ".json") as fp:
data = json.load(fp) data = json.load(fp)
if data.get("syndication", False): if data.get("syndication", False):
data["syndication"] = list( data["syndication"] = sorted(
set(data["syndication"] + self.output[key]) set(data["syndication"] + self.output[key])
) )
else: else:
data["syndication"] = self.output[key] data["syndication"] = sorted(self.output[key])
else: else:
data = {"syndication": self.output[key]} data = {"syndication": sorted(self.output[key])}
with open(path_file + ".json", "w") as fp: with open(path_file + ".json", "w") as fp:
json.dump(data, fp) json.dump(data, fp)

View File

@@ -9,7 +9,7 @@ import hashlib
http_domain = "https://fundor333.com" http_domain = "https://fundor333.com"
domain = "fundor333.com" domain = "fundor333.com"
token = os.getenv("WEBMENTIONS_TOKEN") token = os.getenv("WEBMENTIONS_TOKEN")
since_days = 30 since_days = 31
class WebmentionFinder: class WebmentionFinder:
@@ -20,8 +20,10 @@ class WebmentionFinder:
self.http_domain = http_domain self.http_domain = http_domain
self.domain = domain self.domain = domain
self.token = token self.token = token
self.url = f"https://webmention.io/api/mentions.jf2?domain={self.domain}" self.url = (
"&token={self.token}&since={self.since_data.isoformat()}&per-page=999" f"https://webmention.io/api/mentions.jf2?domain={self.domain}"
+ f"&token={self.token}&since={self.since_data.isoformat()}&per-page=999"
)
def __clean_slug(self, slug: str): def __clean_slug(self, slug: str):
return hashlib.md5( return hashlib.md5(

View File

@@ -1 +1 @@
{"syndication": ["https://mastodon.social/@fundor333/113867466883978943", "https://bsky.app/profile/fundor333.bsky.social/post/3lgbdrqmupm27"]} {"syndication": ["https://bsky.app/profile/fundor333.bsky.social/post/3lgbdrqmupm27", "https://mastodon.social/@fundor333/113867466883978943"]}

View File

@@ -1 +1 @@
{"syndication": ["https://mastodon.social/@fundor333/113866397874321183", "https://bsky.app/profile/fundor333.bsky.social/post/3lgass72g4b2z"]} {"syndication": ["https://bsky.app/profile/fundor333.bsky.social/post/3lgass72g4b2z", "https://mastodon.social/@fundor333/113866397874321183"]}

View File

@@ -1 +1 @@
{"syndication": ["https://mastodon.social/@fundor333/113862648242036521", "https://bsky.app/profile/fundor333.bsky.social/post/3lg77j4tamc2t"]} {"syndication": ["https://bsky.app/profile/fundor333.bsky.social/post/3lg77j4tamc2t", "https://mastodon.social/@fundor333/113862648242036521"]}