mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 19:12:04 +00:00
add madara new sources
This commit is contained in:
parent
6c67cecf4b
commit
8c6ca1c5b4
10 changed files with 888 additions and 65 deletions
|
|
@ -30,23 +30,25 @@ class ExtensionListTileWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).secondaryHeaderColor.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: logoUrl.isEmpty
|
||||
? const Icon(Icons.source_outlined)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: logoUrl,
|
||||
fit: BoxFit.contain,
|
||||
width: 37,
|
||||
height: 37,
|
||||
errorWidget: (context, url, error) {
|
||||
return const SizedBox(
|
||||
width: 37,
|
||||
height: 37,
|
||||
child: Center(
|
||||
child: Icon(Icons.source_outlined),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
child:
|
||||
// logoUrl.isEmpty
|
||||
// ?
|
||||
const Icon(Icons.source_outlined)
|
||||
// : CachedNetworkImage(
|
||||
// imageUrl: logoUrl,
|
||||
// fit: BoxFit.contain,
|
||||
// width: 37,
|
||||
// height: 37,
|
||||
// errorWidget: (context, url, error) {
|
||||
// return const SizedBox(
|
||||
// width: 37,
|
||||
// height: 37,
|
||||
// child: Center(
|
||||
// child: Icon(Icons.source_outlined),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
),
|
||||
title: Text(sourceName),
|
||||
subtitle: Row(
|
||||
|
|
|
|||
|
|
@ -67,25 +67,27 @@ class SourcesScreen extends ConsumerWidget {
|
|||
.secondaryHeaderColor
|
||||
.withOpacity(0.5),
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: element.logoUrl!.isEmpty
|
||||
? const Icon(Icons.source_outlined)
|
||||
: CachedNetworkImage(
|
||||
httpHeaders: ref.watch(
|
||||
headersProvider(source: element.sourceName!)),
|
||||
imageUrl: element.logoUrl!,
|
||||
fit: BoxFit.contain,
|
||||
width: 37,
|
||||
height: 37,
|
||||
errorWidget: (context, url, error) {
|
||||
return const SizedBox(
|
||||
width: 37,
|
||||
height: 37,
|
||||
child: Center(
|
||||
child: Icon(Icons.source_outlined),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
child:
|
||||
// element.logoUrl!.isEmpty
|
||||
// ?
|
||||
const Icon(Icons.source_outlined)
|
||||
// : CachedNetworkImage(
|
||||
// httpHeaders: ref.watch(
|
||||
// headersProvider(source: element.sourceName!)),
|
||||
// imageUrl: element.logoUrl!,
|
||||
// fit: BoxFit.contain,
|
||||
// width: 37,
|
||||
// height: 37,
|
||||
// errorWidget: (context, url, error) {
|
||||
// return const SizedBox(
|
||||
// width: 37,
|
||||
// height: 37,
|
||||
// child: Center(
|
||||
// child: Icon(Icons.source_outlined),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/sources/multisrc/heancms/heancms.dart';
|
||||
import 'package:mangayomi/sources/multisrc/madara/src/madara.dart';
|
||||
import 'package:mangayomi/sources/service.dart';
|
||||
import 'package:mangayomi/sources/src/all/comick/src/comick.dart';
|
||||
import 'package:mangayomi/sources/src/en/mangahere/src/mangahere.dart';
|
||||
|
|
@ -76,5 +77,13 @@ Future<List<GetManga?>> searchManga(SearchMangaRef ref,
|
|||
manga = await HeanCms().searchManga(source: source, query: query, ref: ref);
|
||||
}
|
||||
|
||||
/***********/
|
||||
/*madara*/
|
||||
/***********/
|
||||
|
||||
else if (getMangaTypeSource(source) == TypeSource.madara) {
|
||||
manga = await Madara().searchManga(source: source, query: query, ref: ref);
|
||||
}
|
||||
|
||||
return manga!;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,366 @@ List<Source> _madaraSourcesList = [
|
|||
dateFormat: "dd/mm/yyyy",
|
||||
dateFormatLocale: "fr"),
|
||||
Source(
|
||||
sourceName: "arabtoons",
|
||||
baseUrl: "https://arabtoons.net",
|
||||
lang: "ar",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMM d",
|
||||
dateFormatLocale: "ar"),
|
||||
sourceName: "Akuma no Tenshi",
|
||||
baseUrl: "https://akumanotenshi.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd/MM/yyyy",
|
||||
dateFormatLocale: "pt-BR",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Adult Webtoon",
|
||||
baseUrl: "https://adultwebtoon.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Adult Webtoon",
|
||||
baseUrl: "https://adultwebtoon.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
|
||||
Source(
|
||||
sourceName: "ArazNovel",
|
||||
baseUrl: "https://www.araznovel.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "d MMMM yyyy",
|
||||
dateFormatLocale: "en",
|
||||
),
|
||||
Source(
|
||||
sourceName: "BestManga",
|
||||
baseUrl: "https://bestmanga.club",
|
||||
lang: "ru",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd.MM.yyyy",
|
||||
dateFormatLocale: "ru",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Chibi Manga",
|
||||
baseUrl: "https://www.cmreader.info",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Clover Manga",
|
||||
baseUrl: "https://clover-manga.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "tr",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Comictoon",
|
||||
baseUrl: "https://comictoonthaith-new.com",
|
||||
lang: "th",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMMM dd, yyyy",
|
||||
dateFormatLocale: "th",
|
||||
),
|
||||
Source(
|
||||
sourceName: "CookieToon",
|
||||
baseUrl: "https://cookietoon.online",
|
||||
lang: "pt-BR",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd/MM/yyyy",
|
||||
dateFormatLocale: "pt-BR",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Drope Scan",
|
||||
baseUrl: "https://dropescan.com",
|
||||
lang: "pt-BR",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd/MM/yyyy",
|
||||
dateFormatLocale: "pt-BR",
|
||||
),
|
||||
Source(
|
||||
sourceName: "EvaScans",
|
||||
baseUrl: "https://evascans.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMM d, yyy",
|
||||
dateFormatLocale: "tr",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Final Scans",
|
||||
baseUrl: "https://finalscans.com",
|
||||
lang: "pt-BR",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "pt-BR",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Glory Manga",
|
||||
baseUrl: "https://glorymanga.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd/MM/yyy",
|
||||
dateFormatLocale: "tr",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Hentai Manga",
|
||||
baseUrl: "https://hentaimanga.me",
|
||||
isNsfw: true,
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "HentaiWebtoon",
|
||||
baseUrl: "https://hentaiwebtoon.com",
|
||||
isNsfw: true,
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Ikifeng",
|
||||
baseUrl: "https://ikifeng.com",
|
||||
lang: "es",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "dd/MM/yyyy",
|
||||
dateFormatLocale: "es",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Inmortal Scan",
|
||||
baseUrl: "https://manga.mundodrama.site",
|
||||
lang: "es",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "es",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Its Your Right Manhua",
|
||||
baseUrl: "https://itsyourightmanhua.com/",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Kami Sama Explorer",
|
||||
baseUrl: "https://leitor.kamisama.com.br",
|
||||
lang: "pt-BR",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd 'de' MMMM 'de' yyyy",
|
||||
dateFormatLocale: "pt-BR",
|
||||
),
|
||||
Source(
|
||||
sourceName: "KlikManga",
|
||||
baseUrl: "https://klikmanga.id",
|
||||
lang: "id",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "id",
|
||||
),
|
||||
Source(
|
||||
sourceName: "KSGroupScans",
|
||||
baseUrl: "https://ksgroupscans.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "LHTranslation",
|
||||
baseUrl: "https://lhtranslation.net",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Lolicon",
|
||||
baseUrl: "https://lolicon.mobi",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Lord Manga",
|
||||
baseUrl: "https://lordmanga.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "MangaVisa",
|
||||
baseUrl: "https://mangavisa.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "MangaClash",
|
||||
baseUrl: "https://mangaclash.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MM/dd/yy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga District",
|
||||
baseUrl: "https://mangadistrict.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga-fast.com",
|
||||
baseUrl: "https://manga-fast.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "d MMMM'،' yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga Fenix",
|
||||
baseUrl: "https://manga-fenix.com",
|
||||
lang: "es",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "es",
|
||||
),
|
||||
Source(
|
||||
sourceName: "MangaFreak.online",
|
||||
baseUrl: "https://mangafreak.online",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "d MMMM، yyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "MangaGreat",
|
||||
baseUrl: "https://mangagreat.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga Hentai",
|
||||
baseUrl: "https://mangahentai.me",
|
||||
lang: "en",
|
||||
isNsfw: true,
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
|
||||
Source(
|
||||
sourceName: "MangaMe",
|
||||
baseUrl: "https://mangame.org",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd.MM.yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga One Love",
|
||||
baseUrl: "https://mangaonelove.site",
|
||||
lang: "ru",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "dd.MM.yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga Read",
|
||||
baseUrl: "https://mangaread.co",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "yyyy-MM-dd",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "MangaRolls",
|
||||
baseUrl: "https://mangarolls.com",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manga Şehri",
|
||||
baseUrl: "https://mangasehri.com",
|
||||
lang: "tr",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "dd/MM/yyy",
|
||||
dateFormatLocale: "tr",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Mangasushi",
|
||||
baseUrl: "https://mangasushi.org",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
Source(
|
||||
sourceName: "Manhwa18.org",
|
||||
baseUrl: "https://manhwa18.org",
|
||||
lang: "en",
|
||||
typeSource: TypeSource.madara,
|
||||
logoUrl: '',
|
||||
isNsfw: true,
|
||||
dateFormat: "MMMM d, yyyy",
|
||||
dateFormatLocale: "en_US",
|
||||
),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:html/dom.dart';
|
|||
import 'package:mangayomi/models/chapter.dart';
|
||||
import 'package:mangayomi/modules/webview/webview.dart';
|
||||
import 'package:mangayomi/services/http_service/http_service.dart';
|
||||
import 'package:mangayomi/sources/multisrc/madara/src/utils.dart';
|
||||
import 'package:mangayomi/sources/service.dart';
|
||||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
|
|
@ -73,7 +74,7 @@ class Madara extends MangaYomiServices {
|
|||
.join(', ');
|
||||
description = dom
|
||||
.querySelectorAll(
|
||||
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt")
|
||||
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, div.sinopsis div.contenedor")
|
||||
.map((e) => e.text)
|
||||
.toList()
|
||||
.first;
|
||||
|
|
@ -163,6 +164,14 @@ class Madara extends MangaYomiServices {
|
|||
url: WebUri.uri(Uri.parse(manga.url!)),
|
||||
),
|
||||
);
|
||||
headlessWebViewJapScan.run();
|
||||
await Future.doWhile(() async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
if (isOk == true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
final xpath = xpathSelector(html!);
|
||||
for (var url in xpath
|
||||
|
|
@ -170,6 +179,7 @@ class Madara extends MangaYomiServices {
|
|||
.attrs) {
|
||||
chapterUrl.add(url!);
|
||||
}
|
||||
log(chapterUrl.toString());
|
||||
for (var title in xpath
|
||||
.query("//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()")
|
||||
.attrs) {
|
||||
|
|
@ -182,7 +192,7 @@ class Madara extends MangaYomiServices {
|
|||
|
||||
if (dateF.length == chapterUrl.length) {
|
||||
for (var date in dateF) {
|
||||
chapterDate.add(parseDate(date!, source));
|
||||
chapterDate.add(parseChapterDate(date!, source).toString());
|
||||
}
|
||||
} else if (dateF.length < chapterUrl.length) {
|
||||
final length = chapterUrl.length - dateF.length;
|
||||
|
|
@ -190,7 +200,7 @@ class Madara extends MangaYomiServices {
|
|||
chapterDate.add(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
}
|
||||
for (var date in dateF) {
|
||||
chapterDate.add(parseDate(date!, source));
|
||||
chapterDate.add(parseChapterDate(date!, source).toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,15 +212,40 @@ class Madara extends MangaYomiServices {
|
|||
{required String source,
|
||||
required int page,
|
||||
required AutoDisposeFutureProviderRef ref}) async {
|
||||
final html = await ref.watch(httpGetProvider(
|
||||
String? html;
|
||||
html = await ref.watch(httpGetProvider(
|
||||
url: '${getMangaBaseUrl(source)}/manga/page/$page/?m_orderby=views',
|
||||
source: source,
|
||||
resDom: false)
|
||||
.future) as String?;
|
||||
if (xpathSelector(html!)
|
||||
.query('//*[@id^="manga-item"]/a/@title')
|
||||
.attrs
|
||||
.isEmpty) {
|
||||
html = await ref.watch(httpGetProvider(
|
||||
url:
|
||||
'${getMangaBaseUrl(source)}/manga/page/$page/?m_orderby=trending',
|
||||
source: source,
|
||||
resDom: false)
|
||||
.future) as String?;
|
||||
if (xpathSelector(html!)
|
||||
.query('//*[@id^="manga-item"]/a/@title')
|
||||
.attrs
|
||||
.isEmpty) {
|
||||
html = await ref.watch(httpGetProvider(
|
||||
url: getMangaBaseUrl(source), source: source, resDom: false)
|
||||
.future) as String?;
|
||||
}
|
||||
}
|
||||
final xpath = xpathSelector(html!);
|
||||
name = xpath.query('//*[@id^="manga-item"]/a/@title').attrs;
|
||||
// log(name.toString());
|
||||
url = xpath.query('//*[@class^="post-title"]/h3/a/@href').attrs;
|
||||
// log(url.toString());
|
||||
|
||||
image = xpath.query('//*[@id^="manga-item"]/a/img/@data-src=').attrs;
|
||||
// log(image.toString());
|
||||
|
||||
return mangaRes();
|
||||
}
|
||||
|
||||
|
|
@ -218,8 +253,20 @@ class Madara extends MangaYomiServices {
|
|||
Future<List<GetManga?>> searchManga(
|
||||
{required String source,
|
||||
required String query,
|
||||
required AutoDisposeFutureProviderRef ref}) {
|
||||
// TODO: implement searchManga
|
||||
throw UnimplementedError();
|
||||
required AutoDisposeFutureProviderRef ref}) async {
|
||||
final html = await ref.watch(httpGetProvider(
|
||||
url: '${getMangaBaseUrl(source)}/?s=$query&post_type=wp-manga',
|
||||
source: source,
|
||||
resDom: false)
|
||||
.future) as String?;
|
||||
log(html!);
|
||||
final xpath = xpathSelector(html);
|
||||
name = xpath.query('//*[@class^="post-title"]/h3/a/text()').attrs;
|
||||
log(name.toString());
|
||||
url = xpath.query('//*[@class^="post-title"]/h3/a/@href').attrs;
|
||||
log(url.toString());
|
||||
image = name;
|
||||
|
||||
return mangaRes();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
295
lib/sources/multisrc/madara/src/t.dart
Normal file
295
lib/sources/multisrc/madara/src/t.dart
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
// import 'dart:developer';
|
||||
// import 'dart:io';
|
||||
// import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
// import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
// import 'package:html/dom.dart';
|
||||
// import 'package:html/parser.dart';
|
||||
// import 'package:mangayomi/models/chapter.dart';
|
||||
// import 'package:mangayomi/modules/webview/webview.dart';
|
||||
// import 'package:mangayomi/services/http_service/http_service.dart';
|
||||
// import 'package:mangayomi/sources/service.dart';
|
||||
// import 'package:mangayomi/sources/utils/utils.dart';
|
||||
// import 'package:mangayomi/utils/constant.dart';
|
||||
// import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
||||
// // import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
// class Madara extends MangaYomiServices {
|
||||
// @override
|
||||
// Future<List<String>> getChapterUrl(
|
||||
// {required Chapter chapter,
|
||||
// required AutoDisposeFutureProviderRef ref}) async {
|
||||
// final dom = await await ref.watch(httpGetProvider(
|
||||
// useUserAgent: true,
|
||||
// url: chapter.url!,
|
||||
// source: chapter.manga.value!.source!.toLowerCase(),
|
||||
// resDom: true)
|
||||
// .future) as Document?;
|
||||
// final res = dom!.querySelector(
|
||||
// "div.page-break, li.blocks-gallery-item, .reading-content, .text-left img");
|
||||
// final imgs = res!
|
||||
// .querySelectorAll('img')
|
||||
// .map((i) => regSrcMatcher(i.outerHtml).trim().trimLeft().trimRight())
|
||||
// .toList();
|
||||
// if (imgs.isNotEmpty && imgs.length == 1) {
|
||||
// final pagesNumber = dom
|
||||
// .querySelector("#single-pager")!
|
||||
// .querySelectorAll("option")
|
||||
// .map((e) => e.outerHtml)
|
||||
// .toList();
|
||||
// for (var i = 0; i < pagesNumber.length; i++) {
|
||||
// if (i.toString().length == 1) {
|
||||
// pageUrls.add(
|
||||
// imgs.first.replaceAll("01", '0${int.parse(i.toString()) + 1}'));
|
||||
// } else if (i.toString().length == 2) {
|
||||
// pageUrls.add(
|
||||
// imgs.first.replaceAll("01", '${int.parse(i.toString()) + 1}'));
|
||||
// } else if (i.toString().length == 3) {
|
||||
// pageUrls.add(
|
||||
// imgs.first.replaceAll("01", '${int.parse(i.toString()) + 1}'));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// pageUrls = imgs;
|
||||
// }
|
||||
// log(pageUrls.toString());
|
||||
|
||||
// return pageUrls;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Future<GetManga?> getMangaDetail(
|
||||
// {required GetManga manga,
|
||||
// required String lang,
|
||||
// required String source,
|
||||
// required AutoDisposeFutureProviderRef ref}) async {
|
||||
// final dom = await ref.watch(
|
||||
// httpGetProvider(url: manga.url!, source: source, resDom: true)
|
||||
// .future) as Document?;
|
||||
// author = dom!
|
||||
// .querySelectorAll("div.author-content > a")
|
||||
// .map((e) => e.text)
|
||||
// .toList()
|
||||
// .join(', ');
|
||||
// description = dom
|
||||
// .querySelectorAll(
|
||||
// "div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, div.sinopsis div.contenedor")
|
||||
// .map((e) => e.text)
|
||||
// .toList()
|
||||
// .first;
|
||||
// status = dom
|
||||
// .querySelectorAll("div.summary-content")
|
||||
// .map((e) => e.text.trim().trimLeft().trimRight())
|
||||
// .toList()
|
||||
// .last;
|
||||
|
||||
// manga.imageUrl = dom
|
||||
// .querySelectorAll("div.summary_image img")
|
||||
// .map((e) => regSrcMatcher(e.outerHtml))
|
||||
// .toList()
|
||||
// .first;
|
||||
// genre = dom
|
||||
// .querySelectorAll("div.genres-content a")
|
||||
// .map((e) => e.text)
|
||||
// .toList();
|
||||
// bool isOk = false;
|
||||
// String? html;
|
||||
// if (Platform.isWindows || Platform.isLinux) {
|
||||
// final webview = await WebviewWindow.create(
|
||||
// configuration: CreateConfiguration(
|
||||
// windowHeight: 500,
|
||||
// windowWidth: 500,
|
||||
// userDataFolderWindows: await getWebViewPath(),
|
||||
// ),
|
||||
// );
|
||||
// webview
|
||||
// ..setBrightness(Brightness.dark)
|
||||
// ..setApplicationNameForUserAgent(defaultUserAgent)
|
||||
// ..launch(manga.url!);
|
||||
|
||||
// await Future.doWhile(() async {
|
||||
// await Future.delayed(const Duration(seconds: 10));
|
||||
// html = await decodeHtml(webview);
|
||||
// if (parse(html!)
|
||||
// .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// .querySelectorAll("li.wp-manga-chapter")
|
||||
// .isEmpty) {
|
||||
// html = await decodeHtml(webview);
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// html = await decodeHtml(webview);
|
||||
// isOk = true;
|
||||
// await Future.doWhile(() async {
|
||||
// await Future.delayed(const Duration(seconds: 1));
|
||||
// if (isOk == true) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
// html = await decodeHtml(webview);
|
||||
// webview.close();
|
||||
// } else {
|
||||
// HeadlessInAppWebView? headlessWebViewJapScan;
|
||||
// headlessWebViewJapScan = HeadlessInAppWebView(
|
||||
// onLoadStop: (controller, u) async {
|
||||
// html = await controller.evaluateJavascript(
|
||||
// source:
|
||||
// "window.document.getElementsByTagName('html')[0].outerHTML;");
|
||||
// await Future.doWhile(() async {
|
||||
// html = await controller.evaluateJavascript(
|
||||
// source:
|
||||
// "window.document.getElementsByTagName('html')[0].outerHTML;");
|
||||
// if (parse(html!)
|
||||
// .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// .querySelectorAll("li.wp-manga-chapter")
|
||||
// .isEmpty) {
|
||||
// html = await controller.evaluateJavascript(
|
||||
// source:
|
||||
// "window.document.getElementsByTagName('html')[0].outerHTML;");
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// html = await controller.evaluateJavascript(
|
||||
// source:
|
||||
// "window.document.getElementsByTagName('html')[0].outerHTML;");
|
||||
// isOk = true;
|
||||
// headlessWebViewJapScan!.dispose();
|
||||
// },
|
||||
// initialUrlRequest: URLRequest(
|
||||
// url: WebUri.uri(Uri.parse(manga.url!)),
|
||||
// ),
|
||||
// );
|
||||
// headlessWebViewJapScan.run();
|
||||
// await Future.doWhile(() async {
|
||||
// await Future.delayed(const Duration(seconds: 1));
|
||||
// if (isOk == true) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
// }
|
||||
// // final xpath = xpathSelector(html!);
|
||||
// // // log(parse(html!)
|
||||
// // // .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// // // .querySelectorAll("li.wp-manga-chapter")
|
||||
// // // .map((e) => e.text)
|
||||
// // // .toList()
|
||||
// // // .toString());
|
||||
// // for (var url in xpath
|
||||
// // .query("//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href")
|
||||
// // .attrs) {
|
||||
// // chapterUrl.add(url!);
|
||||
// // }
|
||||
// chapterUrl = parse(html!)
|
||||
// .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// .querySelectorAll("li.wp-manga-chapter")
|
||||
// .map((e) => regHrefMatcher(e.outerHtml))
|
||||
// .toList();
|
||||
// // for (var title in xpath
|
||||
// // .query("//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()")
|
||||
// // .attrs) {
|
||||
// // chapterTitle.add(title!.trim().trimLeft().trimRight());
|
||||
// // }
|
||||
// // log(chapterUrl.toString());
|
||||
// chapterTitle = parse(html!)
|
||||
// .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// .querySelectorAll("li.wp-manga-chapter a")
|
||||
// .map((e) => e.text.trim().trimLeft().trimRight())
|
||||
// .toList();
|
||||
// // log(chapterTitle.toString());
|
||||
// final dateF = parse(html!)
|
||||
// .querySelector("div[id^=manga-chapters-holder]")!
|
||||
// .querySelectorAll("li.wp-manga-chapter span")
|
||||
// .map((e) => e.text.trim().trimLeft().trimRight())
|
||||
// .toList();
|
||||
// log(dateF.toString());
|
||||
// // xpath
|
||||
// // .query(
|
||||
// // "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()")
|
||||
// // .attrs;
|
||||
|
||||
// if (dateF.length == chapterUrl.length) {
|
||||
// for (var date in dateF) {
|
||||
// chapterDate.add(parseDate(date, source));
|
||||
// }
|
||||
// } else if (dateF.length < chapterUrl.length) {
|
||||
// final length = chapterUrl.length - dateF.length;
|
||||
// for (var i = 0; i < length; i++) {
|
||||
// chapterDate.add(DateTime.now().millisecondsSinceEpoch.toString());
|
||||
// }
|
||||
// for (var date in dateF) {
|
||||
// chapterDate.add(parseDate(date!, source));
|
||||
// }
|
||||
// }
|
||||
|
||||
// return mangadetailRes(manga: manga, source: source);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Future<List<GetManga?>> getPopularManga(
|
||||
// {required String source,
|
||||
// required int page,
|
||||
// required AutoDisposeFutureProviderRef ref}) async {
|
||||
// String? html;
|
||||
// html = await ref.watch(httpGetProvider(
|
||||
// url: '${getMangaBaseUrl(source)}/manga/page/$page/?m_orderby=views',
|
||||
// source: source,
|
||||
// resDom: false)
|
||||
// .future) as String?;
|
||||
// if (parse(html!)
|
||||
// .querySelectorAll('div.post-title a')
|
||||
// .map((e) => e.text)
|
||||
// .toList()
|
||||
// .isEmpty) {
|
||||
// html = await ref.watch(httpGetProvider(
|
||||
// url:
|
||||
// '${getMangaBaseUrl(source)}/manga/page/$page/?m_orderby=trending',
|
||||
// source: source,
|
||||
// resDom: false)
|
||||
// .future) as String?;
|
||||
// if (parse(html!)
|
||||
// .querySelectorAll('div.post-title a')
|
||||
// .map((e) => e.text)
|
||||
// .toList()
|
||||
// .isEmpty) {
|
||||
// html = await ref.watch(httpGetProvider(
|
||||
// url: getMangaBaseUrl(source), source: source, resDom: false)
|
||||
// .future) as String?;
|
||||
// }
|
||||
// }
|
||||
// final dom = parse(html!);
|
||||
// name = dom.querySelectorAll('div.post-title a').map((e) => e.text).toList();
|
||||
// image = name;
|
||||
// url = dom
|
||||
// .querySelectorAll('div.post-title a')
|
||||
// .map((e) => regHrefMatcher(e.outerHtml))
|
||||
// .toList();
|
||||
|
||||
// return mangaRes();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Future<List<GetManga?>> searchManga(
|
||||
// {required String source,
|
||||
// required String query,
|
||||
// required AutoDisposeFutureProviderRef ref}) async {
|
||||
// final html = await ref.watch(httpGetProvider(
|
||||
// url: '${getMangaBaseUrl(source)}/?s=$query&post_type=wp-manga',
|
||||
// source: source,
|
||||
// resDom: false)
|
||||
// .future) as String?;
|
||||
// final dom = parse(html!);
|
||||
// name = dom.querySelectorAll('div.post-title a').map((e) => e.text).toList();
|
||||
// image = name;
|
||||
// url = dom
|
||||
// .querySelectorAll('div.post-title a')
|
||||
// .map((e) => regHrefMatcher(e.outerHtml))
|
||||
// .toList();
|
||||
|
||||
// return mangaRes();
|
||||
// }
|
||||
// }
|
||||
109
lib/sources/multisrc/madara/src/utils.dart
Normal file
109
lib/sources/multisrc/madara/src/utils.dart
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
import 'package:intl/intl.dart';
|
||||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
|
||||
class WordSet {
|
||||
final List<String> words;
|
||||
|
||||
WordSet(this.words);
|
||||
|
||||
bool anyWordIn(String dateString) {
|
||||
return words
|
||||
.any((word) => dateString.toLowerCase().contains(word.toLowerCase()));
|
||||
}
|
||||
|
||||
bool startsWith(String dateString) {
|
||||
return words
|
||||
.any((word) => dateString.toLowerCase().startsWith(word.toLowerCase()));
|
||||
}
|
||||
|
||||
bool endsWith(String dateString) {
|
||||
return words
|
||||
.any((word) => dateString.toLowerCase().endsWith(word.toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
int parseChapterDate(String? date, String source) {
|
||||
date ??= '';
|
||||
|
||||
int parseRelativeDate(String date) {
|
||||
final number = int.tryParse(RegExp(r"(\d+)").firstMatch(date)!.group(0)!);
|
||||
if (number == null) return 0;
|
||||
final cal = DateTime.now();
|
||||
|
||||
if (WordSet([
|
||||
"hari",
|
||||
"gün",
|
||||
"jour",
|
||||
"día",
|
||||
"dia",
|
||||
"day",
|
||||
"วัน",
|
||||
"ngày",
|
||||
"giorni",
|
||||
"أيام",
|
||||
"天"
|
||||
]).anyWordIn(date)) {
|
||||
return cal.subtract(Duration(days: number)).millisecondsSinceEpoch;
|
||||
} else if (WordSet([
|
||||
"jam",
|
||||
"saat",
|
||||
"heure",
|
||||
"hora",
|
||||
"hour",
|
||||
"ชั่วโมง",
|
||||
"giờ",
|
||||
"ore",
|
||||
"ساعة",
|
||||
"小时"
|
||||
]).anyWordIn(date)) {
|
||||
return cal.subtract(Duration(hours: number)).millisecondsSinceEpoch;
|
||||
} else if (WordSet(
|
||||
["menit", "dakika", "min", "minute", "minuto", "นาที", "دقائق"])
|
||||
.anyWordIn(date)) {
|
||||
return cal.subtract(Duration(minutes: number)).millisecondsSinceEpoch;
|
||||
} else if (WordSet(["detik", "segundo", "second", "วินาที"])
|
||||
.anyWordIn(date)) {
|
||||
return cal.subtract(Duration(seconds: number)).millisecondsSinceEpoch;
|
||||
} else if (WordSet(["week", "semana"]).anyWordIn(date)) {
|
||||
return cal.subtract(Duration(days: number * 7)).millisecondsSinceEpoch;
|
||||
} else if (WordSet(["month", "mes"]).anyWordIn(date)) {
|
||||
return cal.subtract(Duration(days: number * 30)).millisecondsSinceEpoch;
|
||||
} else if (WordSet(["year", "año"]).anyWordIn(date)) {
|
||||
return cal.subtract(Duration(days: number * 365)).millisecondsSinceEpoch;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (WordSet(["yesterday", "يوم واحد"]).startsWith(date)) {
|
||||
DateTime cal = DateTime.now().subtract(const Duration(days: 1));
|
||||
cal = DateTime(cal.year, cal.month, cal.day);
|
||||
return cal.millisecondsSinceEpoch;
|
||||
} else if (WordSet(["today"]).startsWith(date)) {
|
||||
DateTime cal = DateTime.now();
|
||||
cal = DateTime(cal.year, cal.month, cal.day);
|
||||
return cal.millisecondsSinceEpoch;
|
||||
} else if (WordSet(["يومين"]).startsWith(date)) {
|
||||
DateTime cal = DateTime.now().subtract(const Duration(days: 2));
|
||||
cal = DateTime(cal.year, cal.month, cal.day);
|
||||
return cal.millisecondsSinceEpoch;
|
||||
} else if (WordSet(["ago", "atrás", "önce", "قبل"]).endsWith(date)) {
|
||||
return parseRelativeDate(date);
|
||||
} else if (WordSet(["hace"]).startsWith(date)) {
|
||||
return parseRelativeDate(date);
|
||||
} else if (date.contains(RegExp(r"\d(st|nd|rd|th)"))) {
|
||||
final cleanedDate = date
|
||||
.split(" ")
|
||||
.map((it) => it.contains(RegExp(r"\d\D\D"))
|
||||
? it.replaceAll(RegExp(r"\D"), "")
|
||||
: it)
|
||||
.join(" ");
|
||||
return DateFormat(getFormatDate(source), getFormatDateLocale(source))
|
||||
.parse(cleanedDate)
|
||||
.millisecondsSinceEpoch;
|
||||
} else {
|
||||
return DateFormat(getFormatDate(source), getFormatDateLocale(source))
|
||||
.parse(date)
|
||||
.millisecondsSinceEpoch;
|
||||
}
|
||||
}
|
||||
|
|
@ -36,15 +36,15 @@ List<Source> _mangathemesiaSourcesList = [
|
|||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "en"),
|
||||
|
||||
Source(
|
||||
sourceName: "Boosei",
|
||||
baseUrl: "https://boosei.net",
|
||||
lang: "id",
|
||||
typeSource: TypeSource.mangathemesia,
|
||||
logoUrl:
|
||||
'https://cdn.boosei.com/wp-content/uploads/2021/11/Logo-Darkmode.png.webp',
|
||||
dateFormat: "MMMM dd, yyyy",
|
||||
dateFormatLocale: "id"),
|
||||
// Source(
|
||||
// sourceName: "Boosei",
|
||||
// baseUrl: "https://boosei.net",
|
||||
// lang: "id",
|
||||
// typeSource: TypeSource.mangathemesia,
|
||||
// logoUrl:
|
||||
// 'https://cdn.boosei.com/wp-content/uploads/2021/11/Logo-Darkmode.png.webp',
|
||||
// dateFormat: "MMMM dd, yyyy",
|
||||
// dateFormatLocale: "id"),
|
||||
Source(
|
||||
sourceName: "Clayrer",
|
||||
baseUrl: "https://clayrer.net",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/models/settings.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/services/http_service/cloudflare/providers/cookie_providers.dart';
|
||||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'headers.g.dart';
|
||||
|
||||
|
|
@ -18,23 +19,25 @@ Map<String, String> headers(HeadersRef ref, {String source = ""}) {
|
|||
'Accept-Language': 'fr'
|
||||
}
|
||||
: source == 'mangahere'
|
||||
? {"Referer": "https://www.mangahere.cc/", "Cookie": "isAdult=1"}
|
||||
? {"Referer": "${getMangaBaseUrl(source)}/", "Cookie": "isAdult=1"}
|
||||
: source == 'comick'
|
||||
? {
|
||||
'Referer': 'https://comick.app/',
|
||||
'Referer': "${getMangaBaseUrl(source)}/",
|
||||
'User-Agent': 'Tachiyomi $userAgent'
|
||||
}
|
||||
: source == "japscan"
|
||||
? {
|
||||
'User-Agent': userAgent,
|
||||
'Referer': "https://www.japscan.lol/",
|
||||
'Referer': "${getMangaBaseUrl(source)}/",
|
||||
"Cookie": cookie
|
||||
}
|
||||
: source == 'sushiscan'
|
||||
? {
|
||||
'User-Agent': userAgent,
|
||||
'Referer': "https://www.sushscan.net/",
|
||||
'Referer': "${getMangaBaseUrl(source)}/",
|
||||
"Cookie": cookie
|
||||
}
|
||||
: {};
|
||||
: getMangaTypeSource(source) == TypeSource.madara
|
||||
? {"Referer": "${getMangaBaseUrl(source)}/"}
|
||||
: {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ completeLang(String lang) {
|
|||
} else if (lang == 'zh-hk') {
|
||||
return '繁體中文(Hong Kong)';
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
final List<String> language = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue