* Couple of changes
This commit is contained in:
parent
fd075d060a
commit
e9a2f3d488
|
@ -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);
|
|
@ -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,8 +54,10 @@ 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 ) {
|
||||||
|
if ( (p as any).value !== null ) {
|
||||||
postList.push(((p as any).value as Post));
|
postList.push(((p as any).value as Post));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch( err => {
|
.catch( err => {
|
||||||
console.error(`err: `, err);
|
console.error(`err: `, err);
|
||||||
|
|
Reference in New Issue