* Couple of changes

This commit is contained in:
Daniel Legt 2021-10-22 01:36:15 +03:00
parent fd075d060a
commit e9a2f3d488
2 changed files with 6 additions and 4 deletions

View File

@ -3,4 +3,4 @@ import {runTest as runRule34XXX} from "./test/rule34xxx";
console.log(`Testing Rule34.xxx`); console.log(`Testing Rule34.xxx`);
// Running the rule34 test with "Most popular" page // 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`); runRule34XXX(`https://rule34.xxx/index.php?page=post&s=list&tags=cyancapsule`, 30);

View File

@ -3,14 +3,14 @@ import {Rule34xxx} from "../module/rule34xxx";
import {Post} from "../type/generic"; import {Post} from "../type/generic";
import * as fs from "fs/promises"; 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 // Initialize the rule34 module
const r34: Rule34xxx = new Rule34xxx(); const r34: Rule34xxx = new Rule34xxx();
r34.verbose = true; r34.verbose = true;
// Run the get post Details function // Run the get post Details function
let pageList: Array<string>; let pageList: Array<string>;
await r34.crawlPages(startingPage, 20) await r34.crawlPages(startingPage, pages)
.then( postData => { .then( postData => {
pageList = postData; pageList = postData;
}) })
@ -54,7 +54,9 @@ export async function runTest(startingPage: string = `https://rule34.xxx/index.p
.then( result => { .then( result => {
// Append the results to the postList // Append the results to the postList
for ( let p of result ) { 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 => { .catch( err => {