mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 23:59:56 +08:00
fix: remove <br> in Twitter tweet title (#2796)
This commit is contained in:
@@ -27,7 +27,7 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, '<br>');
|
const formatText = (text, br) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, br);
|
||||||
const formatVideo = (media) => {
|
const formatVideo = (media) => {
|
||||||
let content = '';
|
let content = '';
|
||||||
const video = media.video_info.variants.reduce((video, item) => {
|
const video = media.video_info.variants.reduce((video, item) => {
|
||||||
@@ -71,7 +71,7 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => {
|
|||||||
const formatUrl = (item) => {
|
const formatUrl = (item) => {
|
||||||
let url = '';
|
let url = '';
|
||||||
item.entities.urls.forEach((u) => {
|
item.entities.urls.forEach((u) => {
|
||||||
url += `<a href="${u.expanded_url}" target="_blank">${u.expanded_url}</a>`;
|
url += `<a href="${u.expanded_url}" target="_blank" rel="noopener noreferrer">${u.expanded_url}</a>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
@@ -100,10 +100,10 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: `${showAuthor ? item.user.name + ': ' : ''}${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}`,
|
title: `${showAuthor ? item.user.name + ': ' : ''}${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text, '')}`,
|
||||||
description: `${showAuthor ? `<img width="15px" referrerpolicy="no-referrer" src="${item.user.profile_image_url_https}"><strong>${item.user.name}:</strong><br><br>` : ''}${
|
description: `${showAuthor ? `<img width="15px" referrerpolicy="no-referrer" src="${item.user.profile_image_url_https}"><strong>${item.user.name}:</strong><br><br>` : ''}${
|
||||||
item.in_reply_to_screen_name ? 'Re ' : ''
|
item.in_reply_to_screen_name ? 'Re ' : ''
|
||||||
}${formatText(item.full_text)}${url}${img}${quote}`,
|
}${formatText(item.full_text, '<br>')}${url}${img}${quote}`,
|
||||||
pubDate: new Date(item.created_at).toUTCString(),
|
pubDate: new Date(item.created_at).toUTCString(),
|
||||||
link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`,
|
link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user