add channelurlfixer to channels
This commit is contained in:
parent
2d7b1ab443
commit
bd5d8d5f90
@ -196,6 +196,15 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
res.redirect("/");
|
res.redirect("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function channelurlfixer(text) {
|
||||||
|
// Create a regular expression to match <a> tags with href containing "/channel/"
|
||||||
|
const regex = /<a\s+href="\/channel\/([^"]+)"/g;
|
||||||
|
// Replace matching <a> tags with the modified href attribute
|
||||||
|
const updatedDescription = text.replace(regex, '<a href="/channel?id=$1"');
|
||||||
|
return updatedDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
app.get("/channel/", async (req, res) => {
|
app.get("/channel/", async (req, res) => {
|
||||||
const { fetch } = await import("undici");
|
const { fetch } = await import("undici");
|
||||||
try {
|
try {
|
||||||
@ -268,6 +277,8 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
|
|
||||||
const pronoun = "no pronouns :c";
|
const pronoun = "no pronouns :c";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([
|
var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([
|
||||||
getChannelData(channelUrl),
|
getChannelData(channelUrl),
|
||||||
getChannelData(shortsUrl),
|
getChannelData(shortsUrl),
|
||||||
@ -334,6 +345,7 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
j: "",
|
j: "",
|
||||||
dnoreplace:"",
|
dnoreplace:"",
|
||||||
sort: sort_by,
|
sort: sort_by,
|
||||||
|
channelurlfixer,
|
||||||
stream,
|
stream,
|
||||||
tj,
|
tj,
|
||||||
c,
|
c,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user