Woopread: Remove links
This commit is contained in:
@@ -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
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user