Add new Webmention
This commit is contained in:
12
.github/workflows/webmentions.yml
vendored
12
.github/workflows/webmentions.yml
vendored
@@ -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 }}
|
||||
|
||||
2
makefile
2
makefile
@@ -36,6 +36,7 @@ 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
|
||||
@@ -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
1
requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
feedparser==6.0.11
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user