diff --git a/package.json b/package.json index 299f378..537efa9 100644 --- a/package.json +++ b/package.json @@ -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" } } \ No newline at end of file diff --git a/src/base/types/generic.ts b/src/base/types/generic.ts deleted file mode 100644 index 6951e67..0000000 --- a/src/base/types/generic.ts +++ /dev/null @@ -1,9 +0,0 @@ -interface Tag { - -} - -interface Post { - - - -} \ No newline at end of file diff --git a/src/base/class/Scrapper.ts b/src/class/Scrapper.ts similarity index 51% rename from src/base/class/Scrapper.ts rename to src/class/Scrapper.ts index 31c1782..2db7286 100644 --- a/src/base/class/Scrapper.ts +++ b/src/class/Scrapper.ts @@ -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 = []; + /** + * 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 { - return {}; + public async getPostDetails( url: string ): Promise { + return null; } /** @@ -22,7 +33,7 @@ class Scrapper { * @param url * @returns */ - public async getPostsFrompage( url: string ): Promise { + public async getPostsFromPage( url: string ): Promise> { return []; } diff --git a/src/module/rule34xxx.ts b/src/module/rule34xxx.ts new file mode 100644 index 0000000..7b0a2dd --- /dev/null +++ b/src/module/rule34xxx.ts @@ -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 { + + + + return null; + } + +} \ No newline at end of file diff --git a/src/test.ts b/src/test.ts index 61e8376..61b3bfd 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1 +1,2 @@ -// This is the test file for the library, different tests are ran in here. \ No newline at end of file +// This is the test file for the library, different tests are ran in here. +console.log(`Working I guess`); \ No newline at end of file diff --git a/src/type/generic.ts b/src/type/generic.ts new file mode 100644 index 0000000..0f980af --- /dev/null +++ b/src/type/generic.ts @@ -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, + + /** + * The date of the post's creation + */ + ts?: string, +} \ No newline at end of file