Compare commits

...

1 commit

Author SHA1 Message Date
Thomas Zarebczan
6f64b4b16c
rss tests 2021-08-05 15:09:09 -04:00
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';
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) {
@ -16,7 +19,10 @@ function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, refer
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) {

View file

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