nyaasiscrapper
Version:
A light scrapper for nyaasi
64 lines (63 loc) • 2.84 kB
TypeScript
/**
* General function, will give you results with your parameters, solwer with advanced and even slower if advanced and more than 14 results
* @param options
*/
export declare function searchNyaa(options?: searchOptions): Promise<animeItem[]>;
/**
* Call that function with an animeItem or an array and you'll get more info
* @param items
*/
export declare function getAdvancedInfos(items: animeItem[] | animeItem): Promise<animeItem[]>;
/**
* @property {string} term - The term you want to search for, can be empty.
* @property {stringCat | numberCat} category - Category, either in the form of '0_0' or 'All', can be empty.
* @property {number} filter - filter 0 for none, 1 no remakes and 2 Trusted only, can be empty.
* @property {string} user - User, can be empty.
* @property {number} page - Page, can be empty.
* @property {string} sortType - Sort type, can be seeders or any info, can be empty.
* @property {string} sortDirection - Ascending or Descending, can be empty but defaults to descending.
* @property {boolean} advanced - General scraping is by rss which means I don't get directlhy magnet, user, comments or files but if enabled it will see the page iteself to get it.
*/
export interface searchOptions {
term?: string;
category?: stringCat | numberCat;
filter?: 0 | 1 | 2;
user?: string;
page?: number;
sortType?: "comments" | "size" | "Date" | "seeders" | "leechers" | "downloads" | "id";
sortDirection?: "Ascending" | "Descending" | "desc" | "asc";
advanced?: boolean;
}
export interface animeItem {
title: string;
category: stringCat;
categoryId: numberCat;
downloadUrl: string;
size: string;
date: Date;
seeders: number;
leechers: number;
grabs: number;
nyaaUrl: string;
infoHash: string;
trusted: boolean;
remake: boolean;
description?: string;
magnet?: string;
user?: string;
files?: file[];
comments?: comment[];
}
export interface file {
title: string;
size: string;
parentDir: string;
}
export interface comment {
user: string;
content: string;
date: Date;
edited: boolean;
}
export declare type numberCat = '0_0' | '1_1' | '1_2' | '1_3' | '1_4' | '2_1' | '2_2' | '3_1' | '3_2' | '3_3' | '4_1' | '4_2' | '4_3' | '4_4' | '5_1' | '5_2' | '6_1' | '6_2';
export declare type stringCat = 'All' | 'Anime' | 'Anime Music Video' | 'Anime - English-translated' | 'Anime - Non-English-translated' | 'Anime - Raw' | 'Audio' | 'Lossless' | 'Lossy' | 'Literature' | 'Literature English-translated' | 'Literature - Non-English-translated' | 'Literature - Raw' | 'Live Action' | 'Live Action - English-translated' | 'Idol/Promotional Video' | 'Live Action - Non-English-translated' | 'Live Action - Raw' | 'Pictures' | 'Graphics' | 'Photos' | 'Software' | 'Applications' | 'Games';