Compare commits

..

No commits in common. "f69c092548518f7ca2901ed21e9a0a97b360799b" and "539d3fa6d04455bc5aab2930aa7c43c49a44ea91" have entirely different histories.

3 changed files with 6 additions and 25 deletions

View File

@ -5,7 +5,6 @@ from hashlib import md5
from ast import literal_eval as make_tuple
from pathlib import Path
from urllib.parse import urlparse
from re import sub
import arrow
import feedparser
@ -58,12 +57,12 @@ def create_frontmatter(entry):
published = arrow.get(published)
if "author" in entry:
author = sub('"', '\\"', entry.author)
author = entry.author
else:
author = ""
if "title" in entry:
title = sub('"', '\\"', entry.title)
title = entry.title
else:
title = ""

View File

@ -1,7 +1,6 @@
import os
import shutil
from pathlib import Path
from re import sub
import jinja2
import requests
@ -69,9 +68,7 @@ def create_post(post_directory, post_metadata):
template_dir = os.path.join(Path(__file__).parent.resolve(), "templates")
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
name = post_metadata['account']['display_name']
name = sub('"', '\\"', name)
post_metadata['account']['display_name'] = name
env.filters["localize_media_url"] = localize_media_url
env.filters["filter_mastodon_urls"] = filter_mastodon_urls

View File

@ -100,26 +100,11 @@ def update_post(post_directory, video_metadata, host):
def main():
v = peertube.VideoApi(client)
count = 100
page = 0
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
response = v.videos_get(count=100, filter="local", tags_one_of="publish")
videos = response.to_dict()
total = videos['total']
videos = videos['data']
total -= count
if total > 0:
to_download = total // count
last_page = total % count
for i in range(to_download):
page += 1
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
videos += response.to_dict()['data']
if last_page > 0:
page += 1
response = v.videos_get(count=count, filter="local", tags_one_of="publish", start=page)
videos += response.to_dict()['data'][-1*last_page:]
videos = videos["data"]
output_dir = os.environ.get("OUTPUT_DIR")