Woopread: Remove links

This commit is contained in:
Rajarshee Chatterjee
2021-06-12 11:08:28 +05:30
parent 7b72545b85
commit cfeca542e6
2 changed files with 5 additions and 7 deletions
+4 -2
View File
@@ -139,8 +139,10 @@ const chapterScraper = async (req, res) => {
const chapterName = $("h1#chapter-heading").text();
let chapterText = $(".reading-content").html();
chapterText = parseHtml(chapterText);
chapterText = chapterText.replace(/(?<=[[])[\n](?=[h])/g, "");
chapterText = parseHtml(chapterText).replace(
/\[(https:\/\/docs.google.com\/)(.*?)\]/g,
""
);
let nextChapter = null;
+1 -5
View File
@@ -28,11 +28,7 @@ const scraper = async (url) => {
const parseHtml = (html) => {
let text = htmlToText(html);
text = text.replace(
/(?<=[ A-Za-z0-9_@./#&+-])\n(?=[ A-Za-z0-9_@./#&+-])/g,
" "
);
text = text.replace(/\n{2,}/g, "\n\n");
return text;
};