Attempt at fixing the slice
This commit is contained in:
parent
7fc974e744
commit
e6b7142829
22
index.ts
22
index.ts
|
@ -17,23 +17,16 @@ app.use(async (ctx) => {
|
||||||
"kontakt@midline.pl";
|
"kontakt@midline.pl";
|
||||||
parsed_data.rss.channel[0]["itunes:owner"][0]["itunes:name"] =
|
parsed_data.rss.channel[0]["itunes:owner"][0]["itunes:name"] =
|
||||||
"Arkadiusz Wieczorek, Kuba Orlik";
|
"Arkadiusz Wieczorek, Kuba Orlik";
|
||||||
parsed_data.rss.channel[0]["link"] =
|
parsed_data.rss.channel[0]["link"] = "https://www.internet-czas-dzialac.pl";
|
||||||
"https://www.internet-czas-dzialac.pl";
|
|
||||||
parsed_data.rss.channel[0]["itunes:keywords"][0] =
|
parsed_data.rss.channel[0]["itunes:keywords"][0] =
|
||||||
parsed_data.rss.channel[0]["itunes:keywords"][0]
|
parsed_data.rss.channel[0]["itunes:keywords"][0].split(" ").toString();
|
||||||
.split(" ")
|
|
||||||
.toString();
|
|
||||||
parsed_data.rss.channel[0]["itunes:summary"][0] =
|
parsed_data.rss.channel[0]["itunes:summary"][0] =
|
||||||
parsed_data.rss.channel[0]["itunes:summary"][0].replace(
|
parsed_data.rss.channel[0]["itunes:summary"][0].replace(
|
||||||
/(<([^>]+)>)/gi,
|
/(<([^>]+)>)/gi,
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
|
||||||
for (
|
for (let i = 0; i < parsed_data.rss.channel[0]["atom:link"].length; i++) {
|
||||||
let i = 0;
|
|
||||||
i < parsed_data.rss.channel[0]["atom:link"].length;
|
|
||||||
i++
|
|
||||||
) {
|
|
||||||
const atomLink = parsed_data.rss.channel[0]["atom:link"][i];
|
const atomLink = parsed_data.rss.channel[0]["atom:link"][i];
|
||||||
|
|
||||||
if (atomLink.$.rel === "self") {
|
if (atomLink.$.rel === "self") {
|
||||||
|
@ -47,18 +40,15 @@ app.use(async (ctx) => {
|
||||||
|
|
||||||
item["guid"][0].$.isPermaLink = item["guid"][0].$.isPermalink;
|
item["guid"][0].$.isPermaLink = item["guid"][0].$.isPermalink;
|
||||||
delete item["guid"][0].$.isPermalink;
|
delete item["guid"][0].$.isPermalink;
|
||||||
item["itunes:subtitle"][0].length < 255
|
const subtitle = item["itunes:subtitle"][0];
|
||||||
? item["itunes:subtitle"][0]
|
subtitle.length < 254 ? subtitle : subtitle.slice(0, 254) + "…";
|
||||||
: item["itunes:subtitle"][0].slice(0, 255) + "…";
|
|
||||||
item["itunes:summary"][0] = item["itunes:summary"][0].replace(
|
item["itunes:summary"][0] = item["itunes:summary"][0].replace(
|
||||||
/(<([^>]+)>)/gi,
|
/(<([^>]+)>)/gi,
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
if (item["title"][0].match(/#[0-9]*/)[0].substring(1) !== "0") {
|
if (item["title"][0].match(/#[0-9]*/)[0].substring(1) !== "0") {
|
||||||
try {
|
try {
|
||||||
last_index = item["title"][0]
|
last_index = item["title"][0].match(/#[1-9][0-9]*/)[0].substring(1);
|
||||||
.match(/#[1-9][0-9]*/)[0]
|
|
||||||
.substring(1);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
last_index = last_index + 1;
|
last_index = last_index + 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user