mirror of
https://github.com/dariusk/rss-to-activitypub.git
synced 2024-11-22 09:19:19 +02:00
parent
2b4479fbe8
commit
54f61e6dc2
|
@ -70,7 +70,7 @@ return new Promise((resolve, reject) => {
|
||||||
// FIX THIS
|
// FIX THIS
|
||||||
item = transformContent(item);
|
item = transformContent(item);
|
||||||
//console.log(item.urls);
|
//console.log(item.urls);
|
||||||
let message = `<p><a href="${item.link}">${item.title}</a></p><p>${item.content || ''}</p>`;
|
let message = `<p><a href="${item.link}">${item.title}</a></p>${item.content || ''}`;
|
||||||
if (item.enclosure && item.enclosure.url && item.enclosure.url.includes('.mp3')) {
|
if (item.enclosure && item.enclosure.url && item.enclosure.url.includes('.mp3')) {
|
||||||
message += `<p><a href="${item.enclosure.url}">${item.enclosure.url}</a></p>`;
|
message += `<p><a href="${item.enclosure.url}">${item.enclosure.url}</a></p>`;
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,8 @@ function transformContent(item) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// couple of hacky regexes to make sure we clean up everything
|
// couple of hacky regexes to make sure we clean up everything
|
||||||
item.content = $('body').html().replace(/^(\n|\r)/,'').replace(/>\r+</,'><').replace(/ +/g, '');
|
item.content = $('body').html().replace(/^(\n|\r)/g,'').replace(/>\r+</g,'><').replace(/ +/g, '');
|
||||||
item.content = item.content.replace(/^(\n|\r)/,'').replace(/>\r+</,'><').replace(/>\s*</g,'><').replace(/>\u200B+</g,'><').replace(/ +/g, '').replace(/<p><\/p>/g,'');
|
item.content = item.content.replace(/^(\n|\r)/g,'').replace(/>\r+</g,'><').replace(/>\s*</g,'><').replace(/​/g,'').replace(/>\u200B+</g,'><').replace(/ +/g, '').replace(/<p><\/p>/g,'').replace(/(<br\/?>)+/g,'<br>');
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue