Describe the bug
Created a custom rule to work on a unlisted novel site and the results showed fine in the tester, and in the rules when you edit and run it live while work.
To Reproduce
try a novel from the site provided in the rule given below
{
"guid": "03f193cd-ab75-43f7-a2b7-6c74e133f6ba",
"rule_name": "test",
"url_regex": "?:https://)*(?:www\\.)novelmax\\.net/n/.",
"pagetype_code": " const urlPattern = /^https:\/\/novelmax\.net\/n\/florida-mans-general-store-in-cultivation-world/i;\n\n // Check if the current page is supported by the rule\n if (window.location.href.match(urlPattern)) {\n // Check for captcha pages\n if ($('.captcha-page').length > 0) {\n // Check if it's an Auto-Captcha page\n if ($('.auto-redirect-captcha').length > 0) {\n // Auto-Redirect, no user intervention needed\n return -1;\n } else {\n // Manual-Captcha, user might need to use the renderer\n return -2;\n }\n } else {\n // Page is supported, return 0\n return 0;\n }\n } else {\n // Page not supported by the rule\n return -3;\n }\n}\n",
"toc_code": "let retMe = {\n 'CoverURL': $('img[src="https://novelmax.net/media/novel/florida-mans-general-store-in-cultivation-world.jpg"]').attr('src'),\n 'Title': $('h3.title').text(),\n 'Summary': $('.desc-text').text().replace(/\n/g, '
'),\n 'ChapterCount': 0,\n 'ChapterURLs': [],\n};\n\nawait sleep(100);\n\n// Extract all chapter URLs\nlet chapterURLs = [];\n$(".list-chapter li a").each(function () {\n let chapterUrl = $(this).attr("href");\n chapterURLs.push(chapterUrl);\n});\n\nretMe.ChapterURLs = chapterURLs.reverse();\nretMe.ChapterCount = retMe.ChapterURLs.length;\n\nreturn retMe;",
"chapter_code": "injectJquery();\n\nlet visitedChapterURLs = new Set();\n\nlet retMe;\n\nif (isTOCPage()) {\n throw new Error("Error: Script is on the Table of Contents page. Not a chapter page.");\n} else {\n let currentChapterURL = window.location.href;\n\n if (visitedChapterURLs.has(currentChapterURL)) {\n throw new Error("Error: Same chapter URL loaded twice. Breaking the script.");\n }\n\n visitedChapterURLs.add(currentChapterURL);\n\n // Check if the next chapter button is disabled\n let nextChapterButton = $('#next_chap');\n if (nextChapterButton.length > 0 && nextChapterButton.attr('disabled') !== undefined) {\n throw new Error("Error: Next chapter button is disabled. Breaking the script.");\n }\n\n retMe = [\n {\n "title": $('p:contains("Chapter")').text(),\n "content": $('#chr-content').html(),\n "nextURL": getNextChapterURL()\n },\n ];\n}\n\nfunction isTOCPage() {\n // Add logic to identify if it's the Table of Contents page\n // You can use specific elements or patterns that are unique to TOC\n // For example, if the TOC has an element with class "toc-container"\n return $('.toc-container').length > 0;\n}\n\nfunction getNextChapterURL() {\n // Extract the URL of the next chapter link\n let nextChapterLink = $('#next_chap');\n if (nextChapterLink.length > 0) {\n return nextChapterLink.attr('href');\n } else {\n throw new Error("Error: Last chapter reached. No next chapter found.");\n }\n}\n\nreturn retMe;\n",
"url_blocks": "pubfuture-ad.com"
},
Expected behavior
to scrape with no issues.
Screenshots
Non provided
Desktop (please complete the following information):
Windows 10, build 19045
Latest chrome
Additional context
Add any other context about the problem here.