diff --git a/src/test.ts b/src/test.ts index 6dc08f5..c8de3c4 100644 --- a/src/test.ts +++ b/src/test.ts @@ -3,4 +3,4 @@ import {runTest as runRule34XXX} from "./test/rule34xxx"; console.log(`Testing Rule34.xxx`); // Running the rule34 test with "Most popular" page -runRule34XXX(`https://rule34.xxx/index.php?page=post&s=list&tags=sort%3Ascore%3Adesc+id%3A%3E4563063&pid=252`); \ No newline at end of file +runRule34XXX(`https://rule34.xxx/index.php?page=post&s=list&tags=cyancapsule`, 30); \ No newline at end of file diff --git a/src/test/rule34xxx.ts b/src/test/rule34xxx.ts index 25d98d2..9a2b840 100644 --- a/src/test/rule34xxx.ts +++ b/src/test/rule34xxx.ts @@ -3,14 +3,14 @@ import {Rule34xxx} from "../module/rule34xxx"; import {Post} from "../type/generic"; import * as fs from "fs/promises"; -export async function runTest(startingPage: string = `https://rule34.xxx/index.php?page=post&s=list&tags=sort%3Ascore%3Adesc+id%3A%3E4563063&pid=252`) { +export async function runTest(startingPage: string = `https://rule34.xxx/index.php?page=post&s=list&tags=sort%3Ascore%3Adesc+id%3A%3E4563063&pid=252`, pages: number = 10) { // Initialize the rule34 module const r34: Rule34xxx = new Rule34xxx(); r34.verbose = true; // Run the get post Details function let pageList: Array; - await r34.crawlPages(startingPage, 20) + await r34.crawlPages(startingPage, pages) .then( postData => { pageList = postData; }) @@ -54,7 +54,9 @@ export async function runTest(startingPage: string = `https://rule34.xxx/index.p .then( result => { // Append the results to the postList for ( let p of result ) { - postList.push(((p as any).value as Post)); + if ( (p as any).value !== null ) { + postList.push(((p as any).value as Post)); + } } }) .catch( err => {