Fix some RSS issues

This commit is contained in:
Thomas Zarebczan 2022-02-13 15:25:18 -05:00
parent 11338170e7
commit c34840a4d4
No known key found for this signature in database
GPG key ID: D505010BDB4364BC
2 changed files with 5 additions and 3 deletions

View file

@ -6,7 +6,7 @@ function generateStreamUrl(claimName, claimId) {
return `${LBRY_WEB_STREAMING_API}/content/claims/${encodeURIComponent(claimName) return `${LBRY_WEB_STREAMING_API}/content/claims/${encodeURIComponent(claimName)
.replace(/'/g, '%27') .replace(/'/g, '%27')
.replace(/\(/g, '%28') .replace(/\(/g, '%28')
.replace(/\)/g, '%29')}/${claimId}/stream`; .replace(/\)/g, '%29')}/${claimId}/${encodeURIComponent(claimName)}`;
} }
function generateEmbedUrl(claimName, claimId, startTime, referralLink) { function generateEmbedUrl(claimName, claimId, startTime, referralLink) {

View file

@ -218,11 +218,12 @@ const getFormattedDescription = (claim) => replaceLineFeeds(claim.value.descript
function generateFeed(feedLink, channelClaim, claimsInChannel) { function generateFeed(feedLink, channelClaim, claimsInChannel) {
// --- Channel --- // --- Channel ---
let channelTitle = (channelClaim.value && channelClaim.value.title) || channelClaim.name; let channelTitle = (channelClaim.value && channelClaim.value.title) || channelClaim.name;
let channelURL = URL + '/' + channelClaim.canonical_url.replace('lbry://', '').replace(/#/g, ':');
const feed = new Rss({ const feed = new Rss({
title: channelTitle + ' on ' + SITE_NAME, title: channelTitle + ' on ' + SITE_NAME,
description: getFormattedDescription(channelClaim), description: getFormattedDescription(channelClaim),
feed_url: feedLink, feed_url: feedLink,
site_url: (channelClaim.value && channelClaim.value.website_url) || URL, site_url: (channelClaim.value && channelClaim.value.website_url) || channelURL,
image_url: (channelClaim.value && channelClaim.value.thumbnail && channelClaim.value.thumbnail.url) || undefined, image_url: (channelClaim.value && channelClaim.value.thumbnail && channelClaim.value.thumbnail.url) || undefined,
language: getLanguageValue(channelClaim), language: getLanguageValue(channelClaim),
custom_namespaces: { itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd' }, custom_namespaces: { itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd' },
@ -253,7 +254,8 @@ function generateFeed(feedLink, channelClaim, claimsInChannel) {
const description = thumbnailHtml + getFormattedDescription(c); const description = thumbnailHtml + getFormattedDescription(c);
const url = `${URL}/${encodeWithSpecialCharEncode(c.name)}:${c.claim_id}`; const url = `${URL}/${encodeWithSpecialCharEncode(c.name)}:${c.claim_id}`;
const date = c.release_time ? c.release_time * 1000 : c.meta && c.meta.creation_timestamp * 1000; const date =
c.value && c.value.release_time ? c.value.release_time * 1000 : c.meta && c.meta.creation_timestamp * 1000;
feed.item({ feed.item({
title: title, title: title,