Add new Webmention

This commit is contained in:
fundor333
2025-01-20 23:34:55 +01:00
parent a97024bc2b
commit 718deed247
4 changed files with 22 additions and 7 deletions

View File

@@ -21,6 +21,18 @@ jobs:
with:
node-version: 12.x
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip" # caching pip dependencies
- name: Install Pip dependencies
run: pip install -r requirements.txt
- name: Fetch Syndication
run: python ./syndication-collector.py
- name: Fetch webmentions
env:
WEBMENTIONS_TOKEN: ${{ secrets.WEBMENTIONS_TOKEN }}

View File

@@ -36,7 +36,8 @@ cache: ## Clean the cache
@hugo --gc
clean: cache gomodule ## Clean the directory of the project of chache e meta file and other things
@find . -type d -empty -delete
.PHONY: run
run: clean ## Build the site cleaning all
@hugo --minify
@@ -57,7 +58,6 @@ deploy: clean characters ## Ready to deploy
@npm update
@hugo mod get -u
@hugo --minify
@find . -type d -empty -delete
@python mastodon2hugo.py @fundor333@micro.blog
@python mastodon2hugo.py @fundor333@mastodon.social

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
feedparser==6.0.11

View File

@@ -27,7 +27,7 @@ class MastodonFinder:
if output.get(e, False):
output[e].append(link)
else:
output[e] = [link]
output[e] = [link.strip()]
else:
print("Failed to get RSS feed. Status code:", feed.status)
@@ -46,15 +46,17 @@ class WriterSyndication:
for key in self.output.keys():
original_path = key.split(self.domain)[1]
path_list = original_path.split('/')
path_list = [x for x in path_list if x.strip()]
filename = path_list.pop()
path_folder = os.path.join('data', "syndication", *path_list)
Path(path_folder).mkdir(parents=True, exist_ok=True)
path_file = os.path.normpath(original_path)
print(path_folder)
path_file = os.path.join(path_folder, filename)
with open(path_file, 'w') as fp:
json.dump(self.output[key], fp)
json.dump({"syndication": self.output[key]}, fp)
def run(self):
self.data_gathering()