+ Started work on rule34.xxx module
This commit is contained in:
parent
7f81364ecb
commit
11224096f9
|
@ -1,4 +1,9 @@
|
|||
{
|
||||
"author": {
|
||||
"email": "contact@justkato.me",
|
||||
"name": "Kato Twofold",
|
||||
"url": "https://justkato.me/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/commander": "^2.12.2",
|
||||
"axios": "^0.23.0",
|
||||
|
@ -9,5 +14,8 @@
|
|||
"devDependencies": {
|
||||
"@types/node": "^16.11.1",
|
||||
"@types/yargs": "^17.0.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tsc && node dist/test.js"
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
interface Tag {
|
||||
|
||||
}
|
||||
|
||||
interface Post {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,20 +1,31 @@
|
|||
import {Post, Tag} from "../type/generic";
|
||||
|
||||
/**
|
||||
* The base class of the scrappers, any of the website scrappers must extend this class
|
||||
*/
|
||||
class Scrapper {
|
||||
export class Scrapper {
|
||||
|
||||
constructor(domain: string) {
|
||||
// Set the domain
|
||||
this.domain = domain;
|
||||
};
|
||||
|
||||
/**
|
||||
* An array of all of the logs
|
||||
*/
|
||||
public logs: Array<any> = [];
|
||||
|
||||
/**
|
||||
* The fully qualified domain of the website to scrap, for example "rule34.life"
|
||||
*/
|
||||
public domain: string = ``;
|
||||
|
||||
/**
|
||||
* Get the details of a specific post
|
||||
* @param url The URL to the post, this must be the actual page which contains the image, tags, etc...
|
||||
*/
|
||||
public async getPostDetails( url: string ): Promise<any> {
|
||||
return {};
|
||||
public async getPostDetails( url: string ): Promise<Post | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +33,7 @@ class Scrapper {
|
|||
* @param url
|
||||
* @returns
|
||||
*/
|
||||
public async getPostsFrompage( url: string ): Promise<any> {
|
||||
public async getPostsFromPage( url: string ): Promise<Array<Post>> {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import {Post, Tag} from "../type/generic";
|
||||
import {Scrapper} from "../class/Scrapper";
|
||||
|
||||
class Rule34xxx extends Scrapper {
|
||||
|
||||
/**
|
||||
* Get the details of a specific post
|
||||
* @param url The URL to the post, this must be the actual page which contains the image, tags, etc...
|
||||
*/
|
||||
public async getPostDetails( url: string ): Promise<Post | null> {
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
// This is the test file for the library, different tests are ran in here.
|
||||
console.log(`Working I guess`);
|
|
@ -0,0 +1,38 @@
|
|||
export interface Tag {
|
||||
/**
|
||||
* The slug of the tag, this usually looks something like: hand_holding
|
||||
*/
|
||||
slug: string,
|
||||
|
||||
/**
|
||||
* An optional type of the tag
|
||||
*/
|
||||
type?: string
|
||||
}
|
||||
|
||||
export interface Post {
|
||||
/**
|
||||
* URL to the original post link
|
||||
*/
|
||||
url?: string,
|
||||
|
||||
/**
|
||||
* A link to the full resolution image or video
|
||||
*/
|
||||
contentURL: string,
|
||||
|
||||
/**
|
||||
* The optional link for the source of the image
|
||||
*/
|
||||
source?: string,
|
||||
|
||||
/**
|
||||
* A list of all of the tags the post has
|
||||
*/
|
||||
tags: Array<Tag>,
|
||||
|
||||
/**
|
||||
* The date of the post's creation
|
||||
*/
|
||||
ts?: string,
|
||||
}
|
Reference in New Issue