rss tests

This commit is contained in:
Thomas Zarebczan 2021-08-05 15:09:09 -04:00
parent 8bec365fb4
commit 6f64b4b16c
No known key found for this signature in database
GPG key ID: D505010BDB4364BC
2 changed files with 11 additions and 4 deletions

View file

@ -3,7 +3,10 @@ const { URL, LBRY_WEB_STREAMING_API } = require('../../config');
const CONTINENT_COOKIE = 'continent'; const CONTINENT_COOKIE = 'continent';
function generateStreamUrl(claimName, claimId) { function generateStreamUrl(claimName, claimId) {
return `${LBRY_WEB_STREAMING_API}/content/claims/${claimName}/${claimId}/stream`; return `${LBRY_WEB_STREAMING_API}/content/claims/${encodeURIComponent(claimName)
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')}/${claimId}/stream`;
} }
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, referralLink) { function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, referralLink) {
@ -16,7 +19,10 @@ function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, refer
urlParams.append('r', referralLink); urlParams.append('r', referralLink);
} }
return `${URL}/$/embed/${encodeURIComponent(claimName).replace(/'/g, '%27')}/${claimId}?${urlParams.toString()}`; return `${URL}/$/embed/${encodeURIComponent(claimName)
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')}/${claimId}?${urlParams.toString()}`;
} }
function generateDownloadUrl(claimName, claimId) { function generateDownloadUrl(claimName, claimId) {

View file

@ -46,7 +46,7 @@ async function getClaimsFromChannel(claimId, count) {
page_size: count, page_size: count,
has_source: true, has_source: true,
claim_type: 'stream', claim_type: 'stream',
order_by: ['creation_timestamp'], order_by: ['release_time'],
no_totals: true, no_totals: true,
}; };
@ -70,7 +70,8 @@ const generateEnclosureForClaimContent = (claim) => {
case 'document': case 'document':
case 'software': case 'software':
return { return {
url: generateStreamUrl(claim.name, claim.claim_id), url:
generateStreamUrl(claim.name, claim.claim_id) + (value.source && value.source.media_type.split('/')[0]) || '',
type: (value.source && value.source.media_type) || undefined, type: (value.source && value.source.media_type) || undefined,
size: (value.source && value.source.size) || 0, // Per spec, 0 is a valid fallback. size: (value.source && value.source.size) || 0, // Per spec, 0 is a valid fallback.
}; };