Skip to content

Commit

Permalink
feat(source): Add Смаколики, LitSpace (#778)
Browse files Browse the repository at this point in the history
* add smakolykytl

* Update smakolykytl.ts

* fix

* LitSpace

* fix

* fix renovels

* Update renovels.js
  • Loading branch information
Rider21 authored Sep 22, 2023
1 parent 925855a commit 4a49f32
Show file tree
Hide file tree
Showing 11 changed files with 993 additions and 211 deletions.
180 changes: 180 additions & 0 deletions src/sources/multisrc/readwn/ReadwnGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,198 @@ const ReadwnScraper = new MultiSrcScraper(
68,
'https://www.wuxiap.com/',
'Readwn.com',
{
label: 'Genre / Category',
values: [
{ label: 'All', value: 'all' },
{ label: 'Action', value: 'action' },
{ label: 'Adventure', value: 'adventure' },
{ label: 'Chinese', value: 'chinese' },
{ label: 'Comedy', value: 'comedy' },
{ label: 'Contemporary Romance', value: 'contemporary-romance' },
{ label: 'Drama', value: 'drama' },
{ label: 'Eastern Fantasy', value: 'eastern-fantasy' },
{ label: 'Ecchi', value: 'ecchi' },
{ label: 'Erciyuan', value: 'erciyuan' },
{ label: 'Faloo', value: 'faloo' },
{ label: 'Fan-Fiction', value: 'fan-fiction' },
{ label: 'Fantasy', value: 'fantasy' },
{ label: 'Fantasy Romance', value: 'fantasy-romance' },
{ label: 'Game', value: 'game' },
{ label: 'Gender Bender', value: 'gender-bender' },
{ label: 'Harem', value: 'harem' },
{ label: 'Hentai', value: 'hentai' },
{ label: 'Historical', value: 'historical' },
{ label: 'Horror', value: 'horror' },
{ label: 'Isekai', value: 'isekai' },
{ label: 'Japanese', value: 'japanese' },
{ label: 'Josei', value: 'josei' },
{ label: 'Korean', value: 'korean' },
{ label: 'Lolicon', value: 'lolicon' },
{ label: 'Magic', value: 'magic' },
{ label: 'Magical Realism', value: 'magical-realism' },
{ label: 'Martial Arts', value: 'martial-arts' },
{ label: 'Mecha', value: 'mecha' },
{ label: 'Military', value: 'military' },
{ label: 'Mystery', value: 'mystery' },
{ label: 'Official Circles', value: 'official_circles' },
{ label: 'Psychological', value: 'psychological' },
{ label: 'Romance', value: 'romance' },
{ label: 'School Life', value: 'school-life' },
{ label: 'Sci-fi', value: 'sci-fi' },
{ label: 'Science Fiction', value: 'science_fiction' },
{ label: 'Seinen', value: 'seinen' },
{ label: 'Shoujo', value: 'shoujo' },
{ label: 'Shoujo Ai', value: 'shoujo-ai' },
{ label: 'Shounen', value: 'shounen' },
{ label: 'Shounen Ai', value: 'shounen-ai' },
{ label: 'Slice of Life', value: 'slice-of-life' },
{ label: 'Sports', value: 'sports' },
{ label: 'Supernatural', value: 'supernatural' },
{ label: 'Suspense Thriller', value: 'suspense_thriller' },
{ label: 'Tragedy', value: 'tragedy' },
{ label: 'Travel Through Time', value: 'travel_through_time' },
{ label: 'Two-dimensional', value: 'two-dimensional' },
{ label: 'Urban', value: 'urban' },
{ label: 'Urban Life', value: 'urban-life' },
{ label: 'Video Games', value: 'video-games' },
{ label: 'Virtual Reality', value: 'virtual-reality' },
{ label: 'Wuxia', value: 'wuxia' },
{ label: 'Wuxia Xianxia', value: 'wuxia_xianxia' },
{ label: 'Xianxia', value: 'xianxia' },
{ label: 'Xuanhuan', value: 'xuanhuan' },
{ label: 'Yaoi', value: 'yaoi' },
{ label: 'Yuri', value: 'yuri' },
],
},
);

const NovelmtScraper = new MultiSrcScraper(
99,
'https://www.wuxiapub.com/',
'Novelmt.com',
{
label: 'Genre / Category',
values: [
{ label: 'All', value: 'all' },
{ label: 'Action', value: 'action' },
{ label: 'Adult', value: 'adult' },
{ label: 'Adventure', value: 'adventure' },
{ label: 'Billionaire', value: 'billionaire' },
{ label: 'CEO', value: 'ceo' },
{ label: 'Chinese', value: 'chinese' },
{ label: 'Comedy', value: 'comedy' },
{ label: 'Contemporary Romance', value: 'contemporary-romance' },
{ label: 'Drama', value: 'drama' },
{ label: 'Eastern Fantasy', value: 'eastern-fantasy' },
{ label: 'Ecchi', value: 'ecchi' },
{ label: 'Erciyuan', value: 'erciyuan' },
{ label: 'Faloo', value: 'faloo' },
{ label: 'Fan-Fiction', value: 'fan-fiction' },
{ label: 'Fantasy', value: 'fantasy' },
{ label: 'Fantasy Romance', value: 'fantasy-romance' },
{ label: 'Farming', value: 'farming' },
{ label: 'Game', value: 'game' },
{ label: 'Games', value: 'games' },
{ label: 'Gay Romance', value: 'gay-romance' },
{ label: 'Gender Bender', value: 'gender-bender' },
{ label: 'Harem', value: 'harem' },
{ label: 'Historical', value: 'historical' },
{ label: 'Historical Romance', value: 'historical-romance' },
{ label: 'Horror', value: 'horror' },
{ label: 'Isekai', value: 'isekai' },
{ label: 'Japanese', value: 'japanese' },
{ label: 'Josei', value: 'josei' },
{ label: 'Korean', value: 'korean' },
{ label: 'Lolicon', value: 'lolicon' },
{ label: 'Magic', value: 'magic' },
{ label: 'Magical Realism', value: 'magical-realism' },
{ label: 'Martial Arts', value: 'martial-arts' },
{ label: 'Mature', value: 'mature' },
{ label: 'Mecha', value: 'mecha' },
{ label: 'Military', value: 'military' },
{ label: 'Modern Life', value: 'modern-life' },
{ label: 'Modern Romance', value: 'modern-romance' },
{ label: 'Mystery', value: 'mystery' },
{ label: 'Psychological', value: 'psychological' },
{ label: 'Romance', value: 'romance' },
{ label: 'Romantic', value: 'romantic' },
{ label: 'School Life', value: 'school-life' },
{ label: 'Sci-fi', value: 'sci-fi' },
{ label: 'Seinen', value: 'seinen' },
{ label: 'Shoujo', value: 'shoujo' },
{ label: 'Shoujo Ai', value: 'shoujo-ai' },
{ label: 'Shounen', value: 'shounen' },
{ label: 'Shounen Ai', value: 'shounen-ai' },
{ label: 'Slice of Life', value: 'slice-of-life' },
{ label: 'Smut', value: 'smut' },
{ label: 'Sports', value: 'sports' },
{ label: 'Supernatural', value: 'supernatural' },
{ label: 'Tragedy', value: 'tragedy' },
{ label: 'Two-dimensional', value: 'two-dimensional' },
{ label: 'Urban', value: 'urban' },
{ label: 'Urban Life', value: 'urban-life' },
{ label: 'Video Games', value: 'video-games' },
{ label: 'Virtual Reality', value: 'virtual-reality' },
{ label: 'Wuxia', value: 'wuxia' },
{ label: 'Xianxia', value: 'xianxia' },
{ label: 'Xuanhuan', value: 'xuanhuan' },
{ label: 'Yaoi', value: 'yaoi' },
{ label: 'Yuri', value: 'yuri' },
],
},
);

const LtnovelScraper = new MultiSrcScraper(
100,
'https://www.ltnovel.com/',
'Ltnovel.com',
{
label: 'Genre / Category',
values: [
{ label: 'All', value: 'all' },
{ label: 'Action', value: 'action' },
{ label: 'Adult', value: 'adult' },
{ label: 'Adventure', value: 'adventure' },
{ label: 'Comedy', value: 'comedy' },
{ label: 'Contemporary Romance', value: 'contemporary-romance' },
{ label: 'Drama', value: 'drama' },
{ label: 'Eastern Fantasy', value: 'eastern-fantasy' },
{ label: 'Ecchi', value: 'ecchi' },
{ label: 'Fantasy', value: 'fantasy' },
{ label: 'Fantasy Romance', value: 'fantasy-romance' },
{ label: 'Game', value: 'game' },
{ label: 'Gender Bender', value: 'gender-bender' },
{ label: 'Harem', value: 'harem' },
{ label: 'Historical', value: 'historical' },
{ label: 'Horror', value: 'horror' },
{ label: 'Josei', value: 'josei' },
{ label: 'Lolicon', value: 'lolicon' },
{ label: 'Magical Realism', value: 'magical-realism' },
{ label: 'Martial Arts', value: 'martial-arts' },
{ label: 'Mature', value: 'mature' },
{ label: 'Mecha', value: 'mecha' },
{ label: 'Mystery', value: 'mystery' },
{ label: 'Psychological', value: 'psychological' },
{ label: 'Romance', value: 'romance' },
{ label: 'School Life', value: 'school-life' },
{ label: 'Sci-fi', value: 'sci-fi' },
{ label: 'Seinen', value: 'seinen' },
{ label: 'Shoujo', value: 'shoujo' },
{ label: 'Shounen', value: 'shounen' },
{ label: 'Shounen Ai', value: 'shounen-ai' },
{ label: 'Slice of Life', value: 'slice-of-life' },
{ label: 'Smut', value: 'smut' },
{ label: 'Sports', value: 'sports' },
{ label: 'Supernatural', value: 'supernatural' },
{ label: 'Tragedy', value: 'tragedy' },
{ label: 'Video Games', value: 'video-games' },
{ label: 'Wuxia', value: 'wuxia' },
{ label: 'Xianxia', value: 'xianxia' },
{ label: 'Xuanhuan', value: 'xuanhuan' },
{ label: 'Yaoi', value: 'yaoi' },
],
},
);

export { ReadwnScraper, NovelmtScraper, LtnovelScraper };
42 changes: 37 additions & 5 deletions src/sources/multisrc/readwn/ReadwnScraper.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
import { FilterInputs } from '../../types/filterTypes';
import * as cheerio from 'cheerio';
import QueryString from 'qs';

class ReadwnScraper {
constructor(sourceId, baseUrl, sourceName) {
constructor(sourceId, baseUrl, sourceName, genres) {
this.sourceId = sourceId;
this.baseUrl = baseUrl;
this.sourceName = sourceName;
this.filters = [
{
key: 'sort',
label: 'Sort By',
values: [
{ label: 'New', value: 'newstime' },
{ label: 'Popular', value: 'onclick' },
{ label: 'Updates', value: 'lastdotime' },
],
inputType: FilterInputs.Picker,
},
{
key: 'status',
label: 'Status',
values: [
{ label: 'All', value: 'all' },
{ label: 'Completed', value: 'Completed' },
{ label: 'Ongoing', value: 'Ongoing' },
],
inputType: FilterInputs.Picker,
},
{
key: 'genres',
label: genres.label,
values: genres.values,
inputType: FilterInputs.Picker,
},
];
}

async popularNovels(page, options) {
async popularNovels(page, { showLatestNovels, filters }) {
const baseUrl = this.baseUrl;
const sourceId = this.sourceId;

const pageNo = page - 1;

const url = `${baseUrl}list/all/${
options?.showLatestNovels ? 'all-lastdotime' : 'all-onclick'
}-${pageNo}.html`;
let url = baseUrl + 'list/';
url += (filters?.genres || 'all') + '/';
url += (filters?.status || 'all') + '-';
url +=
(showLatestNovels ? 'lastdotime' : filters?.sort || 'newstime') + '-';
url += pageNo + '.html';

const result = await fetch(url);
const body = await result.text();
Expand Down
Loading

0 comments on commit 4a49f32

Please sign in to comment.