* 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`);
 | 
			
		||||
 | 
			
		||||
// 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 * 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<string>;
 | 
			
		||||
    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 => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue