Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DONE] Improve RSS Feeds #1215

Merged
merged 6 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions pod/video/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.contrib.sites.shortcuts import get_current_site
from django.urls import reverse
from django.shortcuts import get_object_or_404
from django.utils.html import format_html

from .context_processors import get_available_videos

Expand Down Expand Up @@ -189,11 +188,10 @@ def items(self, obj):

def item_title(self, item) -> str:
sub = re.sub(r"[\x00-\x08\x0B-\x0C\x0E-\x1F]", "", item.title)
return "%s | %s" % (item.owner.get_full_name(), sub)
return sub

def item_link(self, item) -> str:
url = "".join([self.author_link, item.get_absolute_url()])
url += "?is_iframe=true"
return url

def item_author_name(self, item):
Expand All @@ -212,20 +210,8 @@ def item_author_link(self, item) -> str:
)

def item_description(self, item) -> str:
thumbnail_url = "".join([self.prefix, item.get_thumbnail_url().replace("//", "")])
title = re.sub(r"[\x00-\x08\x0B-\x0C\x0E-\x1F]", "", item.title)
img = format_html(
'<img style="max-width:100px" '
'src="%s" alt="%s" loading="lazy"/>'
% (
thumbnail_url,
title.replace("{", "").replace("}", "").replace('"', "'"),
)
)
description = "%s<br/>" % img
sub = re.sub(r"[\x00-\x08\x0B-\x0C\x0E-\x1F]", "", item.description)
# use re sub to remove Control characters are not supported in XML 1.0
description += sub # item.description
description = re.sub(r"[\x00-\x08\x0B-\x0C\x0E-\x1F]", "", item.description) # item.description
description += "<br/> %s: %s" % (_("Duration"), item.duration_in_time)
return description

Expand Down
Loading