From e1f59a845ef6c6f750aa3abdf9014d601af38d9b Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 11 Feb 2023 22:22:32 -0500 Subject: [PATCH] Update jsoup (#15321) --- gradle/libs.versions.toml | 2 +- .../fmreader/epikmanga/src/EpikManga.kt | 4 +- .../fmreader/ksgroupscans/src/KSGroupScans.kt | 2 +- .../overrides/fmreader/mangatr/src/MangaTR.kt | 2 +- .../fmreader/saytruyen/src/SayTruyen.kt | 2 +- .../universohentai/src/UniversoHentai.kt | 8 +- .../genkan/lynxscans/src/LynxScans.kt | 2 +- .../gigaviewer/comicgardo/src/ComicGardo.kt | 6 +- .../gigaviewer/kuragebunch/src/KurageBunch.kt | 4 +- .../magazinepocket/src/MagazinePocket.kt | 6 +- .../src/TonariNoYoungJump.kt | 4 +- .../madara/manga18fx/src/Manga18fx.kt | 10 +- .../madara/mangaleveling/src/MangaLeveling.kt | 2 +- .../overrides/madara/mmscans/src/MMScans.kt | 4 +- multisrc/overrides/mangabz/vomic/src/Vomic.kt | 12 +-- .../ReadAttackOnTitanShingekiNoKyojinManga.kt | 8 +- .../mangaraw/manga9co/src/MangaRaw.kt | 4 +- .../overrides/mangaraw/syosetu/src/SyoSetu.kt | 4 +- .../mangasar/seemangas/src/Seemangas.kt | 20 ++-- .../flamescans/src/FlameScans.kt | 2 +- .../mangathemesia/kiryuu/src/Kiryuu.kt | 2 +- .../mangathemesia/komikcast/src/KomikCast.kt | 7 +- .../mangaraworg/src/MangaRawOrg.kt | 2 +- .../mangathemesia/mangaswat/src/MangaSwat.kt | 2 +- .../mangathemesia/mangkomik/src/MangKomik.kt | 2 +- .../manhwafreak/src/ManhwaFreak.kt | 2 +- .../xcalibrscans/src/xCaliBRScans.kt | 2 +- .../mmrcms/animaregia/src/AnimaRegia.kt | 6 +- .../mmrcms/fallenangels/src/FallenAngels.kt | 6 +- .../multichan/henchan/src/HenChan.kt | 2 +- .../sinmh/wuqimanga/src/WuqiManga.kt | 8 +- .../wpcomics/truyenchon/src/TruyenChon.kt | 4 +- .../datgarscanlation/src/DatGarScanlation.kt | 2 +- .../zeistmanga/mangaailand/src/MangaAiLand.kt | 2 +- .../zmanga/sektekomik/src/SekteKomik.kt | 4 +- .../tachiyomi/multisrc/a3manga/A3Manga.kt | 6 +- .../tachiyomi/multisrc/bakamanga/BakaManga.kt | 22 ++--- .../multisrc/comicgamma/ComicGamma.kt | 14 +-- .../tachiyomi/multisrc/eromuse/EroMuse.kt | 4 +- .../tachiyomi/multisrc/fmreader/FMReader.kt | 8 +- .../tachiyomi/multisrc/foolslide/FoolSlide.kt | 16 ++-- .../tachiyomi/multisrc/gattsu/Gattsu.kt | 4 +- .../tachiyomi/multisrc/genkan/Genkan.kt | 12 +-- .../multisrc/genkan/GenkanOriginal.kt | 2 +- .../multisrc/gigaviewer/GigaViewer.kt | 24 ++--- .../tachiyomi/multisrc/grouple/GroupLe.kt | 12 +-- .../tachiyomi/multisrc/kemono/Kemono.kt | 14 +-- .../tachiyomi/multisrc/libgroup/LibGroup.kt | 24 ++--- .../tachiyomi/multisrc/madara/Madara.kt | 6 +- .../tachiyomi/multisrc/madtheme/MadTheme.kt | 6 +- .../tachiyomi/multisrc/mangabox/MangaBox.kt | 10 +- .../multisrc/mangabz/MangabzTheme.kt | 22 ++--- .../tachiyomi/multisrc/mangahub/MangaHub.kt | 12 +-- .../multisrc/mangamainac/MangaMainac.kt | 2 +- .../multisrc/mangaraw/MangaRawTheme.kt | 6 +- .../multisrc/mangathemesia/MangaThemesia.kt | 8 +- .../multisrc/mangaworld/MangaWorld.kt | 2 +- .../tachiyomi/multisrc/mccms/MCCMSNsfw.kt | 2 +- .../tachiyomi/multisrc/mccms/MCCMSWeb.kt | 20 ++-- .../eu/kanade/tachiyomi/multisrc/mdb/MDB.kt | 24 ++--- .../tachiyomi/multisrc/mmrcms/MMRCMS.kt | 14 +-- .../tachiyomi/multisrc/multichan/MultiChan.kt | 16 ++-- .../multisrc/mymangacms/MyMangaCMS.kt | 22 ++--- .../tachiyomi/multisrc/nepnep/NepNep.kt | 10 +- .../multisrc/otakusanctuary/OtakuSanctuary.kt | 10 +- .../kanade/tachiyomi/multisrc/sinmh/SinMH.kt | 42 ++++----- .../tachiyomi/multisrc/webtoons/Webtoons.kt | 8 +- .../tachiyomi/multisrc/wpcomics/WPComics.kt | 6 +- .../kanade/tachiyomi/multisrc/zbulu/Zbulu.kt | 8 +- .../multisrc/zeistmanga/ZeistManga.kt | 14 +-- .../multisrc/zeistmanga/ZeistMangaDto.kt | 2 +- .../tachiyomi/multisrc/zmanga/ZManga.kt | 4 +- .../tachiyomi/extension/all/batoto/BatoTo.kt | 6 +- .../extension/all/buondua/BuonDua.kt | 8 +- .../extension/all/ehentai/EHentai.kt | 2 +- .../extension/all/everiaclub/EveriaClub.kt | 4 +- .../extension/all/hennojin/Hennojin.kt | 4 +- .../extension/all/imhentai/IMHentai.kt | 29 +++--- .../extension/all/junmeitu/Junmeitu.kt | 6 +- .../tachiyomi/extension/all/kavita/Kavita.kt | 92 ++----------------- .../tachiyomi/extension/all/komga/Komga.kt | 27 +----- .../all/littlegarden/LittleGarden.kt | 6 +- .../mangapluscreators/MangaPlusCreators.kt | 10 +- .../all/mangareaderto/MangaReader.kt | 24 ++--- .../extension/all/mangatoon/MangaToon.kt | 4 +- .../extension/all/meituatop/MeituaTop.kt | 12 +-- .../all/myreadingmanga/MyReadingManga.kt | 16 ++-- .../extension/all/netcomics/NetcomicsAPI.kt | 2 +- .../extension/all/nhentai/NHUtils.kt | 2 +- .../extension/all/nhentai/NHentai.kt | 8 +- .../extension/all/ninemanga/NineManga.kt | 6 +- .../extension/all/noisemanga/NoiseManga.kt | 4 +- .../all/peppercarrot/PepperCarrot.kt | 6 +- .../extension/all/peppercarrot/Preferences.kt | 4 +- .../extension/all/photos18/Photos18.kt | 16 ++-- .../all/sandraandwoo/SandraAndWoo.kt | 2 +- .../extension/all/tappytoon/Tappytoon.kt | 2 +- .../extension/all/toomics/ToomicsGlobal.kt | 6 +- .../extension/all/xinmeitulu/Xinmeitulu.kt | 6 +- .../extension/all/xkcd/translations/XkcdFR.kt | 2 +- .../extension/all/xkcd/translations/XkcdRU.kt | 2 +- .../all/yaoimangaonline/YaoiMangaOnline.kt | 10 +- .../extension/ar/asgardteam/AsgardTeam.kt | 2 +- .../tachiyomi/extension/ar/mangaae/MangaAe.kt | 6 +- .../tachiyomi/extension/ar/remanga/REManga.kt | 4 +- .../tachiyomi/extension/ar/shqqaa/Shqqaa.kt | 14 +-- .../tachiyomi/extension/ar/teamx/TeamX.kt | 14 +-- .../extension/de/mangatube/MangaTube.kt | 4 +- .../extension/de/wiemanga/WieManga.kt | 6 +- .../extension/en/mangarok/MangaRok.kt | 20 ++-- .../tachiyomi/extension/en/aurora/Aurora.kt | 12 +-- .../extension/en/buttsmithy/Buttsmithy.kt | 15 +-- .../extension/en/clonemanga/CloneManga.kt | 6 +- .../extension/en/comicastle/Comicastle.kt | 2 +- .../extension/en/comicextra/ComicExtra.kt | 4 +- .../en/darklegacycomics/DarkLegacyComics.kt | 6 +- .../digitalcomicmuseum/DigitalComicMuseum.kt | 10 +- .../tachiyomi/extension/en/dilbert/Dilbert.kt | 8 +- .../tachiyomi/extension/en/doujins/Doujins.kt | 7 +- .../extension/en/dynasty/DynastyChapters.kt | 2 +- .../extension/en/dynasty/DynastyDoujins.kt | 4 +- .../extension/en/dynasty/DynastyScans.kt | 18 +--- .../extension/en/earlymanga/EarlyManga.kt | 4 +- .../en/eggporncomics/Eggporncomics.kt | 2 +- .../tachiyomi/extension/en/explosm/Explosm.kt | 4 +- .../extension/en/grrlpower/GrrlPower.kt | 4 +- .../en/gunnerkriggcourt/GunnerkriggCourt.kt | 8 +- .../tachiyomi/extension/en/gwtb/GWTB.kt | 3 +- .../tachiyomi/extension/en/hbrowse/HBrowse.kt | 12 +-- .../extension/en/hentai2read/Hentai2Read.kt | 22 ++--- .../extension/en/hentaifox/HentaiFox.kt | 2 +- .../extension/en/hiveworks/Hiveworks.kt | 14 +-- .../extension/en/irovedout/IRovedOut.kt | 12 +-- .../extension/en/keenspot/TwoKinds.kt | 8 +- .../KillSixBillionDemons.kt | 13 +-- .../extension/en/latisbooks/Latisbooks.kt | 2 +- .../extension/en/lemonfont/LemonFont.kt | 4 +- .../en/loadingartist/LoadingArtist.kt | 2 +- .../extension/en/madokami/Madokami.kt | 2 +- .../tachiyomi/extension/en/manga1s/manga1s.kt | 2 +- .../extension/en/mangadoom/MangaDoom.kt | 20 ++-- .../extension/en/mangafox/MangaFox.kt | 8 +- .../extension/en/mangafreak/Mangafreak.kt | 4 +- .../tachiyomi/extension/en/mangago/Mangago.kt | 18 ++-- .../extension/en/mangahasu/Mangahasu.kt | 8 +- .../extension/en/mangahere/Mangahere.kt | 22 ++--- .../extension/en/mangakatana/MangaKatana.kt | 8 +- .../extension/en/mangapark/MangaPark.kt | 10 +- .../extension/en/mangapill/MangaPill.kt | 2 +- .../extension/en/mangaplex/MangaPlex.kt | 4 +- .../extension/en/mangarawclub/MangaRawClub.kt | 10 +- .../extension/en/mangasail/Mangasail.kt | 20 ++-- .../extension/en/mangatown/Mangatown.kt | 2 +- .../extension/en/megatokyo/Megatokyo.kt | 8 +- .../en/myhentaicomics/MyHentaiComics.kt | 2 +- .../tachiyomi/extension/en/nana/Nana.kt | 8 +- .../extension/en/ninehentai/NineHentai.kt | 4 +- .../extension/en/nuxscans/NuxScans.kt | 14 +-- .../extension/en/purplecress/PurpleCress.kt | 32 +++---- .../extension/en/randowiz/Randowiz.kt | 2 +- .../extension/en/rawmanga/RawManga.kt | 8 +- .../en/readcomiconline/Readcomiconline.kt | 4 +- .../tachiyomi/extension/en/readm/ReadM.kt | 6 +- .../en/readmangatoday/Readmangatoday.kt | 11 +-- .../en/reallifecomics/RealLifeComics.kt | 8 +- .../extension/en/reaperscans/ReaperScans.kt | 10 +- .../en/schlockmercenary/Schlockmercenary.kt | 9 +- .../SilentMangaAudition.kt | 4 +- .../en/soushiyofamiliar/SoushiyoFamiliar.kt | 6 +- .../en/theduckwebcomics/TheDuckWebcomics.kt | 12 +-- .../en/thepropertyofhate/ThePropertyOfHate.kt | 4 +- .../extension/en/tsumino/TsuminoUtils.kt | 6 +- .../extension/en/vgperson/Vgperson.kt | 10 +- .../en/vizshonenjump/VizShonenJump.kt | 6 +- .../tachiyomi/extension/en/voyceme/VoyceMe.kt | 2 +- .../extension/en/vyvymanga/VyvyManga.kt | 12 +-- .../extension/en/webcomics/Webcomics.kt | 8 +- .../extension/es/heavenmanga/HeavenManga.kt | 2 +- .../extension/es/ikuhentai/Ikuhentai.kt | 12 +-- .../es/kingsofdarkness/KingsOfDarkness.kt | 8 +- .../tachiyomi/extension/es/kumanga/Kumanga.kt | 2 +- .../extension/es/lectormanga/LectorManga.kt | 10 +- .../extension/es/leercapitulo/LeerCapitulo.kt | 19 ++-- .../es/leermangasxyz/LeerMangasXYZ.kt | 33 +++---- .../es/manhwalatino/ManhwaLatinoSiteParser.kt | 8 +- .../extension/es/mangamx/MangaOni.kt | 4 +- .../extension/es/manhwasnet/ManhwasNet.kt | 20 ++-- .../extension/es/tmohentai/TMOHentai.kt | 7 +- .../es/tumangaonline/TuMangaOnline.kt | 18 ++-- .../tachiyomi/extension/es/vcpvmp/VCPVMP.kt | 2 +- .../extension/es/vcpvmp/VCPVMPFactory.kt | 4 +- .../extension/fr/furyosquad/FuryoSquad.kt | 6 +- .../extension/fr/japanread/Japanread.kt | 2 +- .../tachiyomi/extension/fr/japscan/Japscan.kt | 10 +- .../extension/fr/lirescan/LireScan.kt | 12 ++- .../fr/scantradunion/ScantradUnion.kt | 2 +- .../extension/id/komikfan/KomikFan.kt | 4 +- .../extension/id/bacakomik/BacaKomik.kt | 16 ++-- .../tachiyomi/extension/id/comicfx/ComicFx.kt | 8 +- .../extension/id/doujindesu/DoujinDesu.kt | 8 +- .../extension/id/komikindoid/KomikIndoID.kt | 10 +- .../tachiyomi/extension/id/komiku/Komiku.kt | 18 ++-- .../tachiyomi/extension/id/mangaku/Mangaku.kt | 9 +- .../extension/it/animegdrclub/AnimeGDRClub.kt | 12 +-- .../it/demoneceleste/DemoneCeleste.kt | 24 ++--- .../extension/it/digitalteam/DigitalTeam.kt | 14 +-- .../it/hentaifantasy/HentaiFantasy.kt | 8 +- .../it/novelleleggere/NovelleLeggere.kt | 8 +- .../it/shingekinoshoujo/ShingekiNoShoujo.kt | 22 ++--- .../extension/it/zeurelscan/ZeurelScan.kt | 26 +++--- .../extension/ja/comicnewtype/ComicNewtype.kt | 28 +++--- .../ja/nikkangecchan/Nikkangecchan.kt | 24 ++--- .../extension/ja/senmanga/SenManga.kt | 8 +- .../extension/ko/navercomic/NaverComic.kt | 4 +- .../extension/ko/navercomic/NaverComicBase.kt | 8 +- .../extension/ko/newtoki/ManaToki.kt | 2 +- .../tachiyomi/extension/ko/newtoki/NewToki.kt | 10 +- .../tachiyomi/extension/pt/bakai/Bakai.kt | 4 +- .../extension/pt/brmangas/BrMangas.kt | 2 +- .../extension/pt/goldenmangas/GoldenMangas.kt | 22 ++--- .../extension/pt/mundohentai/MundoHentai.kt | 2 +- .../extension/pt/mundowebtoon/MundoWebtoon.kt | 10 +- .../tachiyomi/extension/pt/opex/OnePieceEx.kt | 2 +- .../tachiyomi/extension/ru/acomics/AComics.kt | 8 +- .../tachiyomi/extension/ru/comx/ComX.kt | 18 ++-- .../extension/ru/mangabook/MangaBook.kt | 18 ++-- .../extension/ru/mangahub/Mangahub.kt | 8 +- .../extension/ru/mangapoisk/MangaPoisk.kt | 16 ++-- .../extension/ru/nudemoon/Nudemoon.kt | 6 +- .../extension/ru/unicomics/UniComics.kt | 30 +++--- .../extension/ru/waymanga/WayManga.kt | 20 ++-- .../extension/ru/webofcomics/WebOfComics.kt | 28 +++--- .../extension/ru/mangabook/YagamiProject.kt | 36 ++++---- .../extension/th/mikudoujin/MikuDoujin.kt | 6 +- .../extension/th/niceoppai/Niceoppai.kt | 10 +- .../extension/tr/serimanga/SeriManga.kt | 2 +- .../extension/uk/mangainua/Mangainua.kt | 10 +- .../extension/vi/blogtruyen/BlogTruyen.kt | 30 +++--- .../extension/vi/cuutruyen/dto/ChapterDto.kt | 2 +- .../extension/vi/hentaivn/HentaiVN.kt | 8 +- .../extension/vi/lxhentai/LxHentai.kt | 14 +-- .../tachiyomi/extension/vi/MangaXY/MangaXY.kt | 16 ++-- .../vi/medoctruyentranh/MeDocTruyenTranh.kt | 12 +-- .../tachiyomi/extension/vi/qmanga/QManga.kt | 2 +- .../extension/vi/truyengihot/TruyenGiHot.kt | 4 +- .../extension/vi/truyenqq/TruyenQQ.kt | 6 +- .../extension/vi/truyentranh8/TruyenTranh8.kt | 26 +++--- .../extension/vi/yurineko/YuriNeko.kt | 2 +- .../extension/zh/baimangu/Baimangu.kt | 14 +-- .../extension/zh/baozimanhua/Baozi.kt | 12 +-- .../extension/zh/baozimhorg/BaozimhOrg.kt | 18 ++-- .../tachiyomi/extension/zh/boylove/BoyLove.kt | 2 +- .../extension/zh/comicabc/Comicabc.kt | 24 ++--- .../tachiyomi/extension/zh/happymh/Happymh.kt | 10 +- .../tachiyomi/extension/zh/iqiyi/Iqiyi.kt | 28 +++--- .../zh/jinmantiantang/Jinmantiantang.kt | 16 ++-- .../zh/kuaikanmanhua/Kuaikanmanhua.kt | 16 +--- .../extension/zh/manhuagui/Manhuagui.kt | 28 +++--- .../tachiyomi/extension/zh/manwa/Manwa.kt | 14 +-- .../tachiyomi/extension/zh/sixmh/SixMH.kt | 12 +-- .../tachiyomi/extension/zh/wnacg/wnacg.kt | 6 +- .../tachiyomi/extension/zh/zerobyw/Zerobyw.kt | 6 +- 262 files changed, 1207 insertions(+), 1374 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c1d31ff7b..4e17e5c4a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -21,7 +21,7 @@ coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-androi injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" } rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" } rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" } -jsoup = { module = "org.jsoup:jsoup", version = "1.13.1" } +jsoup = { module = "org.jsoup:jsoup", version = "1.15.1" } okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" } quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" } diff --git a/multisrc/overrides/fmreader/epikmanga/src/EpikManga.kt b/multisrc/overrides/fmreader/epikmanga/src/EpikManga.kt index 8df81dab3..c912175a7 100644 --- a/multisrc/overrides/fmreader/epikmanga/src/EpikManga.kt +++ b/multisrc/overrides/fmreader/epikmanga/src/EpikManga.kt @@ -29,7 +29,7 @@ class EpikManga : FMReader("Epik Manga", "https://www.epikmanga.com", "tr") { } override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/seri-listesi?type=text", headers) private fun searchMangaParse(response: Response, query: String): MangasPage { - val mangas = response.asJsoup().select("div.char.col-lg-4 a") + val mangas = response.asJsoup().select("div.char.col-lg-4 a").toList() .filter { it.text().contains(query, ignoreCase = true) } .map { SManga.create().apply { @@ -40,7 +40,7 @@ class EpikManga : FMReader("Epik Manga", "https://www.epikmanga.com", "tr") { return MangasPage(mangas, false) } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.col-md-9 div.row").first() + val infoElement = document.select("div.col-md-9 div.row").first()!! return SManga.create().apply { status = parseStatus(infoElement.select("h4:contains(Durum:)").firstOrNull()?.ownText()) diff --git a/multisrc/overrides/fmreader/ksgroupscans/src/KSGroupScans.kt b/multisrc/overrides/fmreader/ksgroupscans/src/KSGroupScans.kt index 7002ef286..a87dbd093 100644 --- a/multisrc/overrides/fmreader/ksgroupscans/src/KSGroupScans.kt +++ b/multisrc/overrides/fmreader/ksgroupscans/src/KSGroupScans.kt @@ -9,7 +9,7 @@ class KSGroupScans : FMReader("KSGroupScans", "https://ksgroupscans.com", "en") override fun chapterFromElement(element: Element, mangaTitle: String): SChapter { return SChapter.create().apply { - element.select(chapterUrlSelector).first().let { + element.select(chapterUrlSelector).first()!!.let { setUrlWithoutDomain(it.attr("abs:href")) name = element.select(".chapter-name").text() } diff --git a/multisrc/overrides/fmreader/mangatr/src/MangaTR.kt b/multisrc/overrides/fmreader/mangatr/src/MangaTR.kt index 3d760538a..4eef0a56e 100644 --- a/multisrc/overrides/fmreader/mangatr/src/MangaTR.kt +++ b/multisrc/overrides/fmreader/mangatr/src/MangaTR.kt @@ -48,7 +48,7 @@ class MangaTR : FMReader("Manga-TR", "https://manga-tr.com", "tr") { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - val infoElement: Element = document.select("div#tab1").first() + val infoElement: Element = document.select("div#tab1").first()!! manga.author = infoElement.select("table + table tr + tr td a").first()?.text() manga.artist = infoElement.select("table + table tr + tr td + td a").first()?.text() diff --git a/multisrc/overrides/fmreader/saytruyen/src/SayTruyen.kt b/multisrc/overrides/fmreader/saytruyen/src/SayTruyen.kt index 91501e9de..d4c7b0a30 100644 --- a/multisrc/overrides/fmreader/saytruyen/src/SayTruyen.kt +++ b/multisrc/overrides/fmreader/saytruyen/src/SayTruyen.kt @@ -10,7 +10,7 @@ import org.jsoup.nodes.Document class SayTruyen : FMReader("Say Truyen", "https://saytruyenvip.com", "vi") { override fun mangaDetailsParse(document: Document): SManga { - val info = document.select("div.row").first() + val info = document.select("div.row").first()!! return SManga.create().apply { author = info.select("div.row li:has(b:contains(Tác giả)) small").text() genre = info.select("div.row li:has(b:contains(Thể loại)) small a").joinToString { it.text() } diff --git a/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt b/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt index 543966a7a..a9d73e273 100644 --- a/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt +++ b/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt @@ -24,8 +24,8 @@ class UniversoHentai : Gattsu( override fun latestUpdatesSelector() = "div.meio div.videos div.video a[href^=$baseUrl]:not(:has(span.selo-hd))" override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("span.video-titulo").text().trim() - thumbnail_url = element.selectFirst("img.wp-post-image").attr("src") + title = element.selectFirst("span.video-titulo")!!.text().trim() + thumbnail_url = element.selectFirst("img.wp-post-image")!!.attr("src") setUrlWithoutDomain(element.attr("href")) } @@ -54,11 +54,11 @@ class UniversoHentai : Gattsu( override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { name = "Capítulo único" scanlator = element.select("ul.paginaPostItens li:contains(Tradutor) a").firstOrNull()?.text() - date_upload = element.ownerDocument().select("meta[property=article:published_time]").firstOrNull() + date_upload = element.ownerDocument()!!.select("meta[property=article:published_time]").firstOrNull() ?.attr("content") .orEmpty() .toDate() - setUrlWithoutDomain(element.selectFirst("a[title=Abrir galeria]").attr("href")) + setUrlWithoutDomain(element.selectFirst("a[title=Abrir galeria]")!!.attr("href")) } override fun pageListSelector() = "div.meio div.galeria div.galeria-foto a img" diff --git a/multisrc/overrides/genkan/lynxscans/src/LynxScans.kt b/multisrc/overrides/genkan/lynxscans/src/LynxScans.kt index 2b36dd312..944f5237d 100644 --- a/multisrc/overrides/genkan/lynxscans/src/LynxScans.kt +++ b/multisrc/overrides/genkan/lynxscans/src/LynxScans.kt @@ -8,7 +8,7 @@ class LynxScans : Genkan("LynxScans", "https://lynxscans.com", "en", "/web/comic override fun pageListParse(document: Document): List { val pages = mutableListOf() - val allImages = document.select("div#pages-container + script").first().data() + val allImages = document.select("div#pages-container + script").first()!!.data() .substringAfter("[").substringBefore("];") .replace(Regex("""["\\]"""), "") .split(",/") diff --git a/multisrc/overrides/gigaviewer/comicgardo/src/ComicGardo.kt b/multisrc/overrides/gigaviewer/comicgardo/src/ComicGardo.kt index b9d383fae..c1819ffcf 100644 --- a/multisrc/overrides/gigaviewer/comicgardo/src/ComicGardo.kt +++ b/multisrc/overrides/gigaviewer/comicgardo/src/ComicGardo.kt @@ -23,9 +23,9 @@ class ComicGardo : GigaViewer( override fun popularMangaSelector(): String = "ul.series-section-list li.series-section-item > a" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h5.series-title").text() - thumbnail_url = element.selectFirst("div.thumb img").attr("data-src") - setUrlWithoutDomain(element.attr("href")) + title = element.selectFirst("h5.series-title")!!.text() + thumbnail_url = element.selectFirst("div.thumb img")!!.attr("data-src") + setUrlWithoutDomain(element.attr("href")!!) } override fun getCollections(): List = listOf( diff --git a/multisrc/overrides/gigaviewer/kuragebunch/src/KurageBunch.kt b/multisrc/overrides/gigaviewer/kuragebunch/src/KurageBunch.kt index f2a525e92..6e8a56ac2 100644 --- a/multisrc/overrides/gigaviewer/kuragebunch/src/KurageBunch.kt +++ b/multisrc/overrides/gigaviewer/kuragebunch/src/KurageBunch.kt @@ -27,8 +27,8 @@ class KurageBunch : GigaViewer( override fun popularMangaSelector(): String = "ul.page-series-list li div.item-box" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("a.series-data-container h4").text() - thumbnail_url = element.selectFirst("a.series-thumb img").attr("data-src") + title = element.selectFirst("a.series-data-container h4")!!.text() + thumbnail_url = element.selectFirst("a.series-thumb img")!!.attr("data-src") setUrlWithoutDomain(element.selectFirst("a")!!.attr("href")) } diff --git a/multisrc/overrides/gigaviewer/magazinepocket/src/MagazinePocket.kt b/multisrc/overrides/gigaviewer/magazinepocket/src/MagazinePocket.kt index 77ef680f6..581ae2733 100644 --- a/multisrc/overrides/gigaviewer/magazinepocket/src/MagazinePocket.kt +++ b/multisrc/overrides/gigaviewer/magazinepocket/src/MagazinePocket.kt @@ -21,9 +21,9 @@ class MagazinePocket : GigaViewer( override fun popularMangaSelector(): String = "ul.daily-series li.daily-series-item > a" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h4.daily-series-title").text() - thumbnail_url = element.selectFirst("div.daily-series-thumb img").attr("data-src") - setUrlWithoutDomain(element.attr("href")) + title = element.selectFirst("h4.daily-series-title")!!.text() + thumbnail_url = element.selectFirst("div.daily-series-thumb img")!!.attr("data-src") + setUrlWithoutDomain(element.attr("href")!!) } override fun latestUpdatesSelector(): String = "section.daily.$dayOfWeek " + popularMangaSelector() diff --git a/multisrc/overrides/gigaviewer/tonarinoyoungjump/src/TonariNoYoungJump.kt b/multisrc/overrides/gigaviewer/tonarinoyoungjump/src/TonariNoYoungJump.kt index 2ca591b87..f482e30b2 100644 --- a/multisrc/overrides/gigaviewer/tonarinoyoungjump/src/TonariNoYoungJump.kt +++ b/multisrc/overrides/gigaviewer/tonarinoyoungjump/src/TonariNoYoungJump.kt @@ -23,8 +23,8 @@ class TonariNoYoungJump : GigaViewer( override fun popularMangaSelector(): String = "ul.series-table-list li.subpage-table-list-item > a" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h4.title").text() - thumbnail_url = element.selectFirst("div.subpage-image-wrapper img").attr("data-src") + title = element.selectFirst("h4.title")!!.text() + thumbnail_url = element.selectFirst("div.subpage-image-wrapper img")!!.attr("data-src") .replace("{width}", "528") .replace("{height}", "528") setUrlWithoutDomain(element.attr("href")) diff --git a/multisrc/overrides/madara/manga18fx/src/Manga18fx.kt b/multisrc/overrides/madara/manga18fx/src/Manga18fx.kt index df8fa4da3..cbe9cceb5 100644 --- a/multisrc/overrides/madara/manga18fx/src/Manga18fx.kt +++ b/multisrc/overrides/madara/manga18fx/src/Manga18fx.kt @@ -37,7 +37,7 @@ class Manga18fx : Madara( override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() loadGenres(document) - val block = document.selectFirst(Evaluator.Class("trending-block")) + val block = document.selectFirst(Evaluator.Class("trending-block"))!! val mangas = block.select(Evaluator.Tag("a")).map(::mangaFromElement) return MangasPage(mangas, false) } @@ -45,7 +45,7 @@ class Manga18fx : Madara( private fun mangaFromElement(element: Element) = SManga.create().apply { url = element.attr("href") title = element.attr("title") - thumbnail_url = element.selectFirst(Evaluator.Tag("img")).attr("data-src") + thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.attr("data-src") } override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/page/$page", headers) @@ -54,9 +54,9 @@ class Manga18fx : Madara( val document = response.asJsoup() loadGenres(document) val mangas = document.select(Evaluator.Class("bsx-item")).map { - mangaFromElement(it.selectFirst(Evaluator.Tag("a"))) + mangaFromElement(it.selectFirst(Evaluator.Tag("a"))!!) } - val nextButton = document.selectFirst(Evaluator.Class("next")) + val nextButton = document.selectFirst(Evaluator.Class("next"))!! val hasNextPage = nextButton != null && nextButton.hasClass("disabled").not() return MangasPage(mangas, hasNextPage) } @@ -91,7 +91,7 @@ class Manga18fx : Madara( override fun chapterListParse(response: Response): List { val document = response.asJsoup() - val container = document.selectFirst(Evaluator.Class("row-content-chapter")) + val container = document.selectFirst(Evaluator.Class("row-content-chapter"))!! return container.children().map(::chapterFromElement) } diff --git a/multisrc/overrides/madara/mangaleveling/src/MangaLeveling.kt b/multisrc/overrides/madara/mangaleveling/src/MangaLeveling.kt index 56c41ec46..48e6b8e01 100644 --- a/multisrc/overrides/madara/mangaleveling/src/MangaLeveling.kt +++ b/multisrc/overrides/madara/mangaleveling/src/MangaLeveling.kt @@ -16,7 +16,7 @@ class MangaLeveling : Madara("Manga Leveling", "https://mangaleveling.com", "en" chapter.url = urlElement.attr("abs:href").let { it.substringBefore("?style=paged") + if (!it.endsWith(chapterUrlSuffix)) chapterUrlSuffix else "" } - chapter.name = urlElement.selectFirst("span").text() + chapter.name = urlElement.selectFirst("span")!!.text() } // Dates can be part of a "new" graphic or plain text // Added "title" alternative diff --git a/multisrc/overrides/madara/mmscans/src/MMScans.kt b/multisrc/overrides/madara/mmscans/src/MMScans.kt index ce579c0f3..9f688d691 100644 --- a/multisrc/overrides/madara/mmscans/src/MMScans.kt +++ b/multisrc/overrides/madara/mmscans/src/MMScans.kt @@ -16,7 +16,7 @@ class MMScans : Madara("MMScans", "https://mm-scans.org", "en") { with(element) { select(popularMangaUrlSelector).first()?.let { manga.setUrlWithoutDomain(it.attr("abs:href")) - manga.title = it.selectFirst("h3").ownText() + manga.title = it.selectFirst("h3")!!.ownText() } select("img").first()?.let { @@ -35,7 +35,7 @@ class MMScans : Madara("MMScans", "https://mm-scans.org", "en") { chapter.url = urlElement.attr("abs:href").let { it.substringBefore("?style=paged") + if (!it.endsWith(chapterUrlSuffix)) chapterUrlSuffix else "" } - chapter.name = urlElement.selectFirst(".chapter-title-date p").text() + chapter.name = urlElement.selectFirst(".chapter-title-date p")!!.text() } chapter.date_upload = parseChapterDate(select(chapterDateSelector()).firstOrNull()?.text()) } diff --git a/multisrc/overrides/mangabz/vomic/src/Vomic.kt b/multisrc/overrides/mangabz/vomic/src/Vomic.kt index a6fb925eb..ae4d2c48b 100644 --- a/multisrc/overrides/mangabz/vomic/src/Vomic.kt +++ b/multisrc/overrides/mangabz/vomic/src/Vomic.kt @@ -62,16 +62,16 @@ class Vomic : MangabzTheme("vomic", ""), ConfigurableSource { val mangas = buildList { // ranking sidebar - addAll(document.selectFirst(Evaluator.Class("rank-list")).children()) + addAll(document.selectFirst(Evaluator.Class("rank-list"))!!.children()) // carousel list - addAll(document.selectFirst(Evaluator.Class("carousel-right-list")).children()) + addAll(document.selectFirst(Evaluator.Class("carousel-right-list"))!!.children()) // recommend list - addAll(document.select(Evaluator.Class("index-manga-item"))) + addAll(document.select(Evaluator.Class("index-manga-item"))!!) }.map { element -> SManga.create().apply { - title = element.selectFirst(paragraph).text() - url = element.selectFirst(link).attr("href") - thumbnail_url = element.selectFirst(image).attr("src") + title = element.selectFirst(paragraph)!!.text() + url = element.selectFirst(link)!!.attr("href") + thumbnail_url = element.selectFirst(image)!!.attr("src") } } diff --git a/multisrc/overrides/mangacatalog/readattackontitanshingekinokyojinmanga/src/ReadAttackOnTitanShingekiNoKyojinManga.kt b/multisrc/overrides/mangacatalog/readattackontitanshingekinokyojinmanga/src/ReadAttackOnTitanShingekiNoKyojinManga.kt index dd282a206..e58153de5 100644 --- a/multisrc/overrides/mangacatalog/readattackontitanshingekinokyojinmanga/src/ReadAttackOnTitanShingekiNoKyojinManga.kt +++ b/multisrc/overrides/mangacatalog/readattackontitanshingekinokyojinmanga/src/ReadAttackOnTitanShingekiNoKyojinManga.kt @@ -23,11 +23,11 @@ class ReadAttackOnTitanShingekiNoKyojinManga : MangaCatalog("Read Attack on Tita override fun chapterListSelector(): String = "div.w-full div.grid div.col-span-3" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - val urlElemnt = element.selectFirst("a") + val urlElement = element.selectFirst("a")!! name = listOfNotNull( - urlElemnt.text(), - element.selectFirst("div.text-xs").text().takeUnless { it.isBlank() }, + urlElement.text(), + element.selectFirst("div.text-xs")!!.text().takeUnless { it.isBlank() }, ).joinToString(" - ") { it.trim() } - url = urlElemnt.attr("abs:href") + url = urlElement.attr("abs:href") } } diff --git a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt index 7f30e3cb1..31d425077 100644 --- a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt +++ b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt @@ -58,10 +58,10 @@ class MangaRaw : MangaRawTheme("MangaRaw", ""), ConfigurableSource { GET("$baseUrl/?s=$query&page=$page", headers) override fun Document.getSanitizedDetails(): Element = - selectFirst(selectors.detailsSelector).apply { + selectFirst(selectors.detailsSelector)!!.apply { val recommendClass = selectors.recommendClass children().find { it.hasClass(recommendClass) }?.remove() - selectFirst(Evaluator.Class("list-scoll")).remove() + selectFirst(Evaluator.Class("list-scoll"))!!.remove() } override fun chapterListSelector() = ".list-scoll a" diff --git a/multisrc/overrides/mangaraw/syosetu/src/SyoSetu.kt b/multisrc/overrides/mangaraw/syosetu/src/SyoSetu.kt index 7f5299e35..5c9620f99 100644 --- a/multisrc/overrides/mangaraw/syosetu/src/SyoSetu.kt +++ b/multisrc/overrides/mangaraw/syosetu/src/SyoSetu.kt @@ -28,8 +28,8 @@ class SyoSetu : MangaRawTheme("SyoSetu", "https://syosetu.top") { GET("$baseUrl/page/$page?s=$query") override fun Document.getSanitizedDetails(): Element = - selectFirst(Evaluator.Tag("article")).selectFirst(Evaluator.Class("content-wrap-inner")).apply { - selectFirst(Evaluator.Class("chaplist")).remove() + selectFirst(Evaluator.Tag("article"))!!.selectFirst(Evaluator.Class("content-wrap-inner"))!!.apply { + selectFirst(Evaluator.Class("chaplist"))!!.remove() } override fun chapterListSelector() = ".chaplist a" diff --git a/multisrc/overrides/mangasar/seemangas/src/Seemangas.kt b/multisrc/overrides/mangasar/seemangas/src/Seemangas.kt index f2960f42a..246e3820f 100644 --- a/multisrc/overrides/mangasar/seemangas/src/Seemangas.kt +++ b/multisrc/overrides/mangasar/seemangas/src/Seemangas.kt @@ -26,9 +26,9 @@ class Seemangas : MangaSar( override fun popularMangaSelector() = "ul.sidebar-popular li.popular-treending" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h4.title").text() - thumbnail_url = element.selectFirst("div.tumbl img").attr("data-lazy-src") - setUrlWithoutDomain(element.selectFirst("a").attr("abs:href")) + title = element.selectFirst("h4.title")!!.text() + thumbnail_url = element.selectFirst("div.tumbl img")!!.attr("data-lazy-src") + setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href")) } override fun latestUpdatesRequest(page: Int): Request { @@ -58,15 +58,15 @@ class Seemangas : MangaSar( override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() - val infoElement = document.selectFirst("div.box-single:has(div.mangapage)") + val infoElement = document.selectFirst("div.box-single:has(div.mangapage)")!! return SManga.create().apply { - title = infoElement.selectFirst("h1.kw-title").text() - author = infoElement.selectFirst("div.mdq.author").text().trim() - description = infoElement.selectFirst("div.sinopse-page").text() - genre = infoElement.select("div.generos a.widget-btn").joinToString { it.text() } - status = infoElement.selectFirst("span.mdq").text().toStatus() - thumbnail_url = infoElement.selectFirst("div.thumb img").attr("abs:data-lazy-src") + title = infoElement.selectFirst("h1.kw-title")!!.text() + author = infoElement.selectFirst("div.mdq.author")!!.text().trim() + description = infoElement.selectFirst("div.sinopse-page")!!.text() + genre = infoElement.select("div.generos a.widget-btn")!!.joinToString { it.text() } + status = infoElement.selectFirst("span.mdq")!!.text().toStatus() + thumbnail_url = infoElement.selectFirst("div.thumb img")!!.attr("abs:data-lazy-src") } } override fun chapterListPaginatedRequest(mangaUrl: String, page: Int): Request { diff --git a/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt b/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt index bb1e4de7d..a36616de8 100644 --- a/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt +++ b/multisrc/overrides/mangathemesia/flamescans/src/FlameScans.kt @@ -66,7 +66,7 @@ open class FlameScans( return super.pageListParse(document) } - return document.select("#readerarea p:has(img), $composedSelector") + return document.select("#readerarea p:has(img), $composedSelector").toList() .filter { it.select("img").all { imgEl -> imgEl.attr("abs:src").isNullOrEmpty().not() diff --git a/multisrc/overrides/mangathemesia/kiryuu/src/Kiryuu.kt b/multisrc/overrides/mangathemesia/kiryuu/src/Kiryuu.kt index 1159acd18..74d2c613a 100644 --- a/multisrc/overrides/mangathemesia/kiryuu/src/Kiryuu.kt +++ b/multisrc/overrides/mangathemesia/kiryuu/src/Kiryuu.kt @@ -20,7 +20,7 @@ class Kiryuu : MangaThemesia("Kiryuu", "https://kiryuu.id", "id", dateFormat = S // manga details override fun mangaDetailsParse(document: Document) = super.mangaDetailsParse(document).apply { - title = document.selectFirst(seriesThumbnailSelector).attr("title") + title = document.selectFirst(seriesThumbnailSelector)!!.attr("title") } override val hasProjectPage = true diff --git a/multisrc/overrides/mangathemesia/komikcast/src/KomikCast.kt b/multisrc/overrides/mangathemesia/komikcast/src/KomikCast.kt index 89d3147a6..86c45de13 100644 --- a/multisrc/overrides/mangathemesia/komikcast/src/KomikCast.kt +++ b/multisrc/overrides/mangathemesia/komikcast/src/KomikCast.kt @@ -7,7 +7,6 @@ import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter -import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonObject import okhttp3.Headers @@ -62,7 +61,7 @@ class KomikCast : MangaThemesia( override fun searchMangaSelector() = "div.list-update_item" override fun searchMangaFromElement(element: Element) = super.searchMangaFromElement(element).apply { - title = element.selectFirst("h3.title").ownText() + title = element.selectFirst("h3.title")!!.ownText() } override val seriesDetailsSelector = "div.komik_info:has(.komik_info-content)" @@ -78,7 +77,7 @@ class KomikCast : MangaThemesia( override fun chapterFromElement(element: Element) = SChapter.create().apply { val urlElements = element.select("a") setUrlWithoutDomain(urlElements.attr("href")) - name = element.select(".lch a, .chapternum").text().ifBlank { urlElements.first().text() } + name = element.select(".lch a, .chapternum")!!.text().ifBlank { urlElements.first()!!.text() } date_upload = parseChapterDate2(element.select(".chapter-link-time").text()) } @@ -130,7 +129,7 @@ class KomikCast : MangaThemesia( var imageServer = "cdn" if (!imageList.containsKey(imageServer)) imageServer = imageList.keys.first() val imageElement = imageList[imageServer]!!.jsonArray.joinToString("") - doc = Jsoup.parse(json.decodeFromString(imageElement)) + doc = Jsoup.parse(imageElement) cssQuery = "img.size-full" } diff --git a/multisrc/overrides/mangathemesia/mangaraworg/src/MangaRawOrg.kt b/multisrc/overrides/mangathemesia/mangaraworg/src/MangaRawOrg.kt index 5e7932f57..224359a25 100644 --- a/multisrc/overrides/mangathemesia/mangaraworg/src/MangaRawOrg.kt +++ b/multisrc/overrides/mangathemesia/mangaraworg/src/MangaRawOrg.kt @@ -59,7 +59,7 @@ class MangaRawOrg : MangaThemesia("Manga Raw.org", "https://mangaraw.org", "ja") } private fun pageListParse(response: Response, chapterUrl: String): List { - return response.asJsoup().select("span.page-link").first().ownText().substringAfterLast(" ").toInt() + return response.asJsoup().select("span.page-link").first()!!.ownText().substringAfterLast(" ").toInt() .let { lastNum -> IntRange(1, lastNum) } .map { num -> Page(num, "$chapterUrl/$num") } } diff --git a/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt b/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt index 723a9bafb..ca2a8585d 100644 --- a/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt +++ b/multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt @@ -31,7 +31,7 @@ class MangaSwat : MangaThemesia( override val seriesStatusSelector = "span:contains(الحالة)" override fun pageListParse(document: Document): List { - val scriptContent = document.selectFirst("script:containsData(ts_reader)").data() + val scriptContent = document.selectFirst("script:containsData(ts_reader)")!!.data() val jsonString = scriptContent.substringAfter("ts_reader.run(").substringBefore(");") val tsReader = json.decodeFromString(jsonString) val imageUrls = tsReader.sources.firstOrNull()?.images ?: return emptyList() diff --git a/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt b/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt index 4f067ffbe..29181369d 100644 --- a/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt +++ b/multisrc/overrides/mangathemesia/mangkomik/src/MangKomik.kt @@ -10,7 +10,7 @@ class MangKomik : MangaThemesia("MangKomik", "https://mangkomik.net", "id") { override fun pageListParse(document: Document): List { // Get external JS for image urls - val scriptEl = document.selectFirst("script[data-minify]") + val scriptEl = document.selectFirst("script[data-minify]")!! val scriptUrl = scriptEl?.attr("src") if (scriptUrl.isNullOrEmpty()) { return super.pageListParse(document) diff --git a/multisrc/overrides/mangathemesia/manhwafreak/src/ManhwaFreak.kt b/multisrc/overrides/mangathemesia/manhwafreak/src/ManhwaFreak.kt index 1baa0caa3..0ad450efc 100644 --- a/multisrc/overrides/mangathemesia/manhwafreak/src/ManhwaFreak.kt +++ b/multisrc/overrides/mangathemesia/manhwafreak/src/ManhwaFreak.kt @@ -51,7 +51,7 @@ class ManhwaFreak : MangaThemesia("Manhwa Freak", "https://manhwafreak.com", "en override fun chapterFromElement(element: Element) = SChapter.create().apply { val urlElements = element.select("a") setUrlWithoutDomain(urlElements.attr("href")) - name = element.select(".chapter-info p:nth-child(1)").text().ifBlank { urlElements.first().text() } + name = element.select(".chapter-info p:nth-child(1)")!!.text().ifBlank { urlElements.first()!!.text() } date_upload = element.selectFirst(".chapter-info p:nth-child(2)")?.text().parseChapterDate() } diff --git a/multisrc/overrides/mangathemesia/xcalibrscans/src/xCaliBRScans.kt b/multisrc/overrides/mangathemesia/xcalibrscans/src/xCaliBRScans.kt index cf1009134..00c8ca811 100644 --- a/multisrc/overrides/mangathemesia/xcalibrscans/src/xCaliBRScans.kt +++ b/multisrc/overrides/mangathemesia/xcalibrscans/src/xCaliBRScans.kt @@ -31,7 +31,7 @@ class xCaliBRScans : MangaThemesia("xCaliBR Scans", "https://xcalibrscans.com", .forEach { element -> when { element.tagName() == "p" -> { - val imgUrl = element.selectFirst("img").imgAttr() + val imgUrl = element.selectFirst("img")!!.imgAttr() imgUrls.add(imgUrl) } element.tagName() == "div" && element.hasClass("kage") -> { diff --git a/multisrc/overrides/mmrcms/animaregia/src/AnimaRegia.kt b/multisrc/overrides/mmrcms/animaregia/src/AnimaRegia.kt index 87c89f0e9..bb778dcf8 100644 --- a/multisrc/overrides/mmrcms/animaregia/src/AnimaRegia.kt +++ b/multisrc/overrides/mmrcms/animaregia/src/AnimaRegia.kt @@ -58,12 +58,12 @@ class AnimaRegia : MMRCMS("AnimaRegia", "https://animaregia.net", "pt-BR") { override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply { val document = response.asJsoup() - title = document.selectFirst("h1.widget-title").text() + title = document.selectFirst("h1.widget-title")!!.text() thumbnail_url = coverGuess( document.select("div.col-sm-5 img.img-thumbnail").firstOrNull()?.attr("abs:src"), document.location(), ) - description = document.select("div.row div.well p").text().trim() + description = document.select("div.row div.well p")!!.text().trim() for (element in document.select("div.col-sm-5 ul.list-group li.list-group-item")) { when (element.text().trim().lowercase(BRAZILIAN_LOCALE).substringBefore(":")) { @@ -94,7 +94,7 @@ class AnimaRegia : MMRCMS("AnimaRegia", "https://animaregia.net", "pt-BR") { .joinToString(" & ") { it.text().trim() } date_upload = el.select("div.col-md-4").firstOrNull() ?.text()?.removeSuffix("Download")?.toDate() ?: 0L - setUrlWithoutDomain(el.select("h5.chapter-title-rtl a").first().attr("href")) + setUrlWithoutDomain(el.select("h5.chapter-title-rtl a").first()!!.attr("href")) } } } diff --git a/multisrc/overrides/mmrcms/fallenangels/src/FallenAngels.kt b/multisrc/overrides/mmrcms/fallenangels/src/FallenAngels.kt index a47a5b6db..db7035374 100644 --- a/multisrc/overrides/mmrcms/fallenangels/src/FallenAngels.kt +++ b/multisrc/overrides/mmrcms/fallenangels/src/FallenAngels.kt @@ -16,8 +16,8 @@ class FallenAngels : MMRCMS("Fallen Angels", "https://manga.fascans.com", "en") override fun nullableChapterFromElement(element: Element): SChapter? { val chapter = SChapter.create() - val titleWrapper = element.select("[class^=chapter-title-rtl]").first() - val chapterElement = titleWrapper.getElementsByTag("a") + val titleWrapper = element.select("[class^=chapter-title-rtl]").first()!! + val chapterElement = titleWrapper.getElementsByTag("a")!! val url = chapterElement.attr("href") chapter.url = getUrlWithoutBaseUrl(url) @@ -28,7 +28,7 @@ class FallenAngels : MMRCMS("Fallen Angels", "https://manga.fascans.com", "en") val chapterText = chapterElement.text() val numberRegex = Regex("""[1-9]\d*(\.\d+)*""") val chapterNumber = numberRegex.find(chapterText)?.value.orEmpty() - val chapterTitle = titleWrapper.getElementsByTag("em").text() + val chapterTitle = titleWrapper.getElementsByTag("em")!!.text() chapter.name = "Chapter $chapterNumber : $chapterTitle" // Parse date diff --git a/multisrc/overrides/multichan/henchan/src/HenChan.kt b/multisrc/overrides/multichan/henchan/src/HenChan.kt index ae3e2648e..2c3fc6796 100644 --- a/multisrc/overrides/multichan/henchan/src/HenChan.kt +++ b/multisrc/overrides/multichan/henchan/src/HenChan.kt @@ -105,7 +105,7 @@ class HenChan : MultiChan("HenChan", "http://y.hchan.live", "ru"), ConfigurableS override fun popularMangaFromElement(element: Element): SManga { val manga = super.popularMangaFromElement(element) - manga.thumbnail_url = element.select("img").first().attr("src").getHQThumbnail() + manga.thumbnail_url = element.select("img").first()!!.attr("src").getHQThumbnail() return manga } diff --git a/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt b/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt index b582138ab..3a0d0f0f7 100644 --- a/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt +++ b/multisrc/overrides/sinmh/wuqimanga/src/WuqiManga.kt @@ -40,12 +40,12 @@ class WuqiManga : SinMH("57漫画", "http://www.wuqimh.net") { } override fun mangaDetailsParse(document: Document) = super.mangaDetailsParse(document).apply { - val comment = document.selectFirst(".book-title > h2").text() + val comment = document.selectFirst(".book-title > h2")!!.text() if (comment.isNotEmpty()) description = "$comment\n\n$description" } override fun mangaDetailsParseDefaultGenre(document: Document, detailsList: Element): String = - document.selectFirst("div.crumb").select("a[href^=/list/]") + document.selectFirst("div.crumb")!!.select("a[href^=/list/]") .map { it.text().removeSuffix("年").removeSuffix("漫画") } .filter { it.isNotEmpty() }.joinToString(", ") @@ -62,7 +62,7 @@ class WuqiManga : SinMH("57漫画", "http://www.wuqimh.net") { override fun pageListRequest(chapter: SChapter) = GET(baseUrl + chapter.url, headers) override fun pageListParse(document: Document): List { - val script = document.selectFirst("body > script").html() + val script = document.selectFirst("body > script")!!.html() val unpacked = Unpacker.unpack(script, ":[", "]") .ifEmpty { return emptyList() } .replace("\\", "") @@ -85,7 +85,7 @@ class WuqiManga : SinMH("57漫画", "http://www.wuqimh.net") { document.select(Evaluator.Class("filter")).forEach { row -> val tags = row.select(linkSelector) if (tags.isEmpty()) return@forEach - val name = row.selectFirst(labelSelector).text().removeSuffix(":") + val name = row.selectFirst(labelSelector)!!.text().removeSuffix(":") if (!filterMap.containsKey(name)) { filterMap[name] = LinkedHashMap(tags.size * 2) } diff --git a/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt b/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt index 2d37a2dfa..1e227c675 100644 --- a/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt +++ b/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt @@ -27,14 +27,14 @@ class TruyenChon : WPComics("TruyenChon", "http://truyenchon.com", "vi", SimpleD title = it.text().replace("Truyện tranh ", "") setUrlWithoutDomain(it.attr("abs:href")) } - thumbnail_url = imageOrNull(element.select("div.image:first-of-type img").first()) + thumbnail_url = imageOrNull(element.select("div.image:first-of-type img").first()!!) } } override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { title = element.attr("title").replace("Truyện tranh ", "") setUrlWithoutDomain(element.attr("href")) - thumbnail_url = imageOrNull(element.select("img").first()) + thumbnail_url = imageOrNull(element.select("img").first()!!) } } } diff --git a/multisrc/overrides/zeistmanga/datgarscanlation/src/DatGarScanlation.kt b/multisrc/overrides/zeistmanga/datgarscanlation/src/DatGarScanlation.kt index 7171ca443..9e2857157 100644 --- a/multisrc/overrides/zeistmanga/datgarscanlation/src/DatGarScanlation.kt +++ b/multisrc/overrides/zeistmanga/datgarscanlation/src/DatGarScanlation.kt @@ -13,7 +13,7 @@ class DatGarScanlation : ZeistManga("DatGarScanlation", "https://datgarscanlatio var script = doc.selectFirst(scriptSelector) if (script == null) { - script = doc.selectFirst(altScriptSelector) + script = doc.selectFirst(altScriptSelector)!! chapterRegex = altChapterFeedRegex } diff --git a/multisrc/overrides/zeistmanga/mangaailand/src/MangaAiLand.kt b/multisrc/overrides/zeistmanga/mangaailand/src/MangaAiLand.kt index 7fe3192f6..2a277f8fc 100644 --- a/multisrc/overrides/zeistmanga/mangaailand/src/MangaAiLand.kt +++ b/multisrc/overrides/zeistmanga/mangaailand/src/MangaAiLand.kt @@ -11,7 +11,7 @@ class MangaAiLand : ZeistManga("Manga Ai Land", "https://manga-ai-land.blogspot. override val imgSelectorAttr = "href" override fun getChaptersUrl(doc: Document): String { - val script = doc.selectFirst(scriptSelector).attr("src") + val script = doc.selectFirst(scriptSelector)!!.attr("src") val feed = chapterFeedRegex .find(script) ?.groupValues?.get(1) diff --git a/multisrc/overrides/zmanga/sektekomik/src/SekteKomik.kt b/multisrc/overrides/zmanga/sektekomik/src/SekteKomik.kt index 3245f54b1..ad15015ed 100644 --- a/multisrc/overrides/zmanga/sektekomik/src/SekteKomik.kt +++ b/multisrc/overrides/zmanga/sektekomik/src/SekteKomik.kt @@ -49,7 +49,7 @@ class SekteKomik : ZManga("Sekte Komik", "https://sektekomik.com", "id") { override fun latestUpdatesFromElement(element: Element): SManga { return SManga.create().apply { setUrlWithoutDomain(element.select("div.flexbox4-content a").attr("href")) - title = element.select("div.flexbox4-side .title").first().text() + title = element.select("div.flexbox4-side .title").first()!!.text() thumbnail_url = element.select("img").attr("abs:src") } } @@ -79,7 +79,7 @@ class SekteKomik : ZManga("Sekte Komik", "https://sektekomik.com", "id") { override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { setUrlWithoutDomain(element.select("div.flexbox2-content a").attr("href")) - title = element.select("div.flexbox2-title > span").first().text() + title = element.select("div.flexbox2-title > span").first()!!.text() thumbnail_url = element.select("img").attr("abs:src") } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt index b0e5511b6..a5da4d251 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/a3manga/A3Manga.kt @@ -142,9 +142,9 @@ open class A3Manga( override fun chapterFromElement(element: Element) = SChapter.create().apply { setUrlWithoutDomain(element.select("a").attr("href")) name = element.select("a .hidden-sm").text() - date_upload = kotlin.runCatching { - dateFormat.parse(element.select("td").last().text())?.time - }.getOrNull() ?: 0L + date_upload = runCatching { + dateFormat.parse(element.select("td").last()!!.text())?.time + }.getOrNull() ?: 0 } override fun pageListParse(document: Document): List { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakamanga/BakaManga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakamanga/BakaManga.kt index d6c5fafa1..2d8a1ee25 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakamanga/BakaManga.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/bakamanga/BakaManga.kt @@ -29,9 +29,9 @@ abstract class BakaManga( ".li_truyen" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - setUrlWithoutDomain(element.selectFirst("a").absUrl("href")) - title = element.selectFirst(".name").text() - thumbnail_url = element.selectFirst("img").absUrl("src") + setUrlWithoutDomain(element.selectFirst("a")!!.absUrl("href")) + title = element.selectFirst(".name")!!.text() + thumbnail_url = element.selectFirst("img")!!.absUrl("src") } override fun popularMangaNextPageSelector(): String? = @@ -47,7 +47,7 @@ abstract class BakaManga( val filterList = if (filters.isEmpty()) getFilterList() else filters val genreFilter = filterList.find { it is GenreFilter } as GenreFilter val url = "$baseUrl/category/${genreFilter.toUriPart()}/page/$page" - GET(url.toString(), headers) + GET(url, headers) } } @@ -75,8 +75,8 @@ abstract class BakaManga( // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val info = document.selectFirst(".box_info") - title = info.selectFirst("h1").text() + val info = document.selectFirst(".box_info")!! + title = info.selectFirst("h1")!!.text() artist = info.select(".info-item:contains(Artist:) > a").joinToString { it.text() } val descElements = info.select(".story-detail-info:matchText") @@ -99,12 +99,12 @@ abstract class BakaManga( } genre = info.select(".post-categories > li > a").joinToString { it.text() } - status = info.selectFirst(".info-item:contains(Status:)").text() + status = info.selectFirst(".info-item:contains(Status:)")!!.text() .removePrefix("Status:") .trim() .toStatus() - thumbnail_url = info.selectFirst(".box_info img").absUrl("src") + thumbnail_url = info.selectFirst(".box_info img")!!.absUrl("src") } // Chapters @@ -115,14 +115,14 @@ abstract class BakaManga( ".list-chapters > .list-chapters > .box_list > .chapter-item" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - setUrlWithoutDomain(element.selectFirst("a").absUrl("href")) - name = element.selectFirst(".chap_name").text() + setUrlWithoutDomain(element.selectFirst("a")!!.absUrl("href")) + name = element.selectFirst(".chap_name")!!.text() chapter_number = name .substringAfter(' ') .substringBefore(' ') .toFloatOrNull() ?: -1f - date_upload = parseRelativeDate(element.selectFirst(".chap_update").text()) + date_upload = parseRelativeDate(element.selectFirst(".chap_update")!!.text()) } private fun parseRelativeDate(date: String): Long { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/ComicGamma.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/ComicGamma.kt index aa099486a..9cd51ba20 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/ComicGamma.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/comicgamma/ComicGamma.kt @@ -28,16 +28,16 @@ open class ComicGamma( override fun popularMangaNextPageSelector(): String? = null override fun popularMangaSelector() = ".tab_panel.active .manga_item" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - url = element.selectFirst(Evaluator.Tag("a")).attr("href") - title = element.selectFirst(Evaluator.Class("manga_title")).text() - author = element.selectFirst(Evaluator.Class("manga_author")).text() + url = element.selectFirst(Evaluator.Tag("a"))!!.attr("href") + title = element.selectFirst(Evaluator.Class("manga_title"))!!.text() + author = element.selectFirst(Evaluator.Class("manga_author"))!!.text() val genreList = element.select(Evaluator.Tag("li")).map { it.text() } genre = genreList.joinToString() status = when { genreList.contains("完結") && !genreList.contains("リピート配信") -> SManga.COMPLETED else -> SManga.ONGOING } - thumbnail_url = element.selectFirst(Evaluator.Tag("img")).absUrl("src") + thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.absUrl("src") } override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException("Not used.") @@ -60,7 +60,7 @@ open class ComicGamma( } override fun mangaDetailsParse(document: Document): SManga { - val titleElement = document.selectFirst(Evaluator.Class("manga__title")) + val titleElement = document.selectFirst(Evaluator.Class("manga__title"))!! val titleName = titleElement.child(0).text() val desc = document.selectFirst(".detail__item > p:not(:empty)")?.run { select(Evaluator.Tag("br")).prepend("\\n") @@ -81,7 +81,7 @@ open class ComicGamma( override fun chapterFromElement(element: Element) = SChapter.create().apply { url = element.attr("href").toOldChapterUrl() val number = url.removeSuffix("/").substringAfterLast('/').replace('_', '.') - val list = element.selectFirst(Evaluator.Class("read__contents")).children() + val list = element.selectFirst(Evaluator.Class("read__contents"))!!.children() name = "[$number] ${list[0].text()}" if (list.size >= 3) { date_upload = dateFormat.parseJST(list[2].text())?.time ?: 0L @@ -98,7 +98,7 @@ open class ComicGamma( time += 12 * 3600 * 1000 // updates at 12 noon } - internal fun getJSTFormat(datePattern: String) = + private fun getJSTFormat(datePattern: String) = SimpleDateFormat(datePattern, Locale.JAPANESE).apply { timeZone = TimeZone.getTimeZone("GMT+09:00") } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/eromuse/EroMuse.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/eromuse/EroMuse.kt index d5a697d8f..c2d6eaeb2 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/eromuse/EroMuse.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/eromuse/EroMuse.kt @@ -92,7 +92,7 @@ open class EroMuse(override val name: String, override val baseUrl: String) : Ht protected fun parseManga(document: Document): MangasPage { fun internalParse(internalDocument: Document): List { val authorDocument = if (stackItem.pageType == VARIOUS_AUTHORS) { - internalDocument.select(albumSelector)?.let { + internalDocument.select(albumSelector).let { elements -> elements.reversed().map { pageStack.addLast(StackItem(it.attr("abs:href"), AUTHOR)) } } @@ -107,7 +107,7 @@ open class EroMuse(override val name: String, override val baseUrl: String) : Ht if (stackItem.pageType in listOf(VARIOUS_AUTHORS, SEARCH_RESULTS_OR_BASE)) document.addNextPageToStack() val mangas = when (stackItem.pageType) { VARIOUS_AUTHORS -> { - document.select(albumSelector)?.let { + document.select(albumSelector).let { elements -> elements.reversed().map { pageStack.addLast(StackItem(it.attr("abs:href"), AUTHOR)) } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt index c2daf84fe..3873d626f 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/fmreader/FMReader.kt @@ -109,7 +109,7 @@ abstract class FMReader( val mangas = document.select(popularMangaSelector()).map { popularMangaFromElement(it) } // check if there's a next page - val hasNextPage = (document.select(popularMangaNextPageSelector())?.first()?.text() ?: "").let { + val hasNextPage = (document.select(popularMangaNextPageSelector()).first()?.text() ?: "").let { if (it.contains(Regex("""\w*\s\d*\s\w*\s\d*"""))) { it.split(" ").let { pageOf -> pageOf[1] != pageOf[3] } // current page not last page } else { @@ -134,7 +134,7 @@ abstract class FMReader( override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select("$headerSelector").let { + element.select(headerSelector).let { setUrlWithoutDomain(it.attr("abs:href")) title = it.text() } @@ -158,7 +158,7 @@ abstract class FMReader( override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.row").first() + val infoElement = document.select("div.row").first()!! return SManga.create().apply { author = infoElement.select("li a.btn-info").eachText().filter { @@ -227,7 +227,7 @@ abstract class FMReader( open fun chapterFromElement(element: Element, mangaTitle: String = ""): SChapter { return SChapter.create().apply { if (chapterUrlSelector != "") { - element.select(chapterUrlSelector).first().let { + element.select(chapterUrlSelector).first()!!.let { setUrlWithoutDomain(it.attr("abs:href")) name = it.text().substringAfter("$mangaTitle ") } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/foolslide/FoolSlide.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/foolslide/FoolSlide.kt index 42900dc8e..e64a3b36a 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/foolslide/FoolSlide.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/foolslide/FoolSlide.kt @@ -65,7 +65,7 @@ abstract class FoolSlide( } override fun popularMangaFromElement(element: Element) = SManga.create().apply { - element.select("a[title]").first().let { + element.select("a[title]").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -75,7 +75,7 @@ abstract class FoolSlide( } override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { - element.select("a[title]").first().let { + element.select("a[title]").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -95,7 +95,7 @@ abstract class FoolSlide( override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a[title]").first().let { + element.select("a[title]").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -111,7 +111,7 @@ abstract class FoolSlide( // if there's no image on the details page, get the first page of the first chapter protected fun getDetailsThumbnail(document: Document, urlSelector: String = chapterUrlSelector): String? { return document.select("div.thumbnail img, table.thumb img").firstOrNull()?.attr("abs:src") - ?: document.select(chapterListSelector()).last().select(urlSelector).attr("abs:href") + ?: document.select(chapterListSelector()).last()!!.select(urlSelector).attr("abs:href") .let { url -> client.newCall(allowAdult(GET(url))).execute() } .let { response -> pageListParse(response).first().imageUrl } } @@ -142,13 +142,11 @@ abstract class FoolSlide( protected open val chapterUrlSelector = "a[title]" override fun chapterFromElement(element: Element) = SChapter.create().apply { - val urlElement = element.select(chapterUrlSelector).first() - val dateElement = element.select(chapterDateSelector).first() + val urlElement = element.select(chapterUrlSelector).first()!! + val dateElement = element.select(chapterDateSelector).first()!! setUrlWithoutDomain(urlElement.attr("href")) name = urlElement.text() - date_upload = dateElement.text()?.let { - parseChapterDate(it.substringAfter(", ")) - } ?: 0 + date_upload = parseChapterDate(dateElement.text().substringAfter(", ")) ?: 0 } protected open fun parseChapterDate(date: String): Long? { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt index 5aecab17a..e64f4cac6 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt @@ -105,11 +105,11 @@ abstract class Gattsu( override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { name = "Capítulo único" scanlator = element.select("ul.post-itens li:contains(Tradutor) a").firstOrNull()?.text() - date_upload = element.ownerDocument().select("meta[property=article:published_time]").firstOrNull() + date_upload = element.ownerDocument()!!.select("meta[property=article:published_time]").firstOrNull() ?.attr("content") .orEmpty() .toDate() - setUrlWithoutDomain(element.ownerDocument().location()) + setUrlWithoutDomain(element.ownerDocument()!!.location()) } protected open fun pageListSelector(): String = diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt index 11373aaca..e0acc9e7c 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt @@ -63,11 +63,11 @@ open class Genkan( override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a.list-title").first().let { + element.select("a.list-title").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } - manga.thumbnail_url = styleToUrl(element.select("a.media-content").first()) + manga.thumbnail_url = styleToUrl(element.select("a.media-content").first()!!) return manga } @@ -98,9 +98,9 @@ open class Genkan( protected var countryOfOriginSelector = ".card.mt-2 .list-item:contains(Country of Origin) .no-wrap" override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.select("div#content h5").first().text() + title = document.select("div#content h5").first()!!.text() description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume") - thumbnail_url = styleToUrl(document.select("div.media a").first()) + thumbnail_url = styleToUrl(document.select("div.media a").first()!!) genre = listOfNotNull( document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text()) }, ).joinToString() @@ -119,7 +119,7 @@ open class Genkan( } else { "Ch. $chapNum: ${urlElement.text()}" } - date_upload = parseChapterDate(element.select("a.item-company").first().text()) ?: 0 + date_upload = parseChapterDate(element.select("a.item-company").first()!!.text()) ?: 0 } } @@ -166,7 +166,7 @@ open class Genkan( override fun pageListParse(document: Document): List { val pages = mutableListOf() - val allImages = document.select("div#pages-container + script").first().data() + val allImages = document.select("div#pages-container + script").first()!!.data() .substringAfter("[").substringBefore("];") .replace(Regex("""["\\]"""), "") .split(",") diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/GenkanOriginal.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/GenkanOriginal.kt index 17b3b68a9..e48b4a99f 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/GenkanOriginal.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/GenkanOriginal.kt @@ -49,7 +49,7 @@ open class GenkanOriginal( // search the given document for matches private fun getMatchesFrom(document: Document): MutableList { val searchMatches = mutableListOf() - document.select(searchMangaSelector()) + document.select(searchMangaSelector()).toList() .filter { it.text().contains(searchQuery, ignoreCase = true) } .map { searchMatches.add(searchMangaFromElement(it)) } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt index 77c83b9bd..6140f5d78 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gigaviewer/GigaViewer.kt @@ -67,8 +67,8 @@ abstract class GigaViewer( override fun popularMangaSelector(): String = "ul.series-list li a" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h2.series-list-title").text() - thumbnail_url = element.selectFirst("div.series-list-thumb img") + title = element.selectFirst("h2.series-list-title")!!.text() + thumbnail_url = element.selectFirst("div.series-list-thumb img")!! .attr("data-src") setUrlWithoutDomain(element.attr("href")) } @@ -114,9 +114,9 @@ abstract class GigaViewer( override fun searchMangaSelector() = "ul.search-series-list li, ul.series-list li" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("div.title-box p.series-title").text() - thumbnail_url = element.selectFirst("div.thmb-container a img").attr("src") - setUrlWithoutDomain(element.selectFirst("div.thmb-container a").attr("href")) + title = element.selectFirst("div.title-box p.series-title")!!.text() + thumbnail_url = element.selectFirst("div.thmb-container a img")!!.attr("src") + setUrlWithoutDomain(element.selectFirst("div.thmb-container a")!!.attr("href")) } override fun searchMangaNextPageSelector(): String? = null @@ -126,11 +126,11 @@ abstract class GigaViewer( override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { val infoElement = document.selectFirst(mangaDetailsInfoSelector())!! - title = infoElement.selectFirst("h1.series-header-title").text() - author = infoElement.selectFirst("h2.series-header-author").text() + title = infoElement.selectFirst("h1.series-header-title")!!.text() + author = infoElement.selectFirst("h2.series-header-author")!!.text() artist = author - description = infoElement.selectFirst("p.series-header-description").text() - thumbnail_url = infoElement.selectFirst("div.series-header-image-wrapper img") + description = infoElement.selectFirst("p.series-header-description")!!.text() + thumbnail_url = infoElement.selectFirst("div.series-header-image-wrapper img")!! .attr("data-src") } @@ -183,10 +183,10 @@ abstract class GigaViewer( override fun chapterFromElement(element: Element): SChapter { val info = element.selectFirst("a.series-episode-list-container") ?: element - val mangaUrl = element.ownerDocument().location() + val mangaUrl = element.ownerDocument()!!.location() return SChapter.create().apply { - name = info.selectFirst("h4.series-episode-list-title").text() + name = info.selectFirst("h4.series-episode-list-title")!!.text() if (chapterListMode == CHAPTER_LIST_PAID && element.selectFirst("span.series-episode-list-is-free") == null) { name = YEN_BANKNOTE + name } else if (chapterListMode == CHAPTER_LIST_LOCKED && element.hasClass("private")) { @@ -201,7 +201,7 @@ abstract class GigaViewer( } override fun pageListParse(document: Document): List { - val episode = document.selectFirst("script#episode-json") + val episode = document.selectFirst("script#episode-json")!! .attr("data-value") .let { try { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt index b0029aaa7..7ef28c343 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt @@ -74,7 +74,7 @@ abstract class GroupLe( override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() manga.thumbnail_url = element.select("img.lazy").first()?.attr("data-original")?.replace("_p.", ".") - element.select("h3 > a").first().let { + element.select("h3 > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.attr("title") } @@ -103,11 +103,9 @@ abstract class GroupLe( } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select(".expandable").first() + val infoElement = document.select(".expandable").first()!! val rawCategory = infoElement.select("span.elem_category").text() - val category = if (rawCategory.isNotEmpty()) { - rawCategory - } else { + val category = rawCategory.ifEmpty { "манга" } @@ -187,8 +185,8 @@ abstract class GroupLe( override fun chapterListSelector() = "div.chapters-link > table > tbody > tr:has(td > a):has(td.date:not(.text-info))" private fun chapterFromElement(element: Element, manga: SManga): SChapter { - val urlElement = element.select("a.chapter-link").first() - val chapterInf = element.select("td.item-title").first() + val urlElement = element.select("a.chapter-link").first()!! + val chapterInf = element.select("td.item-title").first()!! val urlText = urlElement.text() val chapter = SChapter.create() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt index 09fcbad4a..0585c1f06 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/kemono/Kemono.kt @@ -55,10 +55,10 @@ open class Kemono( override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() - val cardList = document.selectFirst(Evaluator.Class("card-list")) + val cardList = document.selectFirst(Evaluator.Class("card-list"))!! val creators = cardList.select(Evaluator.Tag("article")).map { val children = it.children() - val avatar = children[0].selectFirst(Evaluator.Tag("img")).attr("src") + val avatar = children[0].selectFirst(Evaluator.Tag("img"))!!.attr("src") val link = children[1].child(0) val service = children[2].ownText() SManga.create().apply { @@ -100,13 +100,13 @@ open class Kemono( val baseUrl = baseUrl return if (page == 1) { val document = client.newCall(GET(baseUrl + path, headers)).execute().asJsoup() - val cardList = document.selectFirst(Evaluator.Class("card-list__items")) + val cardList = document.selectFirst(Evaluator.Class("card-list__items"))!! val creators = cardList.children().map { SManga.create().apply { url = it.attr("href") - title = it.selectFirst(Evaluator.Class("user-card__name")).ownText() - author = it.selectFirst(Evaluator.Class("user-card__service")).ownText() - thumbnail_url = baseUrl + it.selectFirst(Evaluator.Tag("img")).attr("src") + title = it.selectFirst(Evaluator.Class("user-card__name"))!!.ownText() + author = it.selectFirst(Evaluator.Class("user-card__service"))!!.ownText() + thumbnail_url = baseUrl + it.selectFirst(Evaluator.Tag("img"))!!.attr("src") description = PROMPT initialized = true } @@ -227,7 +227,7 @@ open class Kemono( private const val POST_PAGES_MAX = 50 private fun Element.hasNextPage(): Boolean { - val pagination = selectFirst(Evaluator.Class("paginator")) + val pagination = selectFirst(Evaluator.Class("paginator"))!! return pagination.selectFirst("a[title=Next page]") != null } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt index 40e0d1712..42f5cd66b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/libgroup/LibGroup.kt @@ -207,7 +207,7 @@ abstract class LibGroup( val manga = SManga.create() - val body = document.select("div.media-info-list").first() + val body = document.select("div.media-info-list").first()!! val rawCategory = document.select(".media-short-info a.media-short-info__item").text() val category = when { rawCategory == "Комикс западный" -> "Комикс" @@ -217,8 +217,8 @@ abstract class LibGroup( val rawAgeStop = document.select(".media-short-info .media-short-info__item[data-caution]").text() - val ratingValue = document.select(".media-rating__value").last().text().toFloat() * 2 - val ratingVotes = document.select(".media-rating__votes").last().text() + val ratingValue = document.select(".media-rating__value").last()!!.text().toFloat() * 2 + val ratingVotes = document.select(".media-rating__votes").last()!!.text() val ratingStar = when { ratingValue > 9.5 -> "★★★★★" ratingValue > 8.5 -> "★★★★✬" @@ -242,19 +242,19 @@ abstract class LibGroup( manga.author = body.select("div.media-info-list__title:contains(Автор) + div a").joinToString { it.text() } manga.artist = body.select("div.media-info-list__title:contains(Художник) + div a").joinToString { it.text() } - val StatusTranslate = body.select("div.media-info-list__title:contains(Статус перевода) + div").text().lowercase(Locale.ROOT) - val StatusTitle = body.select("div.media-info-list__title:contains(Статус тайтла) + div").text().lowercase(Locale.ROOT) + val statusTranslate = body.select("div.media-info-list__title:contains(Статус перевода) + div").text().lowercase(Locale.ROOT) + val statusTitle = body.select("div.media-info-list__title:contains(Статус тайтла) + div").text().lowercase(Locale.ROOT) manga.status = if (document.html().contains("paper empty section") ) { SManga.LICENSED } else { when { - StatusTranslate.contains("завершен") && StatusTitle.contains("приостановлен") || StatusTranslate.contains("заморожен") || StatusTranslate.contains("заброшен") -> SManga.ON_HIATUS - StatusTranslate.contains("завершен") && StatusTitle.contains("выпуск прекращён") -> SManga.CANCELLED - StatusTranslate.contains("продолжается") -> SManga.ONGOING - StatusTranslate.contains("завершен") -> SManga.COMPLETED - else -> when (StatusTitle) { + statusTranslate.contains("завершен") && statusTitle.contains("приостановлен") || statusTranslate.contains("заморожен") || statusTranslate.contains("заброшен") -> SManga.ON_HIATUS + statusTranslate.contains("завершен") && statusTitle.contains("выпуск прекращён") -> SManga.CANCELLED + statusTranslate.contains("продолжается") -> SManga.ONGOING + statusTranslate.contains("завершен") -> SManga.COMPLETED + else -> when (statusTitle) { "онгоинг" -> SManga.ONGOING "анонс" -> SManga.ONGOING "завершён" -> SManga.COMPLETED @@ -445,7 +445,7 @@ abstract class LibGroup( val chapInfo = document .select("script:containsData(window.__info)") - .first() + .first()!! .html() .split("window.__info = ") .last() @@ -468,7 +468,7 @@ abstract class LibGroup( // Get pages val pagesArr = document .select("script:containsData(window.__pg)") - .first() + .first()!! .html() .trim() .removePrefix("window.__pg = ") diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt index a81b564dd..4d81c1ff0 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt @@ -1156,8 +1156,8 @@ abstract class Madara( .orEmpty() .map { li -> Genre( - li.selectFirst("label").text(), - li.selectFirst("input[type=checkbox]").`val`(), + li.selectFirst("label")!!.text(), + li.selectFirst("input[type=checkbox]")!!.`val`(), ) } } @@ -1196,7 +1196,7 @@ abstract class Madara( setOnPreferenceChangeListener { _, newValue -> val customUa = newValue as String preferences.edit().putString(PREF_KEY_CUSTOM_UA, customUa).apply() - if (customUa.isNullOrBlank()) { + if (customUa.isBlank()) { Toast.makeText(screen.context, RESTART_APP_STRING, Toast.LENGTH_LONG).show() } else { userAgent = null diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt index 916d54a87..4a3945260 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madtheme/MadTheme.kt @@ -176,7 +176,7 @@ abstract class MadTheme( } // Try to show message/error from site - response.body?.let { body -> + response.body.let { body -> json.decodeFromString(body.string())["message"] ?.jsonPrimitive ?.content @@ -200,7 +200,7 @@ abstract class MadTheme( override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { // Not using setUrlWithoutDomain() to support external chapters - url = element.selectFirst("a") + url = element.selectFirst("a")!! .absUrl("href") .removePrefix(baseUrl) @@ -211,7 +211,7 @@ abstract class MadTheme( // Pages override fun pageListParse(document: Document): List { - val html = document.html()!! + val html = document.html() if (!html.contains("var mainServer = \"")) { // No fancy CDN, all images are available directly in tags diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabox/MangaBox.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabox/MangaBox.kt index 8b4d4c770..0c32d2e1f 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabox/MangaBox.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabox/MangaBox.kt @@ -60,11 +60,11 @@ abstract class MangaBox( protected fun mangaFromElement(element: Element, urlSelector: String = "h3 a"): SManga { return SManga.create().apply { - element.select(urlSelector).first().let { + element.select(urlSelector).first()!!.let { url = it.attr("abs:href").substringAfter(baseUrl) // intentionally not using setUrlWithoutDomain title = it.text() } - thumbnail_url = element.select("img").first().attr("abs:src") + thumbnail_url = element.select("img").first()!!.attr("abs:src") } } @@ -145,14 +145,14 @@ abstract class MangaBox( override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { document.select(mangaDetailsMainSelector).firstOrNull()?.let { infoElement -> - title = infoElement.select("h1, h2").first().text() + title = infoElement.select("h1, h2").first()!!.text() author = infoElement.select("li:contains(author) a, td:containsOwn(author) + td a").eachText().joinToString() status = parseStatus(infoElement.select("li:contains(status), td:containsOwn(status) + td").text()) genre = infoElement.select("div.manga-info-top li:contains(genres)").firstOrNull() ?.select("a")?.joinToString { it.text() } // kakalot ?: infoElement.select("td:containsOwn(genres) + td a").joinToString { it.text() } // nelo } ?: checkForRedirectMessage(document) - description = document.select(descriptionSelector)?.firstOrNull()?.ownText() + description = document.select(descriptionSelector).firstOrNull()?.ownText() ?.replace("""^$title summary:\s""".toRegex(), "") ?.replace("""<\s*br\s*/?>""".toRegex(), "\n") ?.replace("<[^>]*>".toRegex(), "") @@ -201,7 +201,7 @@ abstract class MangaBox( private fun Element.selectDateFromElement(): Element { val defaultChapterDateSelector = "span" - return this.select(defaultChapterDateSelector).lastOrNull() ?: this.select(alternateChapterDateSelector).last() + return this.select(defaultChapterDateSelector).lastOrNull() ?: this.select(alternateChapterDateSelector).last()!! } override fun chapterFromElement(element: Element): SChapter { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabz/MangabzTheme.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabz/MangabzTheme.kt index d030a8d2d..e6dc71392 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabz/MangabzTheme.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangabz/MangabzTheme.kt @@ -46,27 +46,27 @@ abstract class MangabzTheme( override fun searchMangaParse(response: Response): MangasPage { val document = response.asJsoup().also(::parseFilters) - val mangas = document.selectFirst(Evaluator.Class("mh-list")).children().map { element -> + val mangas = document.selectFirst(Evaluator.Class("mh-list"))!!.children().map { element -> SManga.create().apply { - title = element.selectFirst(Evaluator.Tag("h2")).text() - url = element.selectFirst(Evaluator.Tag("a")).attr("href") - thumbnail_url = element.selectFirst(Evaluator.Tag("img")).attr("src") + title = element.selectFirst(Evaluator.Tag("h2"))!!.text() + url = element.selectFirst(Evaluator.Tag("a"))!!.attr("href") + thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.attr("src") } } val hasNextPage = document.run { val pagination = selectFirst(Evaluator.Class("page-pagination")) - pagination != null && pagination.select(Evaluator.Tag("a")).last().text() == ">" + pagination != null && pagination.select(Evaluator.Tag("a")).last()!!.text() == ">" } return MangasPage(mangas, hasNextPage) } override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() - val details = document.selectFirst(Evaluator.Class("detail-info-tip")).children()!! + val details = document.selectFirst(Evaluator.Class("detail-info-tip"))!!.children() return SManga.create().apply { url = document.location().removePrefix(baseUrl) - title = document.selectFirst(Evaluator.Class("detail-info-title")).ownText() - thumbnail_url = document.selectFirst(Evaluator.Class("detail-info-cover")).attr("src") + title = document.selectFirst(Evaluator.Class("detail-info-title"))!!.ownText() + thumbnail_url = document.selectFirst(Evaluator.Class("detail-info-cover"))!!.attr("src") status = when (details[1].child(0).ownText()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED @@ -76,7 +76,7 @@ abstract class MangabzTheme( } author = details[0].children().joinToString { it.ownText() } genre = details[2].children().joinToString { it.ownText() } - description = parseDescription(document.selectFirst(Evaluator.Class("detail-info-content")), title, details) + description = parseDescription(document.selectFirst(Evaluator.Class("detail-info-content"))!!, title, details) initialized = true } } @@ -103,7 +103,7 @@ abstract class MangabzTheme( } if (list.isEmpty()) return emptyList() - val listTitle = document.selectFirst(Evaluator.Class("detail-list-form-title")).ownText() + val listTitle = document.selectFirst(Evaluator.Class("detail-list-form-title"))!!.ownText() try { list[0].date_upload = parseDate(listTitle) } catch (e: Throwable) { @@ -113,7 +113,7 @@ abstract class MangabzTheme( } protected open fun getChapterElements(document: Document): Elements = - document.selectFirst(Evaluator.Id("chapterlistload")).children() + document.selectFirst(Evaluator.Id("chapterlistload"))!!.children() protected open val needPageCount = true diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt index 264095d37..7a8654adf 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt @@ -171,14 +171,14 @@ abstract class MangaHub( override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() manga.title = document.select(".breadcrumb .active span").text() - manga.author = document.select("div:has(h1) span:contains(Author) + span")?.first()?.text() - manga.artist = document.select("div:has(h1) span:contains(Artist) + span")?.first()?.text() - manga.genre = document.select(".row p a")?.joinToString { it.text() } - manga.description = document.select(".tab-content p")?.first()?.text() - manga.thumbnail_url = document.select("img.img-responsive")?.first() + manga.author = document.select("div:has(h1) span:contains(Author) + span").first()?.text() + manga.artist = document.select("div:has(h1) span:contains(Artist) + span").first()?.text() + manga.genre = document.select(".row p a").joinToString { it.text() } + manga.description = document.select(".tab-content p").first()?.text() + manga.thumbnail_url = document.select("img.img-responsive").first() ?.attr("src") - document.select("div:has(h1) span:contains(Status) + span")?.first()?.text()?.also { statusText -> + document.select("div:has(h1) span:contains(Status) + span").first()?.text()?.also { statusText -> when { statusText.contains("ongoing", true) -> manga.status = SManga.ONGOING statusText.contains("completed", true) -> manga.status = SManga.COMPLETED diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt index aabb5ddc3..59a48a5a7 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt @@ -78,7 +78,7 @@ abstract class MangaMainac( override fun chapterListSelector() = "table.chap_tab tr" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = element.select("a").text() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawTheme.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawTheme.kt index c7e89dc4d..bf463a527 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawTheme.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawTheme.kt @@ -22,8 +22,8 @@ abstract class MangaRawTheme( protected abstract fun String.sanitizeTitle(): String override fun popularMangaFromElement(element: Element) = SManga.create().apply { - setUrlWithoutDomain(element.selectFirst(Evaluator.Tag("a")).attr("href")) - title = element.selectFirst(Evaluator.Tag("h3")).text().sanitizeTitle() + setUrlWithoutDomain(element.selectFirst(Evaluator.Tag("a"))!!.attr("href")) + title = element.selectFirst(Evaluator.Tag("h3"))!!.text().sanitizeTitle() thumbnail_url = element.selectFirst(Evaluator.Tag("img"))?.absUrl("data-src") } @@ -69,7 +69,7 @@ abstract class MangaRawTheme( override fun pageListParse(document: Document): List { val imgSelector = Evaluator.Tag("img") return document.select(pageSelector()).mapIndexed { index, element -> - Page(index, imageUrl = element.selectFirst(imgSelector).attr("data-src")) + Page(index, imageUrl = element.selectFirst(imgSelector)!!.attr("data-src")) } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt index 985748e68..5841e34b3 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt @@ -226,7 +226,7 @@ abstract class MangaThemesia( override fun chapterFromElement(element: Element) = SChapter.create().apply { val urlElements = element.select("a") setUrlWithoutDomain(urlElements.attr("href")) - name = element.select(".lch a, .chapternum").text().ifBlank { urlElements.first().text() } + name = element.select(".lch a, .chapternum").text().ifBlank { urlElements.first()!!.text() } date_upload = element.selectFirst(".chapterdate")?.text().parseChapterDate() } @@ -452,8 +452,8 @@ abstract class MangaThemesia( private fun parseGenres(document: Document): List? { return document.selectFirst("ul.genrez")?.select("li")?.map { li -> Genre( - li.selectFirst("label").text(), - li.selectFirst("input[type=checkbox]").attr("value"), + li.selectFirst("label")!!.text(), + li.selectFirst("input[type=checkbox]")!!.attr("value"), ) } } @@ -464,7 +464,7 @@ abstract class MangaThemesia( else -> attr("abs:src") } - protected open fun Elements.imgAttr(): String = this.first().imgAttr() + protected open fun Elements.imgAttr(): String = this.first()!!.imgAttr() // Unused override fun popularMangaSelector(): String = throw UnsupportedOperationException("Not used") diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaworld/MangaWorld.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaworld/MangaWorld.kt index 8bb5a1528..c74f0733d 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaworld/MangaWorld.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaworld/MangaWorld.kt @@ -51,7 +51,7 @@ abstract class MangaWorld( override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() manga.thumbnail_url = element.select("a.thumb img").attr("src") - element.select("a").first().let { + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href").removeSuffix("/")) manga.title = it.attr("title") } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSNsfw.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSNsfw.kt index 38af58b16..f5494e607 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSNsfw.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSNsfw.kt @@ -28,7 +28,7 @@ open class MCCMSNsfw( GET(baseUrl + chapter.url, headers) override fun pageListParse(response: Response): List { - val container = response.asJsoup().selectFirst(Evaluator.Class("comic-list")) + val container = response.asJsoup().selectFirst(Evaluator.Class("comic-list"))!! return container.select(Evaluator.Tag("img")).mapIndexed { index, img -> Page(index, imageUrl = img.attr("src")) } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSWeb.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSWeb.kt index 31f9d3ae9..c0c7d3483 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSWeb.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mccms/MCCMSWeb.kt @@ -24,14 +24,14 @@ open class MCCMSWeb( fun parseListing(document: Document): MangasPage { val mangas = document.select(Evaluator.Class("common-comic-item")).map { SManga.create().apply { - val titleElement = it.selectFirst(Evaluator.Class("comic__title")).child(0) + val titleElement = it.selectFirst(Evaluator.Class("comic__title"))!!.child(0) url = titleElement.attr("href") title = titleElement.ownText() - thumbnail_url = it.selectFirst(Evaluator.Tag("img")).attr("data-original") + thumbnail_url = it.selectFirst(Evaluator.Tag("img"))!!.attr("data-original") }.cleanup() } val hasNextPage = run { // default pagination - val buttons = document.selectFirst(Evaluator.Id("Pagination")).select(Evaluator.Tag("a")) + val buttons = document.selectFirst(Evaluator.Id("Pagination"))!!.select(Evaluator.Tag("a")) val count = buttons.size // Next page != Last page buttons[count - 1].attr("href") != buttons[count - 2].attr("href") @@ -85,12 +85,12 @@ open class MCCMSWeb( if (manga.url == "/index.php/search") return Observable.just(manga) return client.newCall(GET(baseUrl + manga.url, pcHeaders)).asObservableSuccess().map { response -> SManga.create().apply { - val document = response.asJsoup().selectFirst(Evaluator.Class("de-info__box")) - title = document.selectFirst(Evaluator.Class("comic-title")).ownText() - thumbnail_url = document.selectFirst(Evaluator.Tag("img")).attr("src") - author = document.selectFirst(Evaluator.Class("name")).text() - genre = document.selectFirst(Evaluator.Class("comic-status")).select(Evaluator.Tag("a")).joinToString { it.ownText() } - description = document.selectFirst(Evaluator.Class("intro-total")).text() + val document = response.asJsoup().selectFirst(Evaluator.Class("de-info__box"))!! + title = document.selectFirst(Evaluator.Class("comic-title"))!!.ownText() + thumbnail_url = document.selectFirst(Evaluator.Tag("img"))!!.attr("src") + author = document.selectFirst(Evaluator.Class("name"))!!.text() + genre = document.selectFirst(Evaluator.Class("comic-status"))!!.select(Evaluator.Tag("a")).joinToString { it.ownText() } + description = document.selectFirst(Evaluator.Class("intro-total"))!!.text() }.cleanup() } } @@ -98,7 +98,7 @@ open class MCCMSWeb( override fun fetchChapterList(manga: SManga): Observable> { if (manga.url == "/index.php/search") return Observable.just(emptyList()) return client.newCall(GET(baseUrl + manga.url, pcHeaders)).asObservableSuccess().map { response -> - response.asJsoup().selectFirst(Evaluator.Class("chapter__list-box")).children().map { + response.asJsoup().selectFirst(Evaluator.Class("chapter__list-box"))!!.children().map { val link = it.child(0) SChapter.create().apply { url = link.attr("href") diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDB.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDB.kt index a16abce4c..b3592301d 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDB.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDB.kt @@ -35,10 +35,10 @@ abstract class MDB( override fun popularMangaRequest(page: Int) = GET(listUrl("page-$page"), headers) override fun popularMangaSelector() = "div.comic-main-section > div.comic-book-unit" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - val link = element.selectFirst("h2 > a") + val link = element.selectFirst("h2 > a")!! setUrlWithoutDomain(link.attr("href")) title = link.text() - thumbnail_url = element.selectFirst(Evaluator.Tag("img")).absUrl("src") + thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.absUrl("src") } override fun popularMangaParse(response: Response): MangasPage { @@ -71,22 +71,22 @@ abstract class MDB( protected open fun transformDescription(description: String) = description override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.selectFirst(Evaluator.Tag("h1")).text().let { transformTitle(it) } - author = document.selectFirst(authorSelector).text() - description = document.selectFirst("p.comic_story").text().let { transformDescription(it) } + title = transformTitle(document.selectFirst(Evaluator.Tag("h1"))!!.text()) + author = document.selectFirst(authorSelector)!!.text() + description = transformDescription(document.selectFirst("p.comic_story")!!.text()) genre = parseGenre(document).joinToString(", ") - status = when (document.selectFirst("a.comic-pub-state").text()) { + status = when (document.selectFirst("a.comic-pub-state")!!.text()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED else -> SManga.UNKNOWN } - thumbnail_url = document.selectFirst("td.comic-cover > img").absUrl("src") + thumbnail_url = document.selectFirst("td.comic-cover > img")!!.absUrl("src") } protected open fun parseGenre(document: Document): List { val list = mutableListOf() - list.add(document.selectFirst("th:contains(地区) + td").text()) - list.add(document.selectFirst("th:contains(面向读者) + td").text().removeSuffix("漫画")) + list.add(document.selectFirst("th:contains(地区) + td")!!.text()) + list.add(document.selectFirst("th:contains(面向读者) + td")!!.text().removeSuffix("漫画")) val tags = document.select("ul.tags > li > a") for (i in 1 until tags.size) { // skip status list.add(tags[i].text()) @@ -101,12 +101,12 @@ abstract class MDB( } override fun pageListParse(document: Document): List { - val imgData = document.selectFirst("body > script:containsData(img_data)").data() + val imgData = document.selectFirst("body > script:containsData(img_data)")!!.data() .substringAfter("img_data = ").run { val endIndex = indexOf(this[0], startIndex = 1) // find end quote substring(1, endIndex) } - val readerConfig = document.selectFirst(Evaluator.Class("vg-r-data")) + val readerConfig = document.selectFirst(Evaluator.Class("vg-r-data"))!! return parseImages(imgData, readerConfig).mapIndexed { i, it -> Page(i, imageUrl = it) } @@ -143,7 +143,7 @@ abstract class MDB( values.add(link.text()) params.add(link.attr("href").let(::extractParams).let(::parseParam)) } - val name = children[0].selectFirst(Evaluator.Tag("span")).text() + val name = children[0].selectFirst(Evaluator.Tag("span"))!!.text() list.add(Category(name, values.toTypedArray(), params)) } else if (filterContainer.hasClass("form-row")) { // Dropdown filter for (select in filterContainer.select(Evaluator.Tag("select"))) { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/MMRCMS.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/MMRCMS.kt index 901820c9d..051108090 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/MMRCMS.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/MMRCMS.kt @@ -134,7 +134,7 @@ abstract class MMRCMS( return client.newCall(GET("$baseUrl/changeMangaList?type=text", headers)) .asObservableSuccess() .map { response -> - val mangas = response.asJsoup().select("ul.manga-list a") + val mangas = response.asJsoup().select("ul.manga-list a").toList() .filter { it.text().contains(query, ignoreCase = true) } .map { SManga.create().apply { @@ -198,7 +198,7 @@ abstract class MMRCMS( private fun latestUpdatesSelector() = "div.mangalist div.manga-item" private fun latestUpdatesNextPageSelector() = "a[rel=next]" protected open fun latestUpdatesFromElement(element: Element, urlSelector: String): SManga? { - return element.select(urlSelector).first().let { titleElement -> + return element.select(urlSelector).first()!!.let { titleElement -> if (titleElement.text() in latestTitles) { null } else { @@ -305,12 +305,12 @@ abstract class MMRCMS( for (element in document.select(".row .dl-horizontal dt")) { when (element.text().trim().lowercase().removeSuffix(":")) { - in detailAuthor -> author = element.nextElementSibling().text() - in detailArtist -> artist = element.nextElementSibling().text() - in detailGenre -> genre = element.nextElementSibling().select("a").joinToString { + in detailAuthor -> author = element.nextElementSibling()!!.text() + in detailArtist -> artist = element.nextElementSibling()!!.text() + in detailGenre -> genre = element.nextElementSibling()!!.select("a").joinToString { it.text().trim() } - in detailStatus -> status = when (element.nextElementSibling().text().trim().lowercase()) { + in detailStatus -> status = when (element.nextElementSibling()!!.text().trim().lowercase()) { in detailStatusComplete -> SManga.COMPLETED in detailStatusOngoing -> SManga.ONGOING else -> SManga.UNKNOWN @@ -367,7 +367,7 @@ abstract class MMRCMS( val chapter = SChapter.create() try { - val titleWrapper = element.select("[class^=chapter-title-rtl]").first() + val titleWrapper = element.select("[class^=chapter-title-rtl]").first()!! // Some websites add characters after "..-rtl" thus the need of checking classes that starts with that val url = titleWrapper.getElementsByTag("a") .first { it.attr("href").contains(urlRegex) } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/multichan/MultiChan.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/multichan/MultiChan.kt index 91d82aa75..0a081ffe5 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/multichan/MultiChan.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/multichan/MultiChan.kt @@ -41,9 +41,9 @@ abstract class MultiChan( override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("src") + manga.thumbnail_url = element.select("img").first()!!.attr("src") manga.title = element.attr("title") - element.select("h2 > a").first().let { + element.select("h2 > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) } return manga @@ -72,10 +72,10 @@ abstract class MultiChan( val nextSearchPage = document.select(searchMangaNextPageSelector()) if (nextSearchPage.isNotEmpty()) { - val query = document.select("input#searchinput").first().attr("value") + val query = document.select("input#searchinput").first()!!.attr("value") val pageNum = nextSearchPage.let { selector -> val onClick = selector.attr("onclick") - onClick?.split("""\\d+""") + onClick.split("""\\d+""") } nextSearchPage.attr("href", "$baseUrl/?do=search&subaction=search&story=$query&search_start=$pageNum") hasNextPage = true @@ -91,7 +91,7 @@ abstract class MultiChan( override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select("#info_wrap tr,#info_wrap > div") - val descElement = document.select("div#description").first() + val descElement = document.select("div#description").first()!! val rawCategory = infoElement.select(":contains(Тип) a").text().lowercase() val manga = SManga.create() manga.title = document.select("title").text().substringBefore(" »") @@ -99,7 +99,7 @@ abstract class MultiChan( manga.genre = rawCategory + ", " + document.select(".sidetags ul a:last-child").joinToString { it.text() } manga.status = parseStatus(infoElement.select(":contains(Загружено)").text()) manga.description = descElement.textNodes().first().text().trim() - manga.thumbnail_url = document.select("img#cover").first().attr("src") + manga.thumbnail_url = document.select("img#cover").first()!!.attr("src") return manga } @@ -112,13 +112,13 @@ abstract class MultiChan( override fun chapterListSelector() = "table.table_cha tr:gt(1)" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = urlElement.text() chapter.chapter_number = "(глава\\s|часть\\s)([0-9]+\\.?[0-9]*)".toRegex(RegexOption.IGNORE_CASE).find(chapter.name)?.groupValues?.get(2)?.toFloat() ?: -1F - chapter.date_upload = simpleDateFormat.parse(element.select("div.date").first().text())?.time ?: 0L + chapter.date_upload = simpleDateFormat.parse(element.select("div.date").first()!!.text())?.time ?: 0L return chapter } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mymangacms/MyMangaCMS.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mymangacms/MyMangaCMS.kt index 5ed127e3f..96957469b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mymangacms/MyMangaCMS.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mymangacms/MyMangaCMS.kt @@ -86,9 +86,9 @@ abstract class MyMangaCMS( "div.pagination_wrap a.paging_item:last-of-type:not(.disabled)" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - setUrlWithoutDomain(element.select("a").first().attr("abs:href")) - title = element.select("div.thumb_attr.series-title a[title]").first().text() - thumbnail_url = element.select("div[data-bg]").first().attr("data-bg") + setUrlWithoutDomain(element.select("a").first()!!.attr("abs:href")) + title = element.select("div.thumb_attr.series-title a[title]").first()!!.text() + thumbnail_url = element.select("div[data-bg]").first()!!.attr("data-bg") } //endregion @@ -179,10 +179,10 @@ abstract class MyMangaCMS( override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { setUrlWithoutDomain( document.select(".series-name-group a") - .first() + .first()!! .attr("abs:href"), ) - title = document.select(".series-name").first().text().trim() + title = document.select(".series-name").first()!!.text().trim() var alternativeNames: String? = null document.select(".info-item").forEach { @@ -194,7 +194,7 @@ abstract class MyMangaCMS( "Tác giả:" -> author = value.joinToString(", ") { auth -> auth.text().trim() } - "Tình trạng:" -> status = when (value.first().text().lowercase().trim()) { + "Tình trạng:" -> status = when (value.first()!!.text().lowercase().trim()) { "đang tiến hành" -> SManga.ONGOING "tạm ngưng" -> SManga.ON_HIATUS "đã hoàn thành" -> SManga.COMPLETED @@ -226,7 +226,7 @@ abstract class MyMangaCMS( thumbnail_url = document .select("div.content.img-in-ratio") - .first() + .first()!! .attr("style") .let { backgroundImageRegex.find(it)?.groups?.get(1)?.value } } @@ -243,9 +243,9 @@ abstract class MyMangaCMS( private fun chapterFromElement(element: Element, scanlator: String?): SChapter = SChapter.create().apply { setUrlWithoutDomain(element.attr("abs:href")) - name = element.select("div.chapter-name").first().text() + name = element.select("div.chapter-name").first()!!.text() date_upload = dateUpdatedParser( - element.select("div.chapter-time").first().text(), + element.select("div.chapter-time").first()!!.text(), ) val match = floatingNumberRegex.find(name) @@ -262,11 +262,11 @@ abstract class MyMangaCMS( val document = response.asJsoup() val originalScanlator = document.select("div.fantrans-value a") val scanlator: String? = if (originalScanlator.isEmpty() || - originalScanlator.first().text().trim().lowercase() == "đang cập nhật" + originalScanlator.first()!!.text().trim().lowercase() == "đang cập nhật" ) { null } else { - originalScanlator.first().text().trim() + originalScanlator.first()!!.text().trim() } return document.select(chapterListSelector()).map { chapterFromElement(it, scanlator) } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt index 00b6fb95b..14cb41d8d 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/nepnep/NepNep.kt @@ -77,7 +77,7 @@ abstract class NepNep( // don't use ";" for substringBefore() ! private fun directoryFromDocument(document: Document): JsonArray { - val str = document.select("script:containsData(MainFunction)").first().data() + val str = document.select("script:containsData(MainFunction)").first()!!.data() .substringAfter("vm.Directory = ").substringBefore("vm.GetIntValue").trim() .replace(";", " ") return json.parseToJsonElement(str).jsonArray @@ -85,7 +85,7 @@ abstract class NepNep( override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() - thumbnailUrl = document.select(".SearchResult > .SearchResultCover img").first().attr("ng-src") + thumbnailUrl = document.select(".SearchResult > .SearchResultCover img").first()!!.attr("ng-src") directory = directoryFromDocument(document).sortedByDescending { it.getString("v") } return parseDirectory(1) } @@ -111,7 +111,7 @@ abstract class NepNep( private fun getThumbnailUrl(id: String): String { if (thumbnailUrl.isNullOrEmpty()) { val response = client.newCall(popularMangaRequest(1)).execute() - thumbnailUrl = response.asJsoup().select(".SearchResult > .SearchResultCover img").first().attr("ng-src") + thumbnailUrl = response.asJsoup().select(".SearchResult > .SearchResultCover img").first()!!.attr("ng-src") } return thumbnailUrl!!.replace("{{Result.i}}", id) @@ -308,7 +308,7 @@ abstract class NepNep( } override fun chapterListParse(response: Response): List { - val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first().data() + val vmChapters = response.asJsoup().select("script:containsData(MainFunction)").first()!!.data() .substringAfter("vm.Chapters = ").substringBefore(";") return json.parseToJsonElement(vmChapters).jsonArray.map { json -> val indexChapter = json.getString("Chapter")!! @@ -330,7 +330,7 @@ abstract class NepNep( val document = response.asJsoup() val script = document.selectFirst("script:containsData(MainFunction)")?.data() ?: client.newCall(GET(document.location().removeSuffix(".html"), headers)) - .execute().asJsoup().selectFirst("script:containsData(MainFunction)").data() + .execute().asJsoup().selectFirst("script:containsData(MainFunction)")!!.data() val curChapter = json.parseToJsonElement(script!!.substringAfter("vm.CurChapter = ").substringBefore(";")).jsonObject val pageTotal = curChapter.getString("Page")!!.toInt() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/otakusanctuary/OtakuSanctuary.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/otakusanctuary/OtakuSanctuary.kt index 4e2b5c2c7..906c87669 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/otakusanctuary/OtakuSanctuary.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/otakusanctuary/OtakuSanctuary.kt @@ -56,7 +56,7 @@ open class OtakuSanctuary( val page = emptyList().toMutableList() for (element in elements) { - val url = element.select("div.mdl-card__title a").first().attr("abs:href") + val url = element.select("div.mdl-card__title a").first()!!.attr("abs:href") // ignore external chapters if (url.toHttpUrl().host != baseUrl.toHttpUrl().host) { continue @@ -80,7 +80,7 @@ open class OtakuSanctuary( setUrlWithoutDomain(url) title = element.select("div.mdl-card__supporting-text a[target=_blank]").text() .replaceFirstChar { it.titlecase() } - thumbnail_url = element.select("div.container-3-4.background-contain img").first().attr("abs:src") + thumbnail_url = element.select("div.container-3-4.background-contain img").first()!!.attr("abs:src") } } return page @@ -118,7 +118,7 @@ open class OtakuSanctuary( title = document.select("h1.title.text-lg-left.text-overflow-2-line") .text() .replaceFirstChar { it.titlecase() } - author = document.select("tr:contains(Tác Giả) a.capitalize").first().text() + author = document.select("tr:contains(Tác Giả) a.capitalize").first()!!.text() .replaceFirstChar { it.titlecase() } description = document.select("div.summary p").joinToString("\n") { it.run { @@ -129,7 +129,7 @@ open class OtakuSanctuary( genre = document.select("div.genres a").joinToString { it.text() } thumbnail_url = document.select("div.container-3-4.background-contain img").attr("abs:src") - val statusString = document.select("tr:contains(Tình Trạng) td").first().text().trim() + val statusString = document.select("tr:contains(Tình Trạng) td").first()!!.text().trim() status = when (statusString) { "Ongoing" -> SManga.ONGOING "Done" -> SManga.COMPLETED @@ -155,7 +155,7 @@ open class OtakuSanctuary( else -> 0L } } else { - return kotlin.runCatching { dateFormat.parse(date)?.time }.getOrNull() ?: 0L + return runCatching { dateFormat.parse(date)?.time }.getOrNull() ?: 0L } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt index 9a12ebfd6..acd6745c5 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt @@ -44,10 +44,10 @@ abstract class SinMH( protected open val comicItemSelector = "#contList > li, li.list-comic" protected open val comicItemTitleSelector = "p > a, h3 > a" protected open fun mangaFromElement(element: Element) = SManga.create().apply { - val titleElement = element.selectFirst(comicItemTitleSelector) + val titleElement = element.selectFirst(comicItemTitleSelector)!! title = titleElement.text() setUrlWithoutDomain(titleElement.attr("href")) - val image = element.selectFirst(Evaluator.Tag("img")) + val image = element.selectFirst(Evaluator.Tag("img"))!! thumbnail_url = image.attr("src").ifEmpty { image.attr("data-src") } } @@ -102,24 +102,24 @@ abstract class SinMH( // Details override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.selectFirst(".book-title > h1").text() - val detailsList = document.selectFirst(Evaluator.Class("detail-list")) + title = document.selectFirst(".book-title > h1")!!.text() + val detailsList = document.selectFirst(Evaluator.Class("detail-list"))!! author = detailsList.select("strong:contains(作者) ~ *").text() - description = document.selectFirst(Evaluator.Id("intro-all")).text().trim() + description = document.selectFirst(Evaluator.Id("intro-all"))!!.text().trim() .removePrefix("漫画简介:").trim() .removePrefix("漫画简介:").trim() // some sources have double prefix genre = mangaDetailsParseDefaultGenre(document, detailsList) - status = when (detailsList.selectFirst("strong:contains(状态) + *").text()) { + status = when (detailsList.selectFirst("strong:contains(状态) + *")!!.text()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED else -> SManga.UNKNOWN } - thumbnail_url = document.selectFirst("div.book-cover img").attr("src") + thumbnail_url = document.selectFirst("div.book-cover img")!!.attr("src") } protected open fun mangaDetailsParseDefaultGenre(document: Document, detailsList: Element): String { - val category = detailsList.selectFirst("strong:contains(类型) + a") - val breadcrumbs = document.selectFirst("div.breadcrumb-bar").select("a[href^=/list/]") + val category = detailsList.selectFirst("strong:contains(类型) + a")!! + val breadcrumbs = document.selectFirst("div.breadcrumb-bar")!!.select("a[href^=/list/]") return buildString { append(category.text()) breadcrumbs.map(Element::text).filter(String::isNotEmpty).joinTo(this, prefix = ", ") @@ -127,23 +127,23 @@ abstract class SinMH( } protected fun mangaDetailsParseDMZJStyle(document: Document, hasBreadcrumb: Boolean) = SManga.create().apply { - val detailsDiv = document.selectFirst("div.comic_deCon") - title = detailsDiv.selectFirst(Evaluator.Tag("h1")).text() + val detailsDiv = document.selectFirst("div.comic_deCon")!! + title = detailsDiv.selectFirst(Evaluator.Tag("h1"))!!.text() val details = detailsDiv.select("> ul > li") val linkSelector = Evaluator.Tag("a") - author = details[0].selectFirst(linkSelector).text() - status = when (details[1].selectFirst(linkSelector).text()) { + author = details[0].selectFirst(linkSelector)!!.text() + status = when (details[1].selectFirst(linkSelector)!!.text()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED else -> SManga.UNKNOWN } genre = mutableListOf().apply { - add(details[2].selectFirst(linkSelector)) // 类别 + add(details[2].selectFirst(linkSelector)!!) // 类别 addAll(details[3].select(linkSelector)) // 类型 - if (hasBreadcrumb) addAll(document.selectFirst("div.mianbao").select("a[href^=/list/]")) + if (hasBreadcrumb) addAll(document.selectFirst("div.mianbao")!!.select("a[href^=/list/]")) }.mapTo(mutableSetOf()) { it.text() }.joinToString(", ") - description = detailsDiv.selectFirst("> p.comic_deCon_d").text() - thumbnail_url = document.selectFirst("div.comic_i_img > img").attr("src") + description = detailsDiv.selectFirst("> p.comic_deCon_d")!!.text() + thumbnail_url = document.selectFirst("div.comic_i_img > img")!!.attr("src") } // Chapters @@ -167,7 +167,7 @@ abstract class SinMH( section.select(itemSelector).map { chapterFromElement(it) }.sortedDescending() } if (isNewDateLogic && list.isNotEmpty()) { - val date = document.selectFirst(dateSelector).textNodes().last().text() + val date = document.selectFirst(dateSelector)!!.textNodes().last().text() list[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L } return list @@ -194,7 +194,7 @@ abstract class SinMH( // baseUrl/js/common.js/getChapterImage() override fun pageListParse(document: Document): List { - val script = document.selectFirst("body > script").html().let(::ProgressiveParser) + val script = document.selectFirst("body > script")!!.html().let(::ProgressiveParser) val images = script.substringBetween("chapterImages = ", ";") if (images.length <= 2) return emptyList() // [] or "" val path = script.substringBetween("chapterPath = \"", "\";") @@ -237,8 +237,8 @@ abstract class SinMH( if (categories.isNotEmpty()) return val labelSelector = Evaluator.Tag("label") val linkSelector = Evaluator.Tag("a") - categories = document.selectFirst(Evaluator.Class("filter-nav")).children().map { element -> - val name = element.selectFirst(labelSelector).text() + categories = document.selectFirst(Evaluator.Class("filter-nav"))!!.children().map { element -> + val name = element.selectFirst(labelSelector)!!.text() val tags = element.select(linkSelector) val values = tags.map { it.text() }.toTypedArray() val uriParts = tags.map { it.attr("href").removePrefix("/list/").removeSuffix("/") }.toTypedArray() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/webtoons/Webtoons.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/webtoons/Webtoons.kt index 877f846d6..686ca6ed8 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/webtoons/Webtoons.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/webtoons/Webtoons.kt @@ -196,7 +196,7 @@ open class Webtoons( open fun parseDetailsThumbnail(document: Document): String? { val picElement = document.select("#content > div.cont_box > div.detail_body") val discoverPic = document.select("#content > div.cont_box > div.detail_header > span.thmb") - return discoverPic.select("img").not("[alt='Representative image']").first()?.attr("src") ?: picElement.attr("style")?.substringAfter("url(")?.substringBeforeLast(")") + return discoverPic.select("img").not("[alt='Representative image']").first()?.attr("src") ?: picElement.attr("style").substringAfter("url(")?.substringBeforeLast(")") } override fun mangaDetailsParse(document: Document): SManga { @@ -204,7 +204,7 @@ open class Webtoons( val infoElement = document.select("#_asideDetail") val manga = SManga.create() - manga.title = document.selectFirst("h1.subj, h3.subj").text() + manga.title = document.selectFirst("h1.subj, h3.subj")!!.text() manga.author = detailElement.select(".author:nth-of-type(1)").first()?.ownText() manga.artist = detailElement.select(".author:nth-of-type(2)").first()?.ownText() ?: manga.author manga.genre = detailElement.select(".genre").joinToString(", ") { it.text() } @@ -220,7 +220,7 @@ open class Webtoons( else -> SManga.UNKNOWN } - override fun imageUrlParse(document: Document): String = document.select("img").first().attr("src") + override fun imageUrlParse(document: Document): String = document.select("img").first()!!.attr("src") // Filters @@ -260,7 +260,7 @@ open class Webtoons( if (element.select(".ico_bgm").isNotEmpty()) { chapter.name += " ♫" } - chapter.date_upload = element.select("a > div.row > div.col > div.sub_info > span.date").text()?.let { chapterParseDate(it) } ?: 0 + chapter.date_upload = element.select("a > div.row > div.col > div.sub_info > span.date").text().let { chapterParseDate(it) } ?: 0 return chapter } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt index 4d2cca32d..4abb2779a 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt @@ -51,7 +51,7 @@ abstract class WPComics( title = it.text() setUrlWithoutDomain(it.attr("abs:href")) } - thumbnail_url = imageOrNull(element.select("div.image:first-of-type img").first()) + thumbnail_url = imageOrNull(element.select("div.image:first-of-type img").first()!!) } } @@ -106,7 +106,7 @@ abstract class WPComics( title = it.text() setUrlWithoutDomain(it.attr("abs:href")) } - thumbnail_url = imageOrNull(element.select("div.image a img").first()) + thumbnail_url = imageOrNull(element.select("div.image a img").first()!!) } } @@ -121,7 +121,7 @@ abstract class WPComics( status = info.select("li.status p.col-xs-8").text().toStatus() genre = info.select("li.kind p.col-xs-8 a").joinToString { it.text() } description = info.select("div.detail-content p").text() - thumbnail_url = imageOrNull(info.select("div.col-image img").first()) + thumbnail_url = imageOrNull(info.select("div.col-image img").first()!!) } } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zbulu/Zbulu.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zbulu/Zbulu.kt index 4727849e0..211ab6e16 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zbulu/Zbulu.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zbulu/Zbulu.kt @@ -53,7 +53,7 @@ abstract class Zbulu( setUrlWithoutDomain(it.attr("href").addTrailingSlash()) title = it.text() } - thumbnail_url = element.select("img").first().attr("abs:src") + thumbnail_url = element.select("img").first()!!.attr("abs:src") } } @@ -100,10 +100,10 @@ abstract class Zbulu( // Manga summary page override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.single-comic").first() + val infoElement = document.select("div.single-comic").first()!! return SManga.create().apply { - title = infoElement.select("h1").first().text() + title = infoElement.select("h1").first()!!.text() author = infoElement.select("div.author a").text() status = parseStatus(infoElement.select("div.update span[style]").text()) genre = infoElement.select("div.genre a").joinToString { it.text() } @@ -141,7 +141,7 @@ abstract class Zbulu( return SChapter.create().apply { setUrlWithoutDomain(element.select("a").attr("href")) name = element.select("h2").text() - date_upload = element.select("div.chapter-date")?.text().toDate() + date_upload = element.select("div.chapter-date").text().toDate() } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistManga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistManga.kt index d0be3a196..bd3cd39b1 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistManga.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistManga.kt @@ -32,7 +32,7 @@ abstract class ZeistManga( open val imgSelectorAttr = "src" open fun getChaptersUrl(doc: Document): String { - val script = doc.selectFirst(scriptSelector) + val script = doc.selectFirst(scriptSelector)!! val feed = chapterFeedRegex .find(script.html()) ?.groupValues?.get(1) @@ -109,17 +109,17 @@ abstract class ZeistManga( } override fun mangaDetailsParse(document: Document): SManga { - val profileManga = document.selectFirst(".grid.gtc-235fr") + val profileManga = document.selectFirst(".grid.gtc-235fr")!! return SManga.create().apply { - title = profileManga.selectFirst("h1.mt-0.mb-6.fs-20").text() - thumbnail_url = profileManga.selectFirst("img").attr("src") + title = profileManga.selectFirst("h1.mt-0.mb-6.fs-20")!!.text() + thumbnail_url = profileManga.selectFirst("img")!!.attr("src") description = profileManga.select("#synopsis").text() status = SManga.UNKNOWN } } override fun pageListParse(document: Document): List { - val images = document.selectFirst("div.check-box") + val images = document.selectFirst("div.check-box")!! return images.select(imgSelector).mapIndexed { i, img -> Page(i, "", img.attr(imgSelectorAttr)) } @@ -153,8 +153,8 @@ abstract class ZeistManga( override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { setUrlWithoutDomain(element.select(".block").attr("href")) - title = element.selectFirst(".clamp.toe.oh.block").text().trim() - thumbnail_url = element.selectFirst("img").attr("src") + title = element.selectFirst(".clamp.toe.oh.block")!!.text().trim() + thumbnail_url = element.selectFirst("img")!!.attr("src") } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistMangaDto.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistMangaDto.kt index ade10eb2c..2fac1f409 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistMangaDto.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zeistmanga/ZeistMangaDto.kt @@ -53,7 +53,7 @@ data class ZeistMangaEntryDto( private fun getThumbnail(html: ZeistMangaEntryContentDto): String { val document = Jsoup.parse(html.t) - return document.selectFirst("img").attr("src") + return document.selectFirst("img")!!.attr("src") } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zmanga/ZManga.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zmanga/ZManga.kt index e0db46eef..9185cf29a 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zmanga/ZManga.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/zmanga/ZManga.kt @@ -38,7 +38,7 @@ abstract class ZManga( override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { setUrlWithoutDomain(element.select("div.flexbox2-content a").attr("href")) - title = element.select("div.flexbox2-title > span").first().text() + title = element.select("div.flexbox2-title > span").first()!!.text() thumbnail_url = element.select("img").attr("abs:src") } } @@ -162,7 +162,7 @@ abstract class ZManga( override fun chapterFromElement(element: Element): SChapter { return SChapter.create().apply { setUrlWithoutDomain(element.attr("href")) - name = element.select("span").first().ownText() + name = element.select("span").first()!!.ownText() date_upload = parseDate(element.select("span.date").text()) } } diff --git a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt index ff8fc23b1..b08ad9179 100644 --- a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt +++ b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoTo.kt @@ -361,9 +361,9 @@ open class BatoTo( return Jsoup.parse(response.body.string(), response.request.url.toString(), Parser.xmlParser()) .select("channel > item").map { item -> SChapter.create().apply { - url = item.selectFirst("guid").text() - name = item.selectFirst("title").text().substringAfter(title).trim() - date_upload = SimpleDateFormat("E, dd MMM yyyy H:m:s Z", Locale.US).parse(item.selectFirst("pubDate").text())?.time ?: 0L + url = item.selectFirst("guid")!!.text() + name = item.selectFirst("title")!!.text().substringAfter(title).trim() + date_upload = SimpleDateFormat("E, dd MMM yyyy H:m:s Z", Locale.US).parse(item.selectFirst("pubDate")!!.text())?.time ?: 0L } } } diff --git a/src/all/buondua/src/eu/kanade/tachiyomi/extension/all/buondua/BuonDua.kt b/src/all/buondua/src/eu/kanade/tachiyomi/extension/all/buondua/BuonDua.kt index 44282a32e..ca18c2c49 100644 --- a/src/all/buondua/src/eu/kanade/tachiyomi/extension/all/buondua/BuonDua.kt +++ b/src/all/buondua/src/eu/kanade/tachiyomi/extension/all/buondua/BuonDua.kt @@ -65,7 +65,7 @@ class BuonDua() : ParsedHttpSource() { manga.title = document.select(".article-header").text() manga.description = document.select(".article-info > strong").text().trim() val genres = mutableListOf() - document.select(".article-tags").first().select(".tags > .tag").forEach { + document.select(".article-tags").first()!!.select(".tags > .tag").forEach { genres.add(it.text().substringAfter("#")) } manga.genre = genres.joinToString(", ") @@ -74,7 +74,7 @@ class BuonDua() : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - chapter.setUrlWithoutDomain(element.select(".is-current").first().attr("abs:href")) + chapter.setUrlWithoutDomain(element.select(".is-current").first()!!.attr("abs:href")) chapter.chapter_number = 0F chapter.name = element.select(".article-header").text() chapter.date_upload = SimpleDateFormat("H:m DD-MM-yyyy", Locale.US).parse(element.select(".article-info > small").text())?.time ?: 0L @@ -86,7 +86,7 @@ class BuonDua() : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { - val numpages = document.selectFirst(".pagination-list").select(".pagination-link") + val numpages = document.selectFirst(".pagination-list")!!.select(".pagination-link") val pages = mutableListOf() numpages.forEachIndexed { index, page -> @@ -94,7 +94,7 @@ class BuonDua() : ParsedHttpSource() { 0 -> document else -> client.newCall(GET(page.attr("abs:href"))).execute().asJsoup() } - doc.select(".article-fulltext img").forEach { it -> + doc.select(".article-fulltext img").forEach { val itUrl = it.attr("abs:src") pages.add(Page(pages.size, "", itUrl)) } diff --git a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt index 3be24fe23..919f1faf1 100644 --- a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt +++ b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt @@ -81,7 +81,7 @@ abstract class EHentai( } } // Get image - it.parent().select(".glthumb img")?.first().apply { + it.parent()?.select(".glthumb img")?.first().apply { thumbnail_url = this?.attr("data-src")?.nullIfBlank() ?: this?.attr("src") } diff --git a/src/all/everiaclub/src/eu/kanade/tachiyomi/extension/all/everiaclub/EveriaClub.kt b/src/all/everiaclub/src/eu/kanade/tachiyomi/extension/all/everiaclub/EveriaClub.kt index 16c6bae55..566c62782 100644 --- a/src/all/everiaclub/src/eu/kanade/tachiyomi/extension/all/everiaclub/EveriaClub.kt +++ b/src/all/everiaclub/src/eu/kanade/tachiyomi/extension/all/everiaclub/EveriaClub.kt @@ -30,7 +30,7 @@ class EveriaClub() : ParsedHttpSource() { // Latest override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.selectFirst("img").imgSrc + manga.thumbnail_url = element.selectFirst("img")!!.imgSrc manga.title = element.select(".entry-title").text() manga.setUrlWithoutDomain(element.select(".entry-title > a").attr("abs:href")) return manga @@ -46,7 +46,7 @@ class EveriaClub() : ParsedHttpSource() { // Popular override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.selectFirst("img").imgSrc + manga.thumbnail_url = element.selectFirst("img")!!.imgSrc manga.title = element.select("h3").text() manga.setUrlWithoutDomain(element.select("h3 > a").attr("abs:href")) return manga diff --git a/src/all/hennojin/src/eu/kanade/tachiyomi/extension/all/hennojin/Hennojin.kt b/src/all/hennojin/src/eu/kanade/tachiyomi/extension/all/hennojin/Hennojin.kt index 856b04b54..3d4e690e7 100644 --- a/src/all/hennojin/src/eu/kanade/tachiyomi/extension/all/hennojin/Hennojin.kt +++ b/src/all/hennojin/src/eu/kanade/tachiyomi/extension/all/hennojin/Hennojin.kt @@ -46,10 +46,10 @@ class Hennojin(override val lang: String, suffix: String) : ParsedHttpSource() { override fun popularMangaFromElement(element: Element) = SManga.create().apply { element.selectFirst(".title_link > a").let { - title = it.text() + title = it!!.text() setUrlWithoutDomain(it.attr("href")) } - thumbnail_url = element.selectFirst("img").attr("src") + thumbnail_url = element.selectFirst("img")!!.attr("src") } override fun searchMangaSelector() = popularMangaSelector() diff --git a/src/all/imhentai/src/eu/kanade/tachiyomi/extension/all/imhentai/IMHentai.kt b/src/all/imhentai/src/eu/kanade/tachiyomi/extension/all/imhentai/IMHentai.kt index 4b1d33249..b7d26c217 100644 --- a/src/all/imhentai/src/eu/kanade/tachiyomi/extension/all/imhentai/IMHentai.kt +++ b/src/all/imhentai/src/eu/kanade/tachiyomi/extension/all/imhentai/IMHentai.kt @@ -125,8 +125,7 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH url.addQueryParameter(pair.second, toBinary(filter.state == index)) } } - else -> { - } + else -> {} } } @@ -141,9 +140,9 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH return this.joinToString { listOf( it.ownText(), - it.select(".split_tag")?.text() - ?.trim() - ?.removePrefix("| "), + it.select(".split_tag").text() + .trim() + .removePrefix("| "), ) .filter { s -> !s.isNullOrBlank() } .joinToString(splitTagSeparator) @@ -151,16 +150,16 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH } override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("div.right_details > h1").text() + title = document.selectFirst("div.right_details > h1")!!.text() thumbnail_url = document.selectFirst("div.left_cover img")?.let { it.absUrl(if (it.hasAttr("data-src")) "data-src" else "src") } val mangaInfoElement = document.select(".galleries_info") - val infoMap = mangaInfoElement.select("li:not(.pages)").map { + val infoMap = mangaInfoElement.select("li:not(.pages)").associate { it.select("span.tags_text").text().removeSuffix(":") to it.select(".tag") - }.toMap() + } artist = infoMap["Artists"]?.csvText(" | ") @@ -206,11 +205,11 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH private val json: Json by injectLazy() override fun pageListParse(document: Document): List { - val image_dir = document.select("#image_dir").`val`() - val gallery_id = document.select("#gallery_id").`val`() - val u_id = document.select("#u_id").`val`().toInt() + val imageDir = document.select("#image_dir").`val`() + val galleryId = document.select("#gallery_id").`val`() + val uId = document.select("#u_id").`val`().toInt() - val random_server = when (u_id) { + val randomServer = when (uId) { in 1..274825 -> "m1.imhentai.xxx" in 274826..403818 -> "m2.imhentai.xxx" in 403819..527143 -> "m3.imhentai.xxx" @@ -221,20 +220,20 @@ class IMHentai(override val lang: String, private val imhLang: String) : ParsedH } val images = json.parseToJsonElement( - document.selectFirst("script:containsData(var g_th)").data() + document.selectFirst("script:containsData(var g_th)")!!.data() .substringAfter("$.parseJSON('").substringBefore("');").trim(), ).jsonObject val pages = mutableListOf() for (image in images) { val iext = image.value.toString().replace("\"", "").split(",")[0] - val iext_pr = when (iext) { + val iextPr = when (iext) { "p" -> "png" "b" -> "bmp" "g" -> "gif" else -> "jpg" } - pages.add(Page(image.key.toInt() - 1, "", "https://$random_server/$image_dir/$gallery_id/${image.key}.$iext_pr")) + pages.add(Page(image.key.toInt() - 1, "", "https://$randomServer/$imageDir/$galleryId/${image.key}.$iextPr")) } return pages } diff --git a/src/all/junmeitu/src/eu/kanade/tachiyomi/extension/all/junmeitu/Junmeitu.kt b/src/all/junmeitu/src/eu/kanade/tachiyomi/extension/all/junmeitu/Junmeitu.kt index d8384c99e..779ccdcb1 100644 --- a/src/all/junmeitu/src/eu/kanade/tachiyomi/extension/all/junmeitu/Junmeitu.kt +++ b/src/all/junmeitu/src/eu/kanade/tachiyomi/extension/all/junmeitu/Junmeitu.kt @@ -77,7 +77,7 @@ class Junmeitu : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - manga.title = document.selectFirst(".news-title,.title").text() + manga.title = document.selectFirst(".news-title,.title")!!.text() manga.description = document.select(".news-info,.picture-details").text() + "\n" + document.select(".introduce").text() manga.genre = document.select(".relation_tags > a").joinToString { it.text() } manga.status = SManga.COMPLETED @@ -86,7 +86,7 @@ class Junmeitu : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - chapter.setUrlWithoutDomain(element.select(".position a:last-child").first().attr("abs:href")) + chapter.setUrlWithoutDomain(element.select(".position a:last-child").first()!!.attr("abs:href")) chapter.chapter_number = -2f chapter.name = "Gallery" return chapter @@ -104,7 +104,7 @@ class Junmeitu : ParsedHttpSource() { val index = lastIndexOf('.') // .html baseUrl + "/ajax_" + substring(baseUrl.length + 1, index) + '-' } - val postfix = document.selectFirst("body > script").data().run { + val postfix = document.selectFirst("body > script")!!.data().run { val script = substringAfterLast("pc_cid = ") val categoryId = script.substringBefore(';') val contentId = script.substringAfter("pc_id = ").substringBeforeLast(';') diff --git a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt index 417c91309..dc0e6361f 100644 --- a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt +++ b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt @@ -1164,16 +1164,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou .execute().use { response -> genresListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for genres filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e(LOG_TAG, "[Filter] Error decoding JSON for genres filter -> ${response.body}", e) emptyList() @@ -1183,16 +1174,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Metadata/tags", headersBuilder().build())) .execute().use { response -> tagsListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for tagsList filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e(LOG_TAG, "[Filter] Error decoding JSON for tagsList filter", e) emptyList() @@ -1202,16 +1184,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Metadata/age-ratings", headersBuilder().build())) .execute().use { response -> ageRatingsListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for age-ratings filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1225,16 +1198,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Collection", headersBuilder().build())) .execute().use { response -> collectionsListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for collectionsListMeta filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1248,16 +1212,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Metadata/languages", headersBuilder().build())) .execute().use { response -> languagesListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for languagesListMeta filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1271,16 +1226,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Library", headersBuilder().build())) .execute().use { response -> libraryListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "[Filter] Error decoding JSON for libraries filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1294,16 +1240,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Metadata/people", headersBuilder().build())) .execute().use { response -> peopleListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "error while decoding JSON for peopleListMeta filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1316,16 +1253,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou client.newCall(GET("$apiUrl/Metadata/publication-status", headersBuilder().build())) .execute().use { response -> pubStatusListMeta = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e( - LOG_TAG, - "error while decoding JSON for publicationStatusListMeta filter: response body is null. Response code: ${response.code}", - ) - emptyList() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e( LOG_TAG, @@ -1345,9 +1273,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou .subscribe( {}, { tr -> - /** - * Avoid polluting logs with traces of exception - * **/ + // Avoid polluting logs with traces of exception if (tr is EmptyRequestBody || tr is LoginErrorException) { Log.e(LOG_TAG, "error while doing initial calls\n${tr.cause}") return@subscribe diff --git a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt index 0889de16f..893a6a7ce 100644 --- a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt +++ b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt @@ -581,13 +581,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere try { client.newCall(GET("$baseUrl/api/v1/tags", headers)).execute().use { response -> tags = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e(LOG_TAG, "error while decoding JSON for tags filter: response body is null. Response code: ${response.code}") - emptySet() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e(LOG_TAG, "error while decoding JSON for tags filter", e) emptySet() @@ -600,13 +594,7 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere try { client.newCall(GET("$baseUrl/api/v1/publishers", headers)).execute().use { response -> publishers = try { - val responseBody = response.body - if (responseBody != null) { - responseBody.use { json.decodeFromString(it.string()) } - } else { - Log.e(LOG_TAG, "error while decoding JSON for publishers filter: response body is null. Response code: ${response.code}") - emptySet() - } + response.body.use { json.decodeFromString(it.string()) } } catch (e: Exception) { Log.e(LOG_TAG, "error while decoding JSON for publishers filter", e) emptySet() @@ -619,14 +607,9 @@ open class Komga(private val suffix: String = "") : ConfigurableSource, Unmetere try { client.newCall(GET("$baseUrl/api/v1/authors", headers)).execute().use { response -> authors = try { - val responseBody = response.body - if (responseBody != null) { - val list: List = responseBody.use { json.decodeFromString(it.string()) } - list.groupBy { it.role } - } else { - Log.e(LOG_TAG, "error while decoding JSON for authors filter: response body is null. Response code: ${response.code}") - emptyMap() - } + response.body + .use { json.decodeFromString>(it.string()) } + .groupBy { it.role } } catch (e: Exception) { Log.e(LOG_TAG, "error while decoding JSON for authors filter", e) emptyMap() diff --git a/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt b/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt index 33de7bc11..010a48d9e 100644 --- a/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt +++ b/src/all/littlegarden/src/eu/kanade/tachiyomi/extension/all/littlegarden/LittleGarden.kt @@ -50,7 +50,7 @@ class LittleGarden : ParsedHttpSource() { override fun latestUpdatesSelector() = ".d-sm-block.col-sm-6.col-lg-6.col-xl-3.col-12" override fun latestUpdatesNextPageSelector(): String? = null override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h3").text().trim() + title = element.selectFirst("h3")!!.text().trim() setUrlWithoutDomain(element.select("a").attr("href").substringBeforeLast("/")) thumbnail_url = element.select(".img.image-item").attr("style").substringAfter("(").substringBefore(")") } @@ -172,9 +172,9 @@ class LittleGarden : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { val pages = mutableListOf() - val chapNb = document.selectFirst("div.chapter-number").text().trim().toInt() + val chapNb = document.selectFirst("div.chapter-number")!!.text().trim().toInt() val engChaps: IntArray = intArrayOf(970, 987, 992) - if (document.selectFirst("div.manga-name").text().trim() == "One Piece" && (engChaps.contains(chapNb) || chapNb > 1004)) { // Permits to get French pages rather than English pages for some chapters + if (document.selectFirst("div.manga-name")!!.text().trim() == "One Piece" && (engChaps.contains(chapNb) || chapNb > 1004)) { // Permits to get French pages rather than English pages for some chapters oricolPageRegex.findAll(document.select("script:containsData(pages)").toString()).asIterable().mapIndexed { i, it -> if (it.groups["colored"]?.value?.contains("\"") == true) { // Their JS dict has " " around the link only when available. Also uses colored pages rather than B&W as it's the main strength of this site pages.add(Page(i, "", cdnUrl + it.groups["colored"]?.value?.replace("\"", "") + ".webp")) diff --git a/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt b/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt index 33188d7e9..880dabd53 100644 --- a/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt +++ b/src/all/mangapluscreators/src/eu/kanade/tachiyomi/extension/all/mangapluscreators/MangaPlusCreators.kt @@ -106,21 +106,21 @@ class MangaPlusCreators(override val lang: String) : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val result = response.asJsoup() - val bookBox = result.selectFirst(".book-box") + val bookBox = result.selectFirst(".book-box")!! return SManga.create().apply { - title = bookBox.selectFirst("div.title").text() - author = bookBox.selectFirst("div.mod-btn-profile div.name").text() + title = bookBox.selectFirst("div.title")!!.text() + author = bookBox.selectFirst("div.mod-btn-profile div.name")!!.text() description = bookBox.select("div.summary p") .joinToString("\n\n") { it.text() } - status = when (bookBox.selectFirst("div.book-submit-type").text()) { + status = when (bookBox.selectFirst("div.book-submit-type")!!.text()) { "Series" -> SManga.ONGOING "One-shot" -> SManga.COMPLETED else -> SManga.UNKNOWN } genre = bookBox.select("div.genre-area div.tag-genre") .joinToString { it.text() } - thumbnail_url = bookBox.selectFirst("div.cover img").attr("data-src") + thumbnail_url = bookBox.selectFirst("div.cover img")!!.attr("data-src") } } diff --git a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt index 36fc4fa70..6c0dff429 100644 --- a/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt +++ b/src/all/mangareaderto/src/eu/kanade/tachiyomi/extension/all/mangareaderto/MangaReader.kt @@ -116,7 +116,7 @@ open class MangaReader( override fun searchMangaFromElement(element: Element) = SManga.create().apply { url = element.attr("href") - element.selectFirst(Evaluator.Tag("img")).let { + element.selectFirst(Evaluator.Tag("img"))!!.let { title = it.attr("alt") thumbnail_url = it.attr("src") } @@ -146,23 +146,23 @@ open class MangaReader( override fun mangaDetailsParse(document: Document) = SManga.create().apply { url = document.location().removePrefix(baseUrl) - val root = document.selectFirst(Evaluator.Id("ani_detail")) - val mangaTitle = root.selectFirst(Evaluator.Tag("h2")).ownText() + val root = document.selectFirst(Evaluator.Id("ani_detail"))!! + val mangaTitle = root.selectFirst(Evaluator.Tag("h2"))!!.ownText() title = if (url.endsWith(VOLUME_URL_SUFFIX)) VOLUME_TITLE_PREFIX + mangaTitle else mangaTitle description = root.run { - val description = selectFirst(Evaluator.Class("description")).ownText() - when (val altTitle = selectFirst(Evaluator.Class("manga-name-or")).ownText()) { + val description = selectFirst(Evaluator.Class("description"))!!.ownText() + when (val altTitle = selectFirst(Evaluator.Class("manga-name-or"))!!.ownText()) { "", mangaTitle -> description else -> "$description\n\nAlternative Title: $altTitle" } } - thumbnail_url = root.selectFirst(Evaluator.Tag("img")).attr("src") - genre = root.selectFirst(Evaluator.Class("genres")).children().joinToString { it.ownText() } - for (item in root.selectFirst(Evaluator.Class("anisc-info")).children()) { + thumbnail_url = root.selectFirst(Evaluator.Tag("img"))!!.attr("src") + genre = root.selectFirst(Evaluator.Class("genres"))!!.children().joinToString { it.ownText() } + for (item in root.selectFirst(Evaluator.Class("anisc-info"))!!.children()) { if (item.hasClass("item").not()) continue - when (item.selectFirst(Evaluator.Class("item-head")).ownText()) { + when (item.selectFirst(Evaluator.Class("item-head"))!!.ownText()) { "Authors:" -> item.parseAuthorsTo(this) - "Status:" -> status = when (item.selectFirst(Evaluator.Class("name")).ownText()) { + "Status:" -> status = when (item.selectFirst(Evaluator.Class("name"))!!.ownText()) { "Finished" -> SManga.COMPLETED "Publishing" -> SManga.ONGOING else -> SManga.UNKNOWN @@ -198,7 +198,7 @@ open class MangaReader( SChapter.create().apply { val number = element.attr("data-number") chapter_number = number.toFloatOrNull() ?: -1f - element.selectFirst(Evaluator.Tag("a")).let { + element.selectFirst(Evaluator.Tag("a"))!!.let { url = it.attr("href") name = run { val name = it.attr("title") @@ -211,7 +211,7 @@ open class MangaReader( } override fun pageListParse(document: Document): List { - val ajaxUrl = document.selectFirst(Evaluator.Id("wrapper")).run { + val ajaxUrl = document.selectFirst(Evaluator.Id("wrapper"))!!.run { val readingBy = attr("data-reading-by") val readingId = attr("data-reading-id") "$baseUrl/ajax/image/list/$readingBy/$readingId?quality=${preferences.quality}" diff --git a/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt b/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt index 9ef66a664..29bc14060 100644 --- a/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt +++ b/src/all/mangatoon/src/eu/kanade/tachiyomi/extension/all/mangatoon/MangaToon.kt @@ -60,7 +60,7 @@ open class MangaToon( override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { title = element.select("div.content-title").text().trim() thumbnail_url = element.select("img").attr("abs:src").toNormalPosterUrl() - url = element.selectFirst("a").attr("href") + url = element.selectFirst("a")!!.attr("href") } override fun popularMangaNextPageSelector() = "span.next" @@ -88,7 +88,7 @@ open class MangaToon( override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { title = element.select("div.recommend-comics-title").text().trim() thumbnail_url = element.select("img").attr("abs:src").toNormalPosterUrl() - url = element.selectFirst("a").attr("href") + url = element.selectFirst("a")!!.attr("href") } override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() diff --git a/src/all/meituatop/src/eu/kanade/tachiyomi/extension/all/meituatop/MeituaTop.kt b/src/all/meituatop/src/eu/kanade/tachiyomi/extension/all/meituatop/MeituaTop.kt index 14e57b9e4..1c2a4bccf 100644 --- a/src/all/meituatop/src/eu/kanade/tachiyomi/extension/all/meituatop/MeituaTop.kt +++ b/src/all/meituatop/src/eu/kanade/tachiyomi/extension/all/meituatop/MeituaTop.kt @@ -29,13 +29,13 @@ class MeituaTop : HttpSource() { override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() - val mangas = document.selectFirst(Evaluator.Class("thumbnail-group")).children().map { + val mangas = document.selectFirst(Evaluator.Class("thumbnail-group"))!!.children().map { SManga.create().apply { - url = it.selectFirst(Evaluator.Tag("a")).attr("href") - val image = it.selectFirst(Evaluator.Tag("img")) + url = it.selectFirst(Evaluator.Tag("a"))!!.attr("href") + val image = it.selectFirst(Evaluator.Tag("img"))!! title = image.attr("alt") thumbnail_url = image.attr("src") - val info = it.selectFirst(Evaluator.Tag("p")).ownText().split(" - ") + val info = it.selectFirst(Evaluator.Tag("p"))!!.ownText().split(" - ") genre = info[0] description = info[1] status = SManga.COMPLETED @@ -86,8 +86,8 @@ class MeituaTop : HttpSource() { override fun pageListParse(response: Response): List { val document = response.asJsoup() - val images = document.selectFirst(Evaluator.Class("ttnr")).select(Evaluator.Tag("img")) - .map { it.attr("src")!! }.distinct() + val images = document.selectFirst(Evaluator.Class("ttnr"))!!.select(Evaluator.Tag("img")) + .map { it.attr("src") }.distinct() return images.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) } } diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt index a04c3f3b0..9ce267237 100644 --- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt +++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt @@ -56,7 +56,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin override fun latestUpdatesNextPageSelector() = "li.pagination-next" override fun latestUpdatesSelector() = "article" - override fun latestUpdatesFromElement(element: Element) = buildManga(element.select("a[rel]").first(), element.select("a.entry-image-link img").first()) + override fun latestUpdatesFromElement(element: Element) = buildManga(element.select("a[rel]").first()!!, element.select("a.entry-image-link img").first()) override fun latestUpdatesParse(response: Response): MangasPage { cacheAssistant() return super.latestUpdatesParse(response) @@ -94,7 +94,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin val totalResults = Regex("""(\d+)""").find(document.select("div.res_info").text())?.groupValues?.get(1)?.toIntOrNull() ?: 0 return MangasPage(mangas, mangaParsedSoFar < totalResults) } - override fun searchMangaFromElement(element: Element) = buildManga(element.select("a").first(), element.select("img")?.first()) + override fun searchMangaFromElement(element: Element) = buildManga(element.select("a").first()!!, element.select("img").first()) // Build Manga From Element private fun buildManga(titleElement: Element, thumbnailElement: Element?): SManga { @@ -150,9 +150,9 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin // too troublesome to achieve 100% accuracy assigning scanlator group during chapterListParse val scanlatedBy = document.select(".entry-terms:has(a[href*=group])").firstOrNull() ?.select("a[href*=group]")?.joinToString(prefix = "Scanlated by: ") { it.text() } - val extendedDescription = document.select(".entry-content p:not(p:containsOwn(|)):not(.chapter-class + p)")?.joinToString("\n") { it.text() } + val extendedDescription = document.select(".entry-content p:not(p:containsOwn(|)):not(.chapter-class + p)").joinToString("\n") { it.text() } description = listOfNotNull(basicDescription, scanlatedBy, extendedDescription).joinToString("\n") - status = when (document.select("a[href*=status]")?.first()?.text()) { + status = when (document.select("a[href*=status]").first()?.text()) { "Ongoing" -> SManga.ONGOING "Completed" -> SManga.COMPLETED else -> SManga.UNKNOWN @@ -162,7 +162,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin thumbnail_url = getThumbnail( getImage( client.newCall(GET("$baseUrl/search/?search=${document.location()}", headers)) - .execute().asJsoup().select("div.wdm_results div.p_content img").first(), + .execute().asJsoup().select("div.wdm_results div.p_content img").first()!!, ), ) } @@ -181,16 +181,16 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin val date = parseDate(document.select(".entry-time").text()) val mangaUrl = document.baseUri() - val chfirstname = document.select(".chapter-class a[href*=$mangaUrl]")?.first()?.text()?.ifEmpty { "Ch. 1" }?.replaceFirstChar { it.titlecase() } + val chfirstname = document.select(".chapter-class a[href*=$mangaUrl]").first()?.text()?.ifEmpty { "Ch. 1" }?.replaceFirstChar { it.titlecase() } ?: "Ch. 1" // create first chapter since its on main manga page chapters.add(createChapter("1", document.baseUri(), date, chfirstname)) // see if there are multiple chapters or not - document.select(chapterListSelector())?.let { it -> + document.select(chapterListSelector()).let { it -> it.forEach { if (!it.text().contains("Next »", true)) { val pageNumber = it.text() - val chname = document.select(".chapter-class a[href$=/$pageNumber/]")?.text()?.ifEmpty { "Ch. $pageNumber" }?.replaceFirstChar { it.titlecase() } + val chname = document.select(".chapter-class a[href$=/$pageNumber/]").text().ifEmpty { "Ch. $pageNumber" }?.replaceFirstChar { it.titlecase() } ?: "Ch. $pageNumber" chapters.add(createChapter(it.text(), document.baseUri(), date, chname)) } diff --git a/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/NetcomicsAPI.kt b/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/NetcomicsAPI.kt index 030019b56..014732d64 100644 --- a/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/NetcomicsAPI.kt +++ b/src/all/netcomics/src/eu/kanade/tachiyomi/extension/all/netcomics/NetcomicsAPI.kt @@ -33,7 +33,7 @@ data class Title( get() = "$title_slug|$title_id" val description: String? - get() = Jsoup.parse(story)?.text() + get() = Jsoup.parse(story).text() val thumbnail: String get() = CDN_URL + v_cover_img diff --git a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHUtils.kt b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHUtils.kt index 020fb151b..ccac6774a 100644 --- a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHUtils.kt +++ b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHUtils.kt @@ -51,7 +51,7 @@ object NHUtils { } fun getNumPages(document: Document): String { - return document.select("#tags > div:nth-child(8) > span > a .name").first().cleanTag() + return document.select("#tags > div:nth-child(8) > span > a .name").first()!!.cleanTag() } fun getTime(document: Document): Long { diff --git a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt index d517e6c4d..ab12e296f 100644 --- a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt +++ b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt @@ -98,7 +98,7 @@ open class NHentai( title = element.select("a > div").text().replace("\"", "").let { if (displayFullTitle) it.trim() else it.shortenTitle() } - thumbnail_url = element.select(".cover img").first().let { img -> + thumbnail_url = element.select(".cover img").first()!!.let { img -> if (img.hasAttr("data-src")) img.attr("abs:data-src") else img.attr("abs:src") } } @@ -247,11 +247,11 @@ open class NHentai( override fun chapterListSelector() = throw UnsupportedOperationException("Not used") override fun pageListParse(document: Document): List { - val script = document.select("script:containsData(media_server)").first().data() - val media_server = Regex("""media_server\s*:\s*(\d+)""").find(script)?.groupValues!!.get(1) + val script = document.select("script:containsData(media_server)").first()!!.data() + val mediaServer = Regex("""media_server\s*:\s*(\d+)""").find(script)?.groupValues!![1] return document.select("div.thumbs a > img").mapIndexed { i, img -> - Page(i, "", img.attr("abs:data-src").replace("t.nh", "i.nh").replace("t\\d+.nh".toRegex(), "i$media_server.nh").replace("t.", ".")) + Page(i, "", img.attr("abs:data-src").replace("t.nh", "i.nh").replace("t\\d+.nh".toRegex(), "i$mediaServer.nh").replace("t.", ".")) } } diff --git a/src/all/ninemanga/src/eu/kanade/tachiyomi/extension/all/ninemanga/NineManga.kt b/src/all/ninemanga/src/eu/kanade/tachiyomi/extension/all/ninemanga/NineManga.kt index eac02a204..ec58cdbef 100644 --- a/src/all/ninemanga/src/eu/kanade/tachiyomi/extension/all/ninemanga/NineManga.kt +++ b/src/all/ninemanga/src/eu/kanade/tachiyomi/extension/all/ninemanga/NineManga.kt @@ -59,7 +59,7 @@ open class NineManga( title = it.select("li > span:not([class])").text().removeSuffix(" Manga") genre = it.select("li[itemprop=genre] a").joinToString { e -> e.text() } author = it.select("li a[itemprop=author]").text() - status = parseStatus(it.select("li a.red").first().text()) + status = parseStatus(it.select("li a.red").first()!!.text()) description = it.select("p[itemprop=description]").text() thumbnail_url = it.select("img[itemprop=image]").attr("abs:src") @@ -114,12 +114,12 @@ open class NineManga( } override fun pageListParse(document: Document): List = mutableListOf().apply { - document.select("select#page").first().select("option").forEach { + document.select("select#page").first()!!.select("option").forEach { add(Page(size, baseUrl + it.attr("value"))) } } - override fun imageUrlParse(document: Document) = document.select("div.pic_box img.manga_pic").first().attr("src").orEmpty() + override fun imageUrlParse(document: Document) = document.select("div.pic_box img.manga_pic").first()!!.attr("src").orEmpty() override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = "$baseUrl/search/".toHttpUrlOrNull()!!.newBuilder() diff --git a/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt b/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt index 2f2ce3fd1..aa6be71c9 100644 --- a/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt +++ b/src/all/noisemanga/src/eu/kanade/tachiyomi/extension/all/noisemanga/NoiseManga.kt @@ -68,8 +68,8 @@ abstract class NoiseManga(override val lang: String) : ParsedHttpSource() { override fun mangaDetailsRequest(manga: SManga): Request = GET(baseUrl + manga.url, headers) override fun mangaDetailsParse(document: Document): SManga { - val mainContent = document.select("div.main-content-page").first() - val entryContent = mainContent.select("div.entry-content").first() + val mainContent = document.select("div.main-content-page").first()!! + val entryContent = mainContent.select("div.entry-content").first()!! val descriptionSelector = if (lang == "en") "h4 + h4, h4 + div h4" else "h1 + h4" val mangaSlug = document.location().replace(baseUrl, "") diff --git a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/PepperCarrot.kt b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/PepperCarrot.kt index 380734810..42a872e77 100644 --- a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/PepperCarrot.kt +++ b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/PepperCarrot.kt @@ -145,15 +145,15 @@ class PepperCarrot : HttpSource(), ConfigurableSource { return translatedChapters.map { (number, it) -> SChapter.create().apply { - url = it.selectFirst(Evaluator.Tag("a")).attr("href").removePrefix(BASE_URL) - name = it.selectFirst(Evaluator.Tag("img")).attr("title").run { + url = it.selectFirst(Evaluator.Tag("a"))!!.attr("href").removePrefix(BASE_URL) + name = it.selectFirst(Evaluator.Tag("img"))!!.attr("title").run { val index = lastIndexOf('(') when { index >= 0 -> substring(0, index).trimEnd() else -> substringBeforeLast('(').trimEnd() } } - date_upload = it.selectFirst(Evaluator.Tag("figcaption")).ownText().let { + date_upload = it.selectFirst(Evaluator.Tag("figcaption"))!!.ownText().let { val date = dateRegex.find(it)!!.value dateFormat.parse(date)!!.time } diff --git a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt index 4d22ce6ef..29ab28882 100644 --- a/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt +++ b/src/all/peppercarrot/src/eu/kanade/tachiyomi/extension/all/peppercarrot/Preferences.kt @@ -99,8 +99,8 @@ private fun fetchTitles(client: OkHttpClient, headers: Headers): Map() - for (file in document.selectFirst(Evaluator.Class("search-results")).children()) { - val filename = file.selectFirst(Evaluator.Tag("strong")).ownText() + for (file in document.selectFirst(Evaluator.Class("search-results"))!!.children()) { + val filename = file.selectFirst(Evaluator.Tag("strong"))!!.ownText() if (!filename.endsWith(".po") || !filename.startsWith("po/")) continue val lang = filename.substring(3, filename.length - 3) diff --git a/src/all/photos18/src/eu/kanade/tachiyomi/extension/all/photos18/Photos18.kt b/src/all/photos18/src/eu/kanade/tachiyomi/extension/all/photos18/Photos18.kt index f721e686f..4acc42de6 100644 --- a/src/all/photos18/src/eu/kanade/tachiyomi/extension/all/photos18/Photos18.kt +++ b/src/all/photos18/src/eu/kanade/tachiyomi/extension/all/photos18/Photos18.kt @@ -45,14 +45,14 @@ class Photos18 : HttpSource(), ConfigurableSource { override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() parseCategories(document) - val mangas = document.selectFirst(Evaluator.Id("videos")).children().map { - val cardBody = it.selectFirst(Evaluator.Class("card-body")) - val link = cardBody.selectFirst(Evaluator.Tag("a")) + val mangas = document.selectFirst(Evaluator.Id("videos"))!!.children().map { + val cardBody = it.selectFirst(Evaluator.Class("card-body"))!! + val link = cardBody.selectFirst(Evaluator.Tag("a"))!! SManga.create().apply { url = link.attr("href").stripLang() title = link.ownText() - thumbnail_url = baseUrl + it.selectFirst(Evaluator.Tag("img")).attr("data-src") - genre = cardBody.selectFirst(Evaluator.Tag("label")).ownText() + thumbnail_url = baseUrl + it.selectFirst(Evaluator.Tag("img"))!!.attr("data-src") + genre = cardBody.selectFirst(Evaluator.Tag("label"))!!.ownText() status = SManga.COMPLETED initialized = true } @@ -98,7 +98,7 @@ class Photos18 : HttpSource(), ConfigurableSource { override fun pageListParse(response: Response): List { val document = response.asJsoup() - val images = document.selectFirst(Evaluator.Id("content")).select(Evaluator.Tag("img")) + val images = document.selectFirst(Evaluator.Id("content"))!!.select(Evaluator.Tag("img")) return images.mapIndexed { index, image -> Page(index, imageUrl = image.attr("data-src")) } @@ -145,12 +145,12 @@ class Photos18 : HttpSource(), ConfigurableSource { private fun parseCategories(document: Document) { if (categories.isNotEmpty()) return - val items = document.selectFirst(Evaluator.Id("w3")).children() + val items = document.selectFirst(Evaluator.Id("w3"))!!.children() categories = buildList(items.size + 1) { add(Pair("All", "")) items.mapTo(this) { val value = it.text().substringBefore(" (") - val queryValue = it.selectFirst(Evaluator.Tag("a")).attr("href").substringAfterLast('/') + val queryValue = it.selectFirst(Evaluator.Tag("a"))!!.attr("href").substringAfterLast('/') Pair(value, queryValue) } } diff --git a/src/all/sandraandwoo/src/eu/kanade/tachiyomi/extension/all/sandraandwoo/SandraAndWoo.kt b/src/all/sandraandwoo/src/eu/kanade/tachiyomi/extension/all/sandraandwoo/SandraAndWoo.kt index 59aad9647..2a8032733 100644 --- a/src/all/sandraandwoo/src/eu/kanade/tachiyomi/extension/all/sandraandwoo/SandraAndWoo.kt +++ b/src/all/sandraandwoo/src/eu/kanade/tachiyomi/extension/all/sandraandwoo/SandraAndWoo.kt @@ -97,7 +97,7 @@ abstract class SandraAndWoo( private fun pageImageSelector() = "#comic img" override fun pageListParse(document: Document): List { - val img = document.selectFirst(pageImageSelector()) + val img = document.selectFirst(pageImageSelector())!! val path = img.attr("src") return listOf(Page(0, "", "${baseUrl}$path")) diff --git a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt index 7e663a3ab..28a59a274 100644 --- a/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt +++ b/src/all/tappytoon/src/eu/kanade/tachiyomi/extension/all/tappytoon/Tappytoon.kt @@ -58,7 +58,7 @@ class Tappytoon(override val lang: String) : HttpSource() { private val apiHeaders by lazy { val res = client.newCall(GET(baseUrl, headers)).execute() - val data = res.asJsoup().getElementById("__NEXT_DATA__") + val data = res.asJsoup().getElementById("__NEXT_DATA__")!! val obj = json.parseToJsonElement(data.data()) .jsonObject["props"]!!.jsonObject["initialState"]!! .jsonObject["axios"]!!.jsonObject["headers"]!!.jsonObject diff --git a/src/all/toomics/src/eu/kanade/tachiyomi/extension/all/toomics/ToomicsGlobal.kt b/src/all/toomics/src/eu/kanade/tachiyomi/extension/all/toomics/ToomicsGlobal.kt index cb055b76c..3c306b163 100644 --- a/src/all/toomics/src/eu/kanade/tachiyomi/extension/all/toomics/ToomicsGlobal.kt +++ b/src/all/toomics/src/eu/kanade/tachiyomi/extension/all/toomics/ToomicsGlobal.kt @@ -50,7 +50,7 @@ abstract class ToomicsGlobal( override fun popularMangaSelector(): String = "li > div.visual" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.select("h4[class$=title]").first().ownText() + title = element.select("h4[class$=title]").first()!!.ownText() // sometimes href contains "/ab/on" at the end and redirects to a chapter instead of manga setUrlWithoutDomain(element.select("a").attr("href").removeSuffix("/ab/on")) thumbnail_url = element.select("img").attr("src") @@ -125,9 +125,9 @@ abstract class ToomicsGlobal( val num = element.select("div.cell-num").text() val numText = if (num.isNotEmpty()) "$num - " else "" - name = numText + element.select("div.cell-title strong")?.first()?.ownText() + name = numText + element.select("div.cell-title strong").first()?.ownText() chapter_number = num.toFloatOrNull() ?: -1f - date_upload = parseChapterDate(element.select("div.cell-time time").text()!!) + date_upload = parseChapterDate(element.select("div.cell-time time").text()) scanlator = "Toomics" url = element.select("a").attr("onclick") .substringAfter("href='") diff --git a/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt b/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt index cfd03aa46..d99a4f2d5 100644 --- a/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt +++ b/src/all/xinmeitulu/src/eu/kanade/tachiyomi/extension/all/xinmeitulu/Xinmeitulu.kt @@ -65,11 +65,11 @@ class Xinmeitulu : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document) = SManga.create().apply { - setUrlWithoutDomain(document.selectFirst("link[rel=canonical]").attr("abs:href")) + setUrlWithoutDomain(document.selectFirst("link[rel=canonical]")!!.attr("abs:href")) title = document.select(".container > h1").text() description = document.select(".container > *:not(div)").text() status = SManga.COMPLETED - thumbnail_url = document.selectFirst("figure img").attr("abs:data-original") + thumbnail_url = document.selectFirst("figure img")!!.attr("abs:data-original") } // Chapters @@ -77,7 +77,7 @@ class Xinmeitulu : ParsedHttpSource() { override fun chapterListSelector() = "html" override fun chapterFromElement(element: Element) = SChapter.create().apply { - setUrlWithoutDomain(element.selectFirst("link[rel=canonical]").attr("abs:href")) + setUrlWithoutDomain(element.selectFirst("link[rel=canonical]")!!.attr("abs:href")) name = element.select(".container > h1").text() } diff --git a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdFR.kt b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdFR.kt index 9b9ee0f08..8d0015145 100644 --- a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdFR.kt +++ b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdFR.kt @@ -31,7 +31,7 @@ class XkcdFR : Xkcd("https://xkcd.lapin.org", "fr") { } override fun pageListParse(response: Response) = - response.asJsoup().selectFirst(imageSelector).let { + response.asJsoup().selectFirst(imageSelector)!!.let { // no interactive comics here val img = it.child(2).child(0).child(0) diff --git a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdRU.kt b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdRU.kt index 95973e654..1f1d1f8d7 100644 --- a/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdRU.kt +++ b/src/all/xkcd/src/eu/kanade/tachiyomi/extension/all/xkcd/translations/XkcdRU.kt @@ -33,7 +33,7 @@ class XkcdRU : Xkcd("https://xkcd.ru", "ru") { } override fun pageListParse(response: Response) = - response.asJsoup().selectFirst(imageSelector).let { + response.asJsoup().selectFirst(imageSelector)!!.let { // no interactive comics here val img = it.child(5).child(0) diff --git a/src/all/yaoimangaonline/src/eu/kanade/tachiyomi/extension/all/yaoimangaonline/YaoiMangaOnline.kt b/src/all/yaoimangaonline/src/eu/kanade/tachiyomi/extension/all/yaoimangaonline/YaoiMangaOnline.kt index 858b65554..34b045953 100644 --- a/src/all/yaoimangaonline/src/eu/kanade/tachiyomi/extension/all/yaoimangaonline/YaoiMangaOnline.kt +++ b/src/all/yaoimangaonline/src/eu/kanade/tachiyomi/extension/all/yaoimangaonline/YaoiMangaOnline.kt @@ -67,15 +67,15 @@ class YaoiMangaOnline : ParsedHttpSource() { SManga.create().apply { title = element.attr("title") setUrlWithoutDomain(element.attr("href")) - thumbnail_url = element.selectFirst("img").attr("src") + thumbnail_url = element.selectFirst("img")!!.attr("src") } override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.selectFirst(".entry-title").text() + title = document.selectFirst(".entry-title")!!.text() thumbnail_url = document.head() - .selectFirst("meta[property=og:image]").attr("content") - description = document.selectFirst(".entry-content > p") + .selectFirst("meta[property=og:image]")!!.attr("content") + description = document.selectFirst(".entry-content > p")!! .html().replace("
", "\n") genre = document.select(".meta-tags > a").joinToString { it.text() } } @@ -84,7 +84,7 @@ class YaoiMangaOnline : ParsedHttpSource() { override fun chapterFromElement(element: Element) = SChapter.create().apply { - name = element.selectFirst(".acp_title").text() + name = element.selectFirst(".acp_title")!!.text() setUrlWithoutDomain( element.selectFirst("a")?.attr("href") ?: element.baseUri(), ) diff --git a/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt index 2fa2e61da..30fca860b 100644 --- a/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt +++ b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt @@ -96,7 +96,7 @@ class AsgardTeam : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { return SManga.create().apply { - document.select("div.author-info-title").first().let { info -> + document.select("div.author-info-title").first()!!.let { info -> title = info.select("h6").text() } document.select("div.review-author-info").let { info -> diff --git a/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt b/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt index b077474d4..365c37b90 100644 --- a/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt +++ b/src/ar/mangaae/src/eu/kanade/tachiyomi/extension/ar/mangaae/MangaAe.kt @@ -70,7 +70,7 @@ class MangaAe : ParsedHttpSource() { lazysrc } setUrlWithoutDomain(element.select("a:has(img)").attr("href")) - title = element.select("a").last().text() + title = element.select("a").last()!!.text() } override fun latestUpdatesNextPageSelector(): String? = null @@ -100,7 +100,7 @@ class MangaAe : ParsedHttpSource() { // Manga summary page override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val infoElement = document.select("div.indexcontainer").first() + val infoElement = document.select("div.indexcontainer").first()!! title = infoElement.select("h1.EnglishName").text().removeSurrounding("(", ")") author = infoElement.select("div.manga-details-author h4")[0].text() artist = author @@ -133,7 +133,7 @@ class MangaAe : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { val pages = mutableListOf() - document.select("div#showchaptercontainer img")?.forEach { + document.select("div#showchaptercontainer img").forEach { pages.add(Page(pages.size, "", it.attr("src"))) } return pages diff --git a/src/ar/remanga/src/eu/kanade/tachiyomi/extension/ar/remanga/REManga.kt b/src/ar/remanga/src/eu/kanade/tachiyomi/extension/ar/remanga/REManga.kt index 2c85f4ca2..8d873be54 100644 --- a/src/ar/remanga/src/eu/kanade/tachiyomi/extension/ar/remanga/REManga.kt +++ b/src/ar/remanga/src/eu/kanade/tachiyomi/extension/ar/remanga/REManga.kt @@ -93,12 +93,12 @@ class REManga : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - document.select("div.infox").first().let { info -> + document.select("div.infox").first()!!.let { info -> title = info.select("h1").text() } description = document.select("div.desc > div > p").text() genre = document.select("div.spe > span:contains(نوع), div.genre-info > a").joinToString { it.text() } - document.select("div.spe > span:contains(الحالة)")?.first()?.text()?.also { statusText -> + document.select("div.spe > span:contains(الحالة)").first()?.text()?.also { statusText -> when { statusText.contains("مستمر", true) -> status = SManga.ONGOING else -> status = SManga.COMPLETED diff --git a/src/ar/shqqaa/src/eu/kanade/tachiyomi/extension/ar/shqqaa/Shqqaa.kt b/src/ar/shqqaa/src/eu/kanade/tachiyomi/extension/ar/shqqaa/Shqqaa.kt index e5d9130a5..442e79fda 100644 --- a/src/ar/shqqaa/src/eu/kanade/tachiyomi/extension/ar/shqqaa/Shqqaa.kt +++ b/src/ar/shqqaa/src/eu/kanade/tachiyomi/extension/ar/shqqaa/Shqqaa.kt @@ -34,8 +34,8 @@ class Shqqaa : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("data-src") - element.select("a").first().let { + manga.thumbnail_url = element.select("img").first()!!.attr("data-src") + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.attr("title").split(", ")[0] } @@ -53,11 +53,11 @@ class Shqqaa : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a").first().let { + element.select("a").first()!!.let { manga.setUrlWithoutDomain("${it.attr("href").substringBeforeLast('/')}/") - manga.title = element.select("small").first().text().split(", ")[0] + manga.title = element.select("small").first()!!.text().split(", ")[0] } - manga.thumbnail_url = element.select("img").first().attr("data-src") + manga.thumbnail_url = element.select("img").first()!!.attr("data-src") return manga } @@ -82,10 +82,10 @@ class Shqqaa : ParsedHttpSource() { val manga = SManga.create() manga.title = mangaInfo.select("small.text-muted")[1].ownText().split(", ")[0] manga.author = null - val status = mangaInfo.select("span.badge").first().ownText() + val status = mangaInfo.select("span.badge").first()!!.ownText() manga.status = parseStatus(status) manga.genre = null - manga.description = infoElement.first().select(".text-muted").first().ownText() + manga.description = infoElement.first()!!.select(".text-muted").first()!!.ownText() manga.thumbnail_url = mangaInfo.select("img").attr("data-src") return manga } diff --git a/src/ar/teamx/src/eu/kanade/tachiyomi/extension/ar/teamx/TeamX.kt b/src/ar/teamx/src/eu/kanade/tachiyomi/extension/ar/teamx/TeamX.kt index 9e8203777..6e11a4b0c 100644 --- a/src/ar/teamx/src/eu/kanade/tachiyomi/extension/ar/teamx/TeamX.kt +++ b/src/ar/teamx/src/eu/kanade/tachiyomi/extension/ar/teamx/TeamX.kt @@ -45,7 +45,7 @@ class TeamX : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { title = element.select("a").attr("title") - setUrlWithoutDomain(element.select("a").first().attr("href")) + setUrlWithoutDomain(element.select("a").first()!!.attr("href")) thumbnail_url = element.select("img").let { if (it.hasAttr("data-src")) { it.attr("abs:data-src") @@ -92,8 +92,8 @@ class TeamX : ParsedHttpSource() { return SManga.create().apply { val linkElement = element.select("div.info a") title = linkElement.select("h3").text() - setUrlWithoutDomain(linkElement.first().attr("href")) - thumbnail_url = element.select("div.imgu img").first().absUrl("src") + setUrlWithoutDomain(linkElement.first()!!.attr("href")) + thumbnail_url = element.select("div.imgu img").first()!!.absUrl("src") } } @@ -111,8 +111,8 @@ class TeamX : ParsedHttpSource() { return SManga.create().apply { val urlAndText = element.select("div.ms-2 a") title = urlAndText.text() - setUrlWithoutDomain(urlAndText.first().absUrl("href")) - thumbnail_url = element.select("a img").first().absUrl("src") + setUrlWithoutDomain(urlAndText.first()!!.absUrl("href")) + thumbnail_url = element.select("a img").first()!!.absUrl("src") } } @@ -129,7 +129,7 @@ class TeamX : ParsedHttpSource() { description = document.select("div.review-content p").text() } genre = document.select("div.review-author-info a").joinToString { it.text() } - thumbnail_url = document.select("div.text-right img").first().absUrl("src") + thumbnail_url = document.select("div.text-right img").first()!!.absUrl("src") } } @@ -182,7 +182,7 @@ class TeamX : ParsedHttpSource() { } private fun parseChapterDate(date: String): Long { - return kotlin.runCatching { + return runCatching { chapterFormat.parse(date)?.time }.getOrNull() ?: 0 } diff --git a/src/de/mangatube/src/eu/kanade/tachiyomi/extension/de/mangatube/MangaTube.kt b/src/de/mangatube/src/eu/kanade/tachiyomi/extension/de/mangatube/MangaTube.kt index d66af11b4..806236d9b 100644 --- a/src/de/mangatube/src/eu/kanade/tachiyomi/extension/de/mangatube/MangaTube.kt +++ b/src/de/mangatube/src/eu/kanade/tachiyomi/extension/de/mangatube/MangaTube.kt @@ -129,7 +129,7 @@ class MangaTube : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - document.select("div.series-detailed div.row").first().let { info -> + document.select("div.series-detailed div.row").first()!!.let { info -> author = info.select("li:contains(Autor:) a").joinToString { it.text() } artist = info.select("li:contains(Artist:) a").joinToString { it.text() } status = info.select("li:contains(Offiziel)").firstOrNull()?.ownText().toStatus() @@ -170,7 +170,7 @@ class MangaTube : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { - val script = document.select("script:containsData(current_chapter:)").first().data() + val script = document.select("script:containsData(current_chapter:)").first()!!.data() val imagePath = Regex("""img_path: '(.*)'""").find(script)?.groupValues?.get(1) ?: throw Exception("Couldn't find image path") val jsonArray = Regex("""pages: (\[.*]),""").find(script)?.groupValues?.get(1) diff --git a/src/de/wiemanga/src/eu/kanade/tachiyomi/extension/de/wiemanga/WieManga.kt b/src/de/wiemanga/src/eu/kanade/tachiyomi/extension/de/wiemanga/WieManga.kt index aa54a9b07..353b119cd 100644 --- a/src/de/wiemanga/src/eu/kanade/tachiyomi/extension/de/wiemanga/WieManga.kt +++ b/src/de/wiemanga/src/eu/kanade/tachiyomi/extension/de/wiemanga/WieManga.kt @@ -109,7 +109,7 @@ class WieManga : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - element.select(".col1 a").first().let { + element.select(".col1 a").first()!!.let { chapter.setUrlWithoutDomain(it.attr("href")) chapter.name = it.text() } @@ -125,13 +125,13 @@ class WieManga : ParsedHttpSource() { override fun pageListParse(document: Document): List { val pages = mutableListOf() - document.select("select#page").first().select("option").forEach { + document.select("select#page").first()!!.select("option").forEach { pages.add(Page(pages.size, it.attr("value"))) } return pages } override fun imageUrlParse(document: Document): String { - return document.select("img#comicpic").first().attr("abs:src") + return document.select("img#comicpic").first()!!.attr("abs:src") } } diff --git a/src/en/MangaRok/src/eu/kanade/tachiyomi/extension/en/mangarok/MangaRok.kt b/src/en/MangaRok/src/eu/kanade/tachiyomi/extension/en/mangarok/MangaRok.kt index a4fd828a9..9d4e5b3c6 100644 --- a/src/en/MangaRok/src/eu/kanade/tachiyomi/extension/en/mangarok/MangaRok.kt +++ b/src/en/MangaRok/src/eu/kanade/tachiyomi/extension/en/mangarok/MangaRok.kt @@ -52,14 +52,14 @@ class MangaRok : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { setUrlWithoutDomain(element.attr("abs:href")) - title = element.selectFirst(".mtitle").ownText() - thumbnail_url = element.selectFirst("img").attr("abs:data-src") + title = element.selectFirst(".mtitle")!!.ownText() + thumbnail_url = element.selectFirst("img")!!.attr("abs:data-src") genre = element.select(".tag.is-small").joinToString { it.text() } - status = element.selectFirst(".msub").text().substringBefore(" ").toStatus() + status = element.selectFirst(".msub")!!.text().substringBefore(" ").toStatus() } - override fun searchMangaNextPageSelector(): String? = + override fun searchMangaNextPageSelector(): String = ".buttons > a[rel=next]:not([disabled])" // Latest @@ -72,15 +72,15 @@ class MangaRok : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga = searchMangaFromElement(element) - override fun latestUpdatesNextPageSelector(): String? = + override fun latestUpdatesNextPageSelector(): String = searchMangaNextPageSelector() // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("h1.title").text() - thumbnail_url = document.selectFirst("img.athumbnail").attr("abs:data-src") + title = document.selectFirst("h1.title")!!.text() + thumbnail_url = document.selectFirst("img.athumbnail")!!.attr("abs:data-src") - val table = document.selectFirst(".table:not(.is-hoverable)") + val table = document.selectFirst(".table:not(.is-hoverable)")!! artist = table.selectFirst("tr > td:first-child:contains(Artist:) + td > a")?.text() author = table.selectFirst("tr > td:first-child:contains(Author:) + td > a")?.text() @@ -100,11 +100,11 @@ class MangaRok : ParsedHttpSource() { "table.is-hoverable > tbody > tr" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - val a = element.selectFirst("a") + val a = element.selectFirst("a")!! setUrlWithoutDomain(a.attr("abs:href")) name = a.text() - val dateString = element.selectFirst("td:nth-child(2)").text() + val dateString = element.selectFirst("td:nth-child(2)")!!.text() date_upload = dateFormat .parse(dateString) ?.time ?: 0L diff --git a/src/en/aurora/src/eu/kanade/tachiyomi/extension/en/aurora/Aurora.kt b/src/en/aurora/src/eu/kanade/tachiyomi/extension/en/aurora/Aurora.kt index 72770c8c6..77ac26794 100644 --- a/src/en/aurora/src/eu/kanade/tachiyomi/extension/en/aurora/Aurora.kt +++ b/src/en/aurora/src/eu/kanade/tachiyomi/extension/en/aurora/Aurora.kt @@ -15,10 +15,6 @@ import java.lang.Exception import java.text.SimpleDateFormat import java.util.Locale -/** - * @author THE_ORONCO - */ - class Aurora : HttpSource() { override val name = "Aurora" @@ -103,7 +99,7 @@ class Aurora : HttpSource() { */ private fun getChapterStatusForChapter(chapter: Float): Int { val newestPage = client.newCall(GET(baseUrl)).execute().asJsoup() - val postTitle = newestPage.selectFirst(".post-title").text() + val postTitle = newestPage.selectFirst(".post-title")!!.text() // title is ".." val chapterOfNewestPage = postTitle.split(".")[1].toFloat() return if (chapter >= chapterOfNewestPage) SManga.UNKNOWN else SManga.COMPLETED @@ -125,7 +121,7 @@ class Aurora : HttpSource() { ).execute().asJsoup() val imageUrl = singlePageChapterDoc.selectFirst( ".webcomic-media .webcomic-link .attachment-full", - ).attr("src") + )!!.attr("src") val singlePageChapter = Page(0, "", imageUrl) return Observable.just(listOf(singlePageChapter)) @@ -151,10 +147,10 @@ class Aurora : HttpSource() { val chapterBlockElements = chapterOverviewDoc.select(".wp-block-image") val mangasFromChapters = chapterBlockElements .mapIndexed { chapterIndex, chapter -> - val chapterOverviewLink = chapter.selectFirst("a") + val chapterOverviewLink = chapter.selectFirst("a")!! val chapterOverviewUrl = chapterOverviewLink.attr("href") val chapterTitle = "$name - ${chapterOverviewLink.text()}" - val chapterThumbnail = chapter.selectFirst("img").attr("src") + val chapterThumbnail = chapter.selectFirst("img")!!.attr("src") SManga.create().apply { setUrlWithoutDomain(chapterOverviewUrl) diff --git a/src/en/buttsmithy/src/eu/kanade/tachiyomi/extension/en/buttsmithy/Buttsmithy.kt b/src/en/buttsmithy/src/eu/kanade/tachiyomi/extension/en/buttsmithy/Buttsmithy.kt index b64baa65b..a3043b18a 100644 --- a/src/en/buttsmithy/src/eu/kanade/tachiyomi/extension/en/buttsmithy/Buttsmithy.kt +++ b/src/en/buttsmithy/src/eu/kanade/tachiyomi/extension/en/buttsmithy/Buttsmithy.kt @@ -20,12 +20,7 @@ import java.lang.Exception import java.text.SimpleDateFormat import java.util.Locale -/** - * @author THE_ORONCO - */ - class Buttsmithy : HttpSource() { - data class TitleUrlPair(val title: String, val url: String) override val name = "Buttsmithy" @@ -37,9 +32,9 @@ class Buttsmithy : HttpSource() { override val lang = "en" - private final val inCase = "InCase" - private final val alfieTitle = "Alfie" - private final val alfieDateParser = SimpleDateFormat("HH:mm MMMM dd, yyyy", Locale.US) + private val inCase = "InCase" + private val alfieTitle = "Alfie" + private val alfieDateParser = SimpleDateFormat("HH:mm MMMM dd, yyyy", Locale.US) override val supportsLatest: Boolean = false @@ -71,7 +66,7 @@ class Buttsmithy : HttpSource() { allChapters: MutableList = mutableListOf(), ): MutableList { val currentDoc = client.newCall(GET(currentPageUrl, headers)).execute().asJsoup() - val currentPageComicPage = currentDoc.select("#comic img").first() + val currentPageComicPage = currentDoc.select("#comic img").first()!! val chapterTitle = currentPageComicPage.attr("alt") val chapter = SChapter.create().apply { @@ -225,7 +220,7 @@ class Buttsmithy : HttpSource() { } private fun extractChapterTitleFromPageDoc(doc: Document): String { - return doc.select(".comic-chapter a").first().text().lowercase() + return doc.select(".comic-chapter a").first()!!.text().lowercase() } private fun chapterTitleToChapterUrlName(chapTitle: String): String { diff --git a/src/en/clonemanga/src/eu/kanade/tachiyomi/extension/en/clonemanga/CloneManga.kt b/src/en/clonemanga/src/eu/kanade/tachiyomi/extension/en/clonemanga/CloneManga.kt index 2b2d6098d..84a1d17c3 100644 --- a/src/en/clonemanga/src/eu/kanade/tachiyomi/extension/en/clonemanga/CloneManga.kt +++ b/src/en/clonemanga/src/eu/kanade/tachiyomi/extension/en/clonemanga/CloneManga.kt @@ -41,11 +41,11 @@ class CloneManga : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val attr = element.getElementsByClass("comicPreview").attr("style") return SManga.create().apply { - title = element.select("h3").first().text() + title = element.select("h3").first()!!.text() artist = "Dan Kim" author = artist status = SManga.UNKNOWN - url = element.select("a").first().attr("href") + url = element.select("a").first()!!.attr("href") description = element.select("h4").first()?.text() ?: "" thumbnail_url = baseUrl + attr.substring( attr.indexOf("site/themes"), @@ -94,7 +94,7 @@ class CloneManga : ParsedHttpSource() { override fun pageListParse(response: Response): List { val document = response.asJsoup() val imgAbsoluteUrl = document.getElementsByClass("subsectionContainer")[0] - .select("img").first().absUrl("src") + .select("img").first()!!.absUrl("src") // List of pages will always contain only one page return listOf(Page(1, "", imgAbsoluteUrl)) } diff --git a/src/en/comicastle/src/eu/kanade/tachiyomi/extension/en/comicastle/Comicastle.kt b/src/en/comicastle/src/eu/kanade/tachiyomi/extension/en/comicastle/Comicastle.kt index 2731d7474..18c534ee6 100644 --- a/src/en/comicastle/src/eu/kanade/tachiyomi/extension/en/comicastle/Comicastle.kt +++ b/src/en/comicastle/src/eu/kanade/tachiyomi/extension/en/comicastle/Comicastle.kt @@ -48,7 +48,7 @@ class Comicastle : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { title = element.select("p").text() - setUrlWithoutDomain(element.select("a").first().attr("href")) + setUrlWithoutDomain(element.select("a").first()!!.attr("href")) thumbnail_url = element.select("img").attr("data-src") } } diff --git a/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt b/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt index e9c43abba..30c15f8d0 100644 --- a/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt +++ b/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt @@ -130,13 +130,13 @@ class ComicExtra : ParsedHttpSource() { override fun chapterListSelector() = "table.table > tbody#list > tr:has(td)" override fun chapterFromElement(element: Element): SChapter { - val urlEl = element.select("td:nth-of-type(1) > a").first() + val urlEl = element.select("td:nth-of-type(1) > a").first()!! val dateEl = element.select("td:nth-of-type(2)") val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlEl.attr("href").replace(" ", "%20")) chapter.name = urlEl.text() - chapter.date_upload = dateEl.text()?.let { dateParse(it) } ?: 0 + chapter.date_upload = dateParse(dateEl.text()) return chapter } diff --git a/src/en/darklegacycomics/src/eu/kanade/tachiyomi/extension/en/darklegacycomics/DarkLegacyComics.kt b/src/en/darklegacycomics/src/eu/kanade/tachiyomi/extension/en/darklegacycomics/DarkLegacyComics.kt index 4c99d6603..037503665 100644 --- a/src/en/darklegacycomics/src/eu/kanade/tachiyomi/extension/en/darklegacycomics/DarkLegacyComics.kt +++ b/src/en/darklegacycomics/src/eu/kanade/tachiyomi/extension/en/darklegacycomics/DarkLegacyComics.kt @@ -23,9 +23,9 @@ class DarkLegacyComics : HttpSource() { override fun chapterListParse(response: Response) = response.asJsoup().select(".archive_link").map { - val index = it.selectFirst(".index").text() - val date = it.selectFirst(".date").ownText() - val title = it.selectFirst(".name").text() + val index = it.selectFirst(".index")!!.text() + val date = it.selectFirst(".date")!!.ownText() + val title = it.selectFirst(".name")!!.text() val characters = it.select(".characters").text() SChapter.create().apply { url = "/$index" diff --git a/src/en/digitalcomicmuseum/src/eu/kanade/tachiyomi/extension/en/digitalcomicmuseum/DigitalComicMuseum.kt b/src/en/digitalcomicmuseum/src/eu/kanade/tachiyomi/extension/en/digitalcomicmuseum/DigitalComicMuseum.kt index 6976fd6f3..5c29e18ad 100644 --- a/src/en/digitalcomicmuseum/src/eu/kanade/tachiyomi/extension/en/digitalcomicmuseum/DigitalComicMuseum.kt +++ b/src/en/digitalcomicmuseum/src/eu/kanade/tachiyomi/extension/en/digitalcomicmuseum/DigitalComicMuseum.kt @@ -59,7 +59,7 @@ class DigitalComicMuseum() : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - val baseElement = element.selectFirst("td > a") + val baseElement = element.selectFirst("td > a")!! manga.setUrlWithoutDomain(baseElement.attr("abs:href")) manga.title = baseElement.text() return manga @@ -88,12 +88,12 @@ class DigitalComicMuseum() : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() val elements = document.select(".tableborder") - manga.title = elements.first().select("#catname").text() - manga.setUrlWithoutDomain(elements.first().select("#catname > a").attr("abs:href")) - manga.thumbnail_url = elements.first().selectFirst("table img").attr("abs:src") + manga.title = elements.first()!!.select("#catname").text() + manga.setUrlWithoutDomain(elements.first()!!.select("#catname > a").attr("abs:href")) + manga.thumbnail_url = elements.first()!!.selectFirst("table img")!!.attr("abs:src") elements.forEach { when (it.select("#catname").text()) { - "Description" -> manga.description = it.selectFirst("table").text() + "Description" -> manga.description = it.selectFirst("table")!!.text() } } return manga diff --git a/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt b/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt index e8e1f5160..92d7e321d 100644 --- a/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt +++ b/src/en/dilbert/src/eu/kanade/tachiyomi/extension/en/dilbert/Dilbert.kt @@ -51,9 +51,9 @@ class Dilbert : ParsedHttpSource() { Observable.just(manga.apply { initialized = true })!! override fun chapterFromElement(element: Element) = SChapter.create().apply { - val date = element.first(".comic-title-date").text() - url = element.first(".img-comic-link").attr("href") - name = element.first(".comic-title-name").text().ifBlank { date } + val date = element.first(".comic-title-date")!!.text() + url = element.first(".img-comic-link")!!.attr("href") + name = element.first(".comic-title-name")!!.text().ifBlank { date } date_upload = dateFormat.parse(date)?.time ?: 0L } @@ -68,7 +68,7 @@ class Dilbert : ParsedHttpSource() { override fun fetchPageList(chapter: SChapter) = Observable.just(listOf(Page(0, chapter.url)))!! - override fun imageUrlParse(document: Document) = document.first(".img-comic").attr("src")!! + override fun imageUrlParse(document: Document): String = document.first(".img-comic")!!.attr("src") private fun chapterListRequest(manga: SManga, page: Int) = GET("$baseUrl/search_results?year=${manga.url}&page=$page&sort=date_desc", headers) diff --git a/src/en/doujins/src/eu/kanade/tachiyomi/extension/en/doujins/Doujins.kt b/src/en/doujins/src/eu/kanade/tachiyomi/extension/en/doujins/Doujins.kt index de752e32c..dd3e85a47 100644 --- a/src/en/doujins/src/eu/kanade/tachiyomi/extension/en/doujins/Doujins.kt +++ b/src/en/doujins/src/eu/kanade/tachiyomi/extension/en/doujins/Doujins.kt @@ -101,10 +101,10 @@ class Doujins : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() return SManga.create().apply { - title = document.select(".folder-title a").last().text() + title = document.select(".folder-title a").last()!!.text() artist = document.select(".gallery-artist a").joinToString { it.text() } author = artist - genre = document.select(".tag-area").first().select("a").joinToString { it.text() } + genre = document.select(".tag-area").first()!!.select("a").joinToString { it.text() } } } @@ -148,7 +148,8 @@ class Doujins : HttpSource() { SManga.create().apply { setUrlWithoutDomain(it.attr("href")) title = it.select("div.title .text").text() - artist = it.parent().nextElementSibling().select(".single-line strong")?.last()?.text()?.substringAfter("Artist: ") + artist = it.parent()!!.nextElementSibling()!!.select(".single-line strong").last() + ?.text()?.substringAfter("Artist: ") author = artist thumbnail_url = it.select("img").attr("srcset") } diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt index 380eedbe5..0bf0dc5cf 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt @@ -27,7 +27,7 @@ class DynastyChapters : DynastyScans() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - manga.thumbnail_url = document.select("img").last().absUrl("src") + manga.thumbnail_url = document.select("img").last()!!.absUrl("src") manga.title = document.select("h3 b").text() manga.status = SManga.COMPLETED val artistAuthorElements = document.select("a[href*=author]") diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt index bb1f6a521..d4c9014a7 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyDoujins.kt @@ -37,8 +37,8 @@ class DynastyDoujins : DynastyScans() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create().apply { - title = document.selectFirst("div#main > h2 > b").text().substringAfter("Doujins › ") - description = document.select("div#main > div.description")?.text() + title = document.selectFirst("div#main > h2 > b")!!.text().substringAfter("Doujins › ") + description = document.select("div#main > div.description").text() thumbnail_url = document.select("a.thumbnail img").firstOrNull()?.attr("abs:src") ?.replace("/thumb/", "/medium/") } diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt index 9888cd732..f43dd81c1 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt @@ -107,8 +107,8 @@ abstract class DynastyScans : ParsedHttpSource() { } protected fun parseHeader(document: Document, manga: SManga): Boolean { - manga.title = document.selectFirst("div.tags > h2.tag-title > b").text() - val elements = document.selectFirst("div.tags > h2.tag-title").getElementsByTag("a") + manga.title = document.selectFirst("div.tags > h2.tag-title > b")!!.text() + val elements = document.selectFirst("div.tags > h2.tag-title")!!.getElementsByTag("a") if (elements.isEmpty()) { return false } @@ -200,7 +200,7 @@ abstract class DynastyScans : ParsedHttpSource() { override fun pageListParse(document: Document): List { return try { - val imageUrl = document.select("script").last().html().substringAfter("var pages = [").substringBefore("];") + val imageUrl = document.select("script").last()!!.html().substringAfter("var pages = [").substringBefore("];") json.parseToJsonElement("[$imageUrl]").jsonArray.mapIndexed { index, it -> Page(index, imageUrl = "$baseUrl${it.jsonObject["image"]!!.jsonPrimitive.content}") @@ -245,19 +245,9 @@ abstract class DynastyScans : ParsedHttpSource() { return (0..this.lastIndex).firstOrNull { this[it].contains(partial) } ?: -1 } - - fun getItem(partial: String): String { - return (0..this.lastIndex) - .firstOrNull { super.get(it).contains(partial) } - ?.let { super.get(it) } - ?: "" - } } - class Validate(_isManga: Boolean, _pos: Int) { - val isManga = _isManga - val pos = _pos - } + data class Validate(val _isManga: Boolean, val _pos: Int) override fun popularMangaNextPageSelector() = "" override fun latestUpdatesSelector() = "" diff --git a/src/en/earlymanga/src/eu/kanade/tachiyomi/extension/en/earlymanga/EarlyManga.kt b/src/en/earlymanga/src/eu/kanade/tachiyomi/extension/en/earlymanga/EarlyManga.kt index 18c74eb9d..6a9255811 100644 --- a/src/en/earlymanga/src/eu/kanade/tachiyomi/extension/en/earlymanga/EarlyManga.kt +++ b/src/en/earlymanga/src/eu/kanade/tachiyomi/extension/en/earlymanga/EarlyManga.kt @@ -138,7 +138,7 @@ class EarlyManga : ParsedHttpSource() { var next = allChapters repeat(10) { if (next.selectFirst(str2) != null) { - val current = next.select(str5 ?: str3)?.text() ?: str4 + val current = next.select(str5 ?: str3).text() ?: str4 next.addClass(current) } else { next = next.parent() @@ -172,7 +172,7 @@ class EarlyManga : ParsedHttpSource() { val crypt4 = IvParameterSpec(Base64.decode("totally not some plaintxt".toByteArray(Charsets.UTF_8), Base64.DEFAULT)) crypt2.init(Cipher.DECRYPT_MODE, crypt3, crypt4) val str1 = String(crypt2.doFinal(Base64.decode("ckFyOt1FSclkqG4dG2+mbw==".toByteArray(Charsets.UTF_8), Base64.DEFAULT))) - val str2 = element.selectFirst(str1) + val str2 = element.selectFirst(str1)!! setUrlWithoutDomain(str2.attr("href")) name = str2.text() diff --git a/src/en/eggporncomics/src/eu/kanade/tachiyomi/extension/en/eggporncomics/Eggporncomics.kt b/src/en/eggporncomics/src/eu/kanade/tachiyomi/extension/en/eggporncomics/Eggporncomics.kt index 23c5be394..26071cc80 100644 --- a/src/en/eggporncomics/src/eu/kanade/tachiyomi/extension/en/eggporncomics/Eggporncomics.kt +++ b/src/en/eggporncomics/src/eu/kanade/tachiyomi/extension/en/eggporncomics/Eggporncomics.kt @@ -126,7 +126,7 @@ class Eggporncomics : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - thumbnail_url = document.select(pageListSelector).first().toFullSizeImage() + thumbnail_url = document.select(pageListSelector).first()!!.toFullSizeImage() description = document.select("div.links ul").joinToString("\n") { element -> element.select("a") .joinToString(prefix = element.select("span").text().replace(descriptionPrefixRegex, ": ")) { it.text() } diff --git a/src/en/explosm/src/eu/kanade/tachiyomi/extension/en/explosm/Explosm.kt b/src/en/explosm/src/eu/kanade/tachiyomi/extension/en/explosm/Explosm.kt index b8f8160f8..1c73c628c 100644 --- a/src/en/explosm/src/eu/kanade/tachiyomi/extension/en/explosm/Explosm.kt +++ b/src/en/explosm/src/eu/kanade/tachiyomi/extension/en/explosm/Explosm.kt @@ -33,7 +33,7 @@ class Explosm : HttpSource() { return SManga.create().apply { initialized = true title = "C&H ${element.attr("id").substringAfter("panel")}" // year - setUrlWithoutDomain(element.select("li a").first().attr("href")) // January + setUrlWithoutDomain(element.select("li a").first()!!.attr("href")) // January thumbnail_url = "https://vhx.imgix.net/vitalyuncensored/assets/13ea3806-5ebf-4987-bcf1-82af2b689f77/S2E4_Still1.jpg" } } @@ -67,7 +67,7 @@ class Explosm : HttpSource() { // Details override fun mangaDetailsParse(response: Response): SManga { - return createManga(response.asJsoup().select("div.content.active").first()) + return createManga(response.asJsoup().select("div.content.active").first()!!) } // Chapters diff --git a/src/en/grrlpower/src/eu/kanade/tachiyomi/extension/en/grrlpower/GrrlPower.kt b/src/en/grrlpower/src/eu/kanade/tachiyomi/extension/en/grrlpower/GrrlPower.kt index ec7570d59..da7b93355 100644 --- a/src/en/grrlpower/src/eu/kanade/tachiyomi/extension/en/grrlpower/GrrlPower.kt +++ b/src/en/grrlpower/src/eu/kanade/tachiyomi/extension/en/grrlpower/GrrlPower.kt @@ -75,7 +75,7 @@ class GrrlPower( var num = 0 return response.asJsoup().getElementsByClass("archive-date").map { val date = dateFormat.parse("${it.text()} $year") - val link = it.nextElementSibling().child(0) + val link = it.nextElementSibling()!!.child(0) SChapter.create().apply { name = link.text() setUrlWithoutDomain(link.attr("href")) @@ -90,7 +90,7 @@ class GrrlPower( Page( 0, response.request.url.toString(), - response.asJsoup().selectFirst("div#comic img").absUrl("src"), + response.asJsoup().selectFirst("div#comic img")!!.absUrl("src"), ), ) } diff --git a/src/en/gunnerkriggcourt/src/eu/kanade/tachiyomi/extension/en/gunnerkriggcourt/GunnerkriggCourt.kt b/src/en/gunnerkriggcourt/src/eu/kanade/tachiyomi/extension/en/gunnerkriggcourt/GunnerkriggCourt.kt index 5379a3568..7f5602fb0 100644 --- a/src/en/gunnerkriggcourt/src/eu/kanade/tachiyomi/extension/en/gunnerkriggcourt/GunnerkriggCourt.kt +++ b/src/en/gunnerkriggcourt/src/eu/kanade/tachiyomi/extension/en/gunnerkriggcourt/GunnerkriggCourt.kt @@ -57,7 +57,7 @@ class GunnerkriggCourt : ParsedHttpSource() { return SChapter.create().apply { chapter_number = element.attr("value").toFloat() setUrlWithoutDomain("/?p=" + element.attr("value")) - name = element.parent().previousElementSibling().text() + " (" + chapter_number.toInt() + ")" + name = element.parent()!!.previousElementSibling()!!.text() + " (" + chapter_number.toInt() + ")" // date_upload // Find by using hovertext above "Tom" on actual comic page } } @@ -72,7 +72,7 @@ class GunnerkriggCourt : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not used") - override fun searchMangaNextPageSelector(): String? = throw Exception("Not used") + override fun searchMangaNextPageSelector(): String = throw Exception("Not used") override fun searchMangaSelector(): String = throw Exception("Not used") @@ -80,13 +80,13 @@ class GunnerkriggCourt : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used") - override fun popularMangaNextPageSelector(): String? = throw Exception("Not used") + override fun popularMangaNextPageSelector(): String = throw Exception("Not used") override fun popularMangaFromElement(element: Element): SManga = throw Exception("Not used") override fun mangaDetailsParse(document: Document): SManga = throw Exception("Not used") - override fun latestUpdatesNextPageSelector(): String? = throw Exception("Not used") + override fun latestUpdatesNextPageSelector(): String = throw Exception("Not used") override fun latestUpdatesFromElement(element: Element): SManga = throw Exception("Not used") diff --git a/src/en/gwtb/src/eu/kanade/tachiyomi/extension/en/gwtb/GWTB.kt b/src/en/gwtb/src/eu/kanade/tachiyomi/extension/en/gwtb/GWTB.kt index 9400cb296..b4cef53c9 100644 --- a/src/en/gwtb/src/eu/kanade/tachiyomi/extension/en/gwtb/GWTB.kt +++ b/src/en/gwtb/src/eu/kanade/tachiyomi/extension/en/gwtb/GWTB.kt @@ -29,8 +29,7 @@ class GWTB : HttpSource() { } override fun pageListParse(response: Response) = - response.asJsoup().selectFirst(".comic_title + img") - .let { listOf(Page(0, "", it.absUrl("src"))) } + listOf(Page(0, "", response.asJsoup().selectFirst(".comic_title + img")!!.absUrl("src"))) override fun fetchPopularManga(page: Int): Observable = SManga.create().apply { diff --git a/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt b/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt index 57f96e8e0..f317b2733 100644 --- a/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt +++ b/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt @@ -156,14 +156,14 @@ class HBrowse : ParsedHttpSource(), ConfigurableSource { override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - with(document.select("div#main").first()) { - title = select("td:contains(title) + td.listLong").first().text() + with(document.select("div#main").first()!!) { + title = select("td:contains(title) + td.listLong").first()!!.text() artist = select("td:contains(artist) + td.listLong").text() genre = select("td:contains(genre) + td.listLong").joinToString { it.text() } description = select("tr:has(.listLong)") .filterNot { it.select("td:first-child").text().contains(Regex("""(Title|Artist|Genre)""")) } .joinToString("\n") { tr -> tr.select("td").joinToString(": ") { it.text() } } - thumbnail_url = select("tbody img").first().attr("abs:src") + thumbnail_url = select("tbody img").first()!!.attr("abs:src") } } } @@ -186,9 +186,9 @@ class HBrowse : ParsedHttpSource(), ConfigurableSource { // Pages override fun pageListParse(document: Document): List { - val script = document.select("script:containsData(imageDir)").first().data() - val imageDir = Regex("""imageDir\s*=\s*"(.+?)";""").find(script)?.groupValues!!.get(1) - var images = json.decodeFromString>(Regex("""list\s*=\s*(\[.+?]);""").find(script)?.groupValues!!.get(1)) + val script = document.select("script:containsData(imageDir)").first()!!.data() + val imageDir = Regex("""imageDir\s*=\s*"(.+?)";""").find(script)?.groupValues!![1] + var images = json.decodeFromString>(Regex("""list\s*=\s*(\[.+?]);""").find(script)?.groupValues!![1]) images = images.subList(0, images.size - 2) return images.mapIndexed { index, element -> Page(index, "", baseUrl + imageDir + element) } } diff --git a/src/en/hentai2read/src/eu/kanade/tachiyomi/extension/en/hentai2read/Hentai2Read.kt b/src/en/hentai2read/src/eu/kanade/tachiyomi/extension/en/hentai2read/Hentai2Read.kt index 99308183e..4471d6087 100644 --- a/src/en/hentai2read/src/eu/kanade/tachiyomi/extension/en/hentai2read/Hentai2Read.kt +++ b/src/en/hentai2read/src/eu/kanade/tachiyomi/extension/en/hentai2read/Hentai2Read.kt @@ -125,7 +125,7 @@ class Hentai2Read : ParsedHttpSource() { // If the user wants to search by a sort order other than alphabetical, we have to make another call private fun parseSearch(response: Response, page: Int, sortOrder: String?): MangasPage { val document = if (page == 1 && sortOrder != null) { - response.asJsoup().select("li.dropdown li:contains($sortOrder) a").first().attr("abs:href") + response.asJsoup().select("li.dropdown li:contains($sortOrder) a").first()!!.attr("abs:href") .let { client.newCall(GET(it, headers)).execute().asJsoup() } } else { response.asJsoup() @@ -154,16 +154,16 @@ class Hentai2Read : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("ul.list-simple-mini").first() + val infoElement = document.select("ul.list-simple-mini").first()!! val manga = SManga.create() - manga.author = infoElement.select("li:contains(Author) > a")?.text() - manga.artist = infoElement.select("li:contains(Artist) > a")?.text() + manga.author = infoElement.select("li:contains(Author) > a").text() + manga.artist = infoElement.select("li:contains(Artist) > a").text() manga.genre = infoElement.select("li:contains(Category) > a, li:contains(Content) > a").joinToString(", ") { it.text() } manga.description = buildDescription(infoElement) - manga.status = infoElement.select("li:contains(Status) > a")?.text().orEmpty().let { parseStatus(it) } - manga.thumbnail_url = document.select("a#js-linkNext > img")?.attr("src") - manga.title = document.select("h3.block-title > a").first().ownText().trim() + manga.status = infoElement.select("li:contains(Status) > a").text().orEmpty().let { parseStatus(it) } + manga.thumbnail_url = document.select("a#js-linkNext > img").attr("src") + manga.title = document.select("h3.block-title > a").first()!!.ownText().trim() return manga } @@ -171,7 +171,7 @@ class Hentai2Read : ParsedHttpSource() { val topDescriptions = listOf( Pair( "Alternative Title", - infoElement.select("li").first().text().let { + infoElement.select("li").first()!!.text().let { if (it.trim() == "-") { emptyList() } else { @@ -181,7 +181,7 @@ class Hentai2Read : ParsedHttpSource() { ), Pair( "Storyline", - listOf(infoElement.select("li:contains(Storyline) > p")?.text()), + listOf(infoElement.select("li:contains(Storyline) > p").text()), ), ) @@ -192,7 +192,7 @@ class Hentai2Read : ParsedHttpSource() { "Language", ).map { it to infoElement.select("li:contains($it) a").map { v -> v.text() } } .let { topDescriptions + it } // start with topDescriptions - .filter { !it.second.isNullOrEmpty() && it.second[0] != "-" } + .filter { !it.second.isEmpty() && it.second[0] != "-" } .map { "${it.first}:\n${it.second.joinToString()}" } return descriptions.joinToString("\n\n") @@ -209,7 +209,7 @@ class Hentai2Read : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { return SChapter.create().apply { setUrlWithoutDomain(element.attr("href")) - var time = element.select("div > small").text().substringAfter("about").substringBefore("ago") + val time = element.select("div > small").text().substringAfter("about").substringBefore("ago") name = element.ownText().trim() if (time != "") { date_upload = parseChapterDate(time) diff --git a/src/en/hentaifox/src/eu/kanade/tachiyomi/extension/en/hentaifox/HentaiFox.kt b/src/en/hentaifox/src/eu/kanade/tachiyomi/extension/en/hentaifox/HentaiFox.kt index 95cf80f21..2b07eb4bb 100644 --- a/src/en/hentaifox/src/eu/kanade/tachiyomi/extension/en/hentaifox/HentaiFox.kt +++ b/src/en/hentaifox/src/eu/kanade/tachiyomi/extension/en/hentaifox/HentaiFox.kt @@ -46,7 +46,7 @@ class HentaiFox : ParsedHttpSource() { title = it.text() setUrlWithoutDomain(it.attr("href")) } - thumbnail_url = element.select("img").first().attr("abs:src") + thumbnail_url = element.select("img").first()!!.attr("abs:src") } } diff --git a/src/en/hiveworks/src/eu/kanade/tachiyomi/extension/en/hiveworks/Hiveworks.kt b/src/en/hiveworks/src/eu/kanade/tachiyomi/extension/en/hiveworks/Hiveworks.kt index e2cff62f3..cd23d0779 100644 --- a/src/en/hiveworks/src/eu/kanade/tachiyomi/extension/en/hiveworks/Hiveworks.kt +++ b/src/en/hiveworks/src/eu/kanade/tachiyomi/extension/en/hiveworks/Hiveworks.kt @@ -39,7 +39,7 @@ class Hiveworks : ParsedHttpSource() { .readTimeout(1, TimeUnit.MINUTES) .retryOnConnectionFailure(true) .followRedirects(true) - .build()!! + .build() // Popular @@ -51,7 +51,7 @@ class Hiveworks : ParsedHttpSource() { val document = response.asJsoup() val mangas = document.select(popularMangaSelector()).filterNot { - val url = it.select("a.comiclink").first().attr("abs:href") + val url = it.select("a.comiclink").first()!!.attr("abs:href") url.contains("sparklermonthly.com") || url.contains("explosm.net") // Filter Unsupported Comics }.map { element -> popularMangaFromElement(element) @@ -107,7 +107,7 @@ class Hiveworks : ParsedHttpSource() { val url = response.request.url.toString() val document = response.asJsoup() - val selectManga = document.select(searchMangaSelector()) + val selectManga = document.select(searchMangaSelector()).toList() val mangas = when { url.endsWith("localSearch") -> { selectManga.filter { it.text().contains(searchQuery, true) }.map { element -> searchMangaFromElement(element) } @@ -134,14 +134,14 @@ class Hiveworks : ParsedHttpSource() { author = element.select("div.header").text().substringAfter("by").trim() artist = author description = element.select("div.description").text().trim() - url = element.select("a").first().attr("href") + url = element.select("a").first()!!.attr("href") } // Common private fun mangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.url = element.select("a.comiclink").first().attr("abs:href") + manga.url = element.select("a.comiclink").first()!!.attr("abs:href") manga.title = element.select("h1").text().trim() manga.thumbnail_url = element.select("img").attr("abs:src") manga.artist = element.select("h2").text().removePrefix("by").trim() @@ -168,7 +168,7 @@ class Hiveworks : ParsedHttpSource() { private fun mangaDetailsParse(response: Response, url: String): SManga { val document = response.asJsoup() return document.select(popularMangaSelector()) - .firstOrNull { url == it.select("a.comiclink").first().attr("abs:href") } + .firstOrNull { url == it.select("a.comiclink").first()!!.attr("abs:href") } ?.let { mangaFromElement(it) } ?: SManga.create() } @@ -239,7 +239,7 @@ class Hiveworks : ParsedHttpSource() { val document = response.asJsoup() val pages = mutableListOf() - document.select("div#cc-comicbody img")?.forEach { + document.select("div#cc-comicbody img").forEach { pages.add(Page(pages.size, "", it.attr("src"))) } diff --git a/src/en/irovedout/src/eu/kanade/tachiyomi/extension/en/irovedout/IRovedOut.kt b/src/en/irovedout/src/eu/kanade/tachiyomi/extension/en/irovedout/IRovedOut.kt index 967f77f7f..92c079696 100644 --- a/src/en/irovedout/src/eu/kanade/tachiyomi/extension/en/irovedout/IRovedOut.kt +++ b/src/en/irovedout/src/eu/kanade/tachiyomi/extension/en/irovedout/IRovedOut.kt @@ -48,11 +48,11 @@ class IRovedOut : HttpSource() { val bookPage = client.newCall(GET(bookUrl, headers)).execute().asJsoup() val chapters = bookPage.select(".comic-archive-chapter-wrap") chapters.map { - val chapterWrap = it.selectFirst(".comic-archive-chapter-wrap") + val chapterWrap = it.selectFirst(".comic-archive-chapter-wrap")!! SChapter.create().apply { - name = "Book $bookNumber: ${chapterWrap.selectFirst(".comic-archive-chapter").text()}" - url = chapterWrap.selectFirst(".comic-archive-title > a").attr("href") - date_upload = dateFormat.parse(chapterWrap.select(".comic-archive-date").last().text())?.time ?: 0L + name = "Book $bookNumber: ${chapterWrap.selectFirst(".comic-archive-chapter")!!.text()}" + url = chapterWrap.selectFirst(".comic-archive-title > a")!!.attr("href") + date_upload = dateFormat.parse(chapterWrap.select(".comic-archive-date").last()!!.text())?.time ?: 0L chapter_number = chapterCounter++ } } @@ -62,7 +62,7 @@ class IRovedOut : HttpSource() { override fun fetchImageUrl(page: Page): Observable { val comicPage = client.newCall(GET(page.url, headers)).execute().asJsoup() - val imageUrl = comicPage.selectFirst("#comic img").attr("src") + val imageUrl = comicPage.selectFirst("#comic img")!!.attr("src") return Observable.just(imageUrl) } @@ -83,7 +83,7 @@ class IRovedOut : HttpSource() { val bookNumber = match.groups["bookNumber"]!!.value.toInt() val title = match.groups["chapterTitle"]!!.value val bookPage = client.newCall(GET(archiveUrl + if (bookNumber != 1) "-book-$bookNumber" else "", headers)).execute().asJsoup() - val chapterWrap = bookPage.select(".comic-archive-chapter-wrap").find { it.selectFirst(".comic-archive-chapter").text() == title } + val chapterWrap = bookPage.select(".comic-archive-chapter-wrap").find { it.selectFirst(".comic-archive-chapter")!!.text() == title } val pageUrls = chapterWrap?.select(".comic-archive-list-wrap .comic-archive-title > a")?.map { it.attr("href") } ?: return Observable.just(listOf()) val pages = pageUrls.mapIndexed { pageIndex, pageUrl -> Page(pageIndex, pageUrl) diff --git a/src/en/keenspot/src/eu/kanade/tachiyomi/extension/en/keenspot/TwoKinds.kt b/src/en/keenspot/src/eu/kanade/tachiyomi/extension/en/keenspot/TwoKinds.kt index a06b87af3..88822af5e 100644 --- a/src/en/keenspot/src/eu/kanade/tachiyomi/extension/en/keenspot/TwoKinds.kt +++ b/src/en/keenspot/src/eu/kanade/tachiyomi/extension/en/keenspot/TwoKinds.kt @@ -92,7 +92,7 @@ class TwoKinds : HttpSource() { data class TwoKindsPage(val url: String, val name: String) - fun chapterListParse(response: Response, manga: SManga): List { + private fun chapterListParse(response: Response, manga: SManga): List { val document = response.asJsoup() val pages = document.select(".chapter-links") @@ -100,7 +100,7 @@ class TwoKinds : HttpSource() { .map { a -> // /comic/1185halloween/ -> 1185halloween val urlPart = a.attr("href").split("/")[2] - val name = a.selectFirst("span").text() + val name = a.selectFirst("span")!!.text() TwoKindsPage(urlPart, name) } @@ -144,7 +144,7 @@ class TwoKinds : HttpSource() { .map { a -> // /comic/1185halloween/ -> 1185halloween val urlPart = a.attr("href").split("/")[2] - val name = a.selectFirst("span").text() + val name = a.selectFirst("span")!!.text() TwoKindsPage(urlPart, name) } @@ -167,7 +167,7 @@ class TwoKinds : HttpSource() { override fun imageUrlParse(response: Response): String { val document = response.asJsoup() - return document.select("#content article img").first().attr("src") + return document.select("#content article img").first()!!.attr("src") } override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable = throw Exception("Search functionality is not available.") diff --git a/src/en/killsixbilliondemons/src/eu/kanade/tachiyomi/extension/en/killsixbilliondemons/KillSixBillionDemons.kt b/src/en/killsixbilliondemons/src/eu/kanade/tachiyomi/extension/en/killsixbilliondemons/KillSixBillionDemons.kt index f8ec35090..38e57c00e 100644 --- a/src/en/killsixbilliondemons/src/eu/kanade/tachiyomi/extension/en/killsixbilliondemons/KillSixBillionDemons.kt +++ b/src/en/killsixbilliondemons/src/eu/kanade/tachiyomi/extension/en/killsixbilliondemons/KillSixBillionDemons.kt @@ -14,13 +14,6 @@ import rx.Observable import java.text.SimpleDateFormat import java.util.Locale -/** - * original creator: - * @author Aria Moradi - * fixed some bugs and added title pages: - * @author THE_ORONCO - */ - class KillSixBillionDemons : HttpSource() { override val name = "KillSixBillionDemons" @@ -97,11 +90,7 @@ class KillSixBillionDemons : HttpSource() { private fun fetchThumbnailUrl(bookOverviewUrl: String): String { val overviewDoc = client.newCall(GET(bookOverviewUrl + pagesOrder, headers)).execute().asJsoup() - return overviewDoc.selectFirst(".comic-thumbnail-in-archive a img").attr("src") - } - - private fun String.lowercase(): String { - return this.lowercase(Locale.ROOT) + return overviewDoc.selectFirst(".comic-thumbnail-in-archive a img")!!.attr("src") } /** diff --git a/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt b/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt index 3b1da4d1d..3dc054b28 100644 --- a/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt +++ b/src/en/latisbooks/src/eu/kanade/tachiyomi/extension/en/latisbooks/Latisbooks.kt @@ -130,7 +130,7 @@ class Latisbooks : HttpSource() { // Add text above/below the image as xkcd-esque text pages after the image itself pages.addAll( blocks.select("div.html-block") - .map { it.select("div.sqs-block-content").first() } + .map { it.select("div.sqs-block-content").first()!! } // Some pages have empty html blocks (e.g. Page 1), so ignore them .filter { it.childrenSize() > 0 } .mapIndexed { i, it -> Page(i + numImages, "", wordWrap(it.text()).image()) } diff --git a/src/en/lemonfont/src/eu/kanade/tachiyomi/extension/en/lemonfont/LemonFont.kt b/src/en/lemonfont/src/eu/kanade/tachiyomi/extension/en/lemonfont/LemonFont.kt index 5b80b4ed1..cc2ad1cdd 100644 --- a/src/en/lemonfont/src/eu/kanade/tachiyomi/extension/en/lemonfont/LemonFont.kt +++ b/src/en/lemonfont/src/eu/kanade/tachiyomi/extension/en/lemonfont/LemonFont.kt @@ -43,7 +43,7 @@ class LemonFont : ParsedHttpSource() { override fun mangaDetailsParse(document: Document) = SManga.create().apply { val seriesUrl: String = document.location() val homePage: Document = client.newCall(GET("$baseUrl/comics/", headers)).execute().asJsoup() - val element: Element = homePage.select("div.comic-collection > a[abs:href=$seriesUrl]").first() + val element: Element = homePage.select("div.comic-collection > a[abs:href=$seriesUrl]").first()!! thumbnail_url = element.select("img").attr("abs:src") status = getStatus(element) @@ -52,7 +52,7 @@ class LemonFont : ParsedHttpSource() { private fun getStatus(element: Element) = when { element.attr("href").contains("http") -> SManga.LICENSED - element.select("p").first().id() == "tag-ongoing" -> SManga.ONGOING + element.select("p").first()!!.id() == "tag-ongoing" -> SManga.ONGOING else -> SManga.COMPLETED } diff --git a/src/en/loadingartist/src/eu/kanade/tachiyomi/extension/en/loadingartist/LoadingArtist.kt b/src/en/loadingartist/src/eu/kanade/tachiyomi/extension/en/loadingartist/LoadingArtist.kt index 7f30a0da4..c2ad29219 100644 --- a/src/en/loadingartist/src/eu/kanade/tachiyomi/extension/en/loadingartist/LoadingArtist.kt +++ b/src/en/loadingartist/src/eu/kanade/tachiyomi/extension/en/loadingartist/LoadingArtist.kt @@ -109,7 +109,7 @@ class LoadingArtist : HttpSource() { // Pages override fun pageListParse(response: Response): List { - val imageUrl = response.asJsoup().selectFirst("div.main-image-container img") + val imageUrl = response.asJsoup().selectFirst("div.main-image-container img")!! .attr("abs:src") return listOf(Page(0, response.request.url.toString(), imageUrl)) } diff --git a/src/en/madokami/src/eu/kanade/tachiyomi/extension/en/madokami/Madokami.kt b/src/en/madokami/src/eu/kanade/tachiyomi/extension/en/madokami/Madokami.kt index 0b6ad2930..9401994e3 100644 --- a/src/en/madokami/src/eu/kanade/tachiyomi/extension/en/madokami/Madokami.kt +++ b/src/en/madokami/src/eu/kanade/tachiyomi/extension/en/madokami/Madokami.kt @@ -124,7 +124,7 @@ class Madokami : ConfigurableSource, ParsedHttpSource() { * @param element an element obtained from [chapterListSelector]. */ override fun chapterFromElement(element: Element): SChapter { - val el = element.parent().parent() + val el = element.parent()!!.parent()!! val chapter = SChapter.create() chapter.url = el.select("td:nth-child(6) a").attr("href") chapter.name = el.select("td:nth-child(1) a").text() diff --git a/src/en/manga1s/src/eu/kanade/tachiyomi/extension/en/manga1s/manga1s.kt b/src/en/manga1s/src/eu/kanade/tachiyomi/extension/en/manga1s/manga1s.kt index 09589154d..17158e907 100644 --- a/src/en/manga1s/src/eu/kanade/tachiyomi/extension/en/manga1s/manga1s.kt +++ b/src/en/manga1s/src/eu/kanade/tachiyomi/extension/en/manga1s/manga1s.kt @@ -75,7 +75,7 @@ class manga1s : ParsedHttpSource() { genre = document.select(".novel-categories > a").joinToString { it.text() } status = when ( - document.select(".novel-info i.fa-flag")[0].parent().parent().select("span") + document.select(".novel-info i.fa-flag")[0].parent()!!.parent()!!.select("span") .text() ) { "On-going" -> SManga.ONGOING diff --git a/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt b/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt index a9a4c7f10..52eb466fe 100644 --- a/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt +++ b/src/en/mangadoom/src/eu/kanade/tachiyomi/extension/en/mangadoom/MangaDoom.kt @@ -91,14 +91,14 @@ class MangaDoom : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() - val innerContentElement = document.select("div.content-inner.inner-page").first() - val dlElement = innerContentElement.select("div.col-md-8 > dl").first() + val innerContentElement = document.select("div.content-inner.inner-page").first()!! + val dlElement = innerContentElement.select("div.col-md-8 > dl").first()!! return SManga.create().apply { this.url = response.request.url.toString() this.title = innerContentElement - .select("h5.widget-heading:matchText").first().text() + .select("h5.widget-heading:matchText").first()!!.text() this.thumbnail_url = innerContentElement .select("div.col-md-4 > img").first()?.attr("src") @@ -184,13 +184,11 @@ class MangaDoom : HttpSource() { return chapters.map { SChapter.create().apply { - this.name = it.select("span.val").first().ownText() - this.url = it.select("a").first().attr("href") + this.name = it.select("span.val").first()!!.ownText() + this.url = it.select("a").first()!!.attr("href") this.chapter_number = this.url.split("/").last().replace(Regex("[^0-9.]"), "").toFloat() - val calculatedDate = it.select("span.date").first().ownText()?.let { - parseDate(it) - } + val calculatedDate = parseDate(it.select("span.date").first()!!.ownText()) if (calculatedDate != null) { this.date_upload = calculatedDate @@ -500,7 +498,7 @@ class MangaDoom : HttpSource() { return document.select("ul.manga-cat > li").map { Pair( - it.select("span.fa").first().attr("data-id"), + it.select("span.fa").first()!!.attr("data-id"), it.ownText(), ) } @@ -573,7 +571,7 @@ class MangaDoom : HttpSource() { * The last step for parsing popular manga and search results (from jsoup element to [SManga] */ private fun mangaFromMangaListElement(mangaListElement: Element): SManga { - val titleElement = mangaListElement.select("div.col-md-4 > a").first() + val titleElement = mangaListElement.select("div.col-md-4 > a").first()!! return mangaFromMangaTitleElement(titleElement) } @@ -584,7 +582,7 @@ class MangaDoom : HttpSource() { .apply { this.title = mangaTitleElement.attr("title") this.setUrlWithoutDomain(mangaTitleElement.attr("href")) - this.thumbnail_url = mangaTitleElement.select("img").first() + this.thumbnail_url = mangaTitleElement.select("img").first()!! .attr("src") } } diff --git a/src/en/mangafox/src/eu/kanade/tachiyomi/extension/en/mangafox/MangaFox.kt b/src/en/mangafox/src/eu/kanade/tachiyomi/extension/en/mangafox/MangaFox.kt index aa982dfef..b4f3abbbd 100644 --- a/src/en/mangafox/src/eu/kanade/tachiyomi/extension/en/mangafox/MangaFox.kt +++ b/src/en/mangafox/src/eu/kanade/tachiyomi/extension/en/mangafox/MangaFox.kt @@ -83,7 +83,7 @@ class MangaFox : ParsedHttpSource() { override fun popularMangaSelector(): String = "ul.manga-list-1-list li" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - element.select("a").first().let { + element.select("a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.attr("title") thumbnail_url = it.select("img").attr("abs:src") @@ -147,7 +147,7 @@ class MangaFox : ParsedHttpSource() { override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - document.select(".detail-info-right").first().let { + document.select(".detail-info-right").first()!!.let { author = it.select(".detail-info-right-say a").joinToString(", ") { it.text() } genre = it.select(".detail-info-right-tag-list a").joinToString(", ") { it.text() } description = it.select("p.fullcontent").first()?.text() @@ -181,7 +181,7 @@ class MangaFox : ParsedHttpSource() { set(Calendar.MILLISECOND, 0) }.timeInMillis } else { - kotlin.runCatching { + runCatching { SimpleDateFormat("MMM d,yyyy", Locale.ENGLISH).parse(date)?.time }.getOrNull() ?: 0L } @@ -195,7 +195,7 @@ class MangaFox : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - val packed = document.selectFirst("script:containsData(p,a,c,k,e)").data() + val packed = document.selectFirst("script:containsData(p,a,c,k,e)")!!.data() val imagesRaw = Unpacker.unpack(packed) .substringAfter("newImgs=") .substringBefore(";") diff --git a/src/en/mangafreak/src/eu/kanade/tachiyomi/extension/en/mangafreak/Mangafreak.kt b/src/en/mangafreak/src/eu/kanade/tachiyomi/extension/en/mangafreak/Mangafreak.kt index 658b688a2..6dc5d6e88 100644 --- a/src/en/mangafreak/src/eu/kanade/tachiyomi/extension/en/mangafreak/Mangafreak.kt +++ b/src/en/mangafreak/src/eu/kanade/tachiyomi/extension/en/mangafreak/Mangafreak.kt @@ -64,7 +64,7 @@ class Mangafreak : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { thumbnail_url = element.select("img").attr("abs:src").replace("mini", "manga").substringBeforeLast("/") + ".jpg" element.select("a").apply { - title = first().text() + title = first()!!.text() url = attr("href") } } @@ -141,7 +141,7 @@ class Mangafreak : ParsedHttpSource() { } else { val sb = StringBuilder("0.") for (x in match.groupValues[2]) { - sb.append(x.toInt() - 'a'.toInt() + 1) + sb.append(x.code - 'a'.code + 1) } val p2 = sb.toString().toFloat() val p1 = match.groupValues[1].toFloat() diff --git a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt index 283f4a64a..8dd753fb8 100644 --- a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt +++ b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt @@ -78,12 +78,12 @@ class Mangago : ParsedHttpSource() { private val dateFormat = SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH) private fun mangaFromElement(element: Element) = SManga.create().apply { - val linkElement = element.selectFirst(".thm-effect") + val linkElement = element.selectFirst(".thm-effect")!! setUrlWithoutDomain(linkElement.attr("href")) title = linkElement.attr("title") - val thumbnailElem = linkElement.selectFirst("img") + val thumbnailElem = linkElement.selectFirst("img")!! thumbnail_url = thumbnailElem.attr("abs:data-src").ifBlank { thumbnailElem.attr("abs:src") } } @@ -150,14 +150,14 @@ class Mangago : ParsedHttpSource() { override fun searchMangaNextPageSelector() = genreListingNextPageSelector override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.selectFirst(".w-title h1").text() - document.getElementById("information").let { - thumbnail_url = it.selectFirst("img").attr("abs:src") - description = it.selectFirst(".manga_summary").text() + title = document.selectFirst(".w-title h1")!!.text() + document.getElementById("information")!!.let { + thumbnail_url = it.selectFirst("img")!!.attr("abs:src") + description = it.selectFirst(".manga_summary")!!.text() it.select(".manga_info li, .manga_right tr").forEach { el -> - when (el.selectFirst("b, label").text().lowercase()) { + when (el.selectFirst("b, label")!!.text().lowercase()) { "alternative:" -> description += "\n\n${el.text()}" - "status:" -> status = when (el.selectFirst("span").text().lowercase()) { + "status:" -> status = when (el.selectFirst("span")!!.text().lowercase()) { "ongoing" -> SManga.ONGOING "completed" -> SManga.COMPLETED else -> SManga.UNKNOWN @@ -176,7 +176,7 @@ class Mangago : ParsedHttpSource() { setUrlWithoutDomain(link.attr("href")) name = link.text().trim() - date_upload = kotlin.runCatching { + date_upload = runCatching { dateFormat.parse(element.select("td:last-child").text().trim())?.time }.getOrNull() ?: 0L } diff --git a/src/en/mangahasu/src/eu/kanade/tachiyomi/extension/en/mangahasu/Mangahasu.kt b/src/en/mangahasu/src/eu/kanade/tachiyomi/extension/en/mangahasu/Mangahasu.kt index e122b4c9d..ae5896c55 100644 --- a/src/en/mangahasu/src/eu/kanade/tachiyomi/extension/en/mangahasu/Mangahasu.kt +++ b/src/en/mangahasu/src/eu/kanade/tachiyomi/extension/en/mangahasu/Mangahasu.kt @@ -53,8 +53,8 @@ class Mangahasu : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("src") - element.select("a:has(h3.name-manga), a.name-manga").first().let { + manga.thumbnail_url = element.select("img").first()!!.attr("src") + element.select("a:has(h3.name-manga), a.name-manga").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -119,7 +119,7 @@ class Mangahasu : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select(".info-c").first() + val infoElement = document.select(".info-c").first()!! val manga = SManga.create() manga.author = isUpdating(infoElement.select(".info")[0].text()) @@ -145,7 +145,7 @@ class Mangahasu : ParsedHttpSource() { override fun chapterListSelector() = "tbody tr" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) urlElement.select("span.name-manga").remove() diff --git a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt index 2a4c5bf27..1f5e7c762 100644 --- a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt +++ b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt @@ -73,11 +73,11 @@ class Mangahere : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - val titleElement = element.select("a").first() + val titleElement = element.select("a").first()!! manga.title = titleElement.attr("title") manga.setUrlWithoutDomain(titleElement.attr("href")) manga.thumbnail_url = element.select("img.manga-list-1-cover") - ?.first()?.attr("src") + .first()?.attr("src") return manga } @@ -154,13 +154,13 @@ class Mangahere : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - manga.author = document.select(".detail-info-right-say > a")?.first()?.text() - manga.genre = document.select(".detail-info-right-tag-list > a")?.joinToString { it.text() } - manga.description = document.select(".fullcontent")?.first()?.text() - manga.thumbnail_url = document.select("img.detail-info-cover-img")?.first() + manga.author = document.select(".detail-info-right-say > a").first()?.text() + manga.genre = document.select(".detail-info-right-tag-list > a").joinToString { it.text() } + manga.description = document.select(".fullcontent").first()?.text() + manga.thumbnail_url = document.select("img.detail-info-cover-img").first() ?.attr("src") - document.select("span.detail-info-right-title-tip")?.first()?.text()?.also { statusText -> + document.select("span.detail-info-right-title-tip").first()?.text()?.also { statusText -> when { statusText.contains("ongoing", true) -> manga.status = SManga.ONGOING statusText.contains("completed", true) -> manga.status = SManga.COMPLETED @@ -169,7 +169,7 @@ class Mangahere : ParsedHttpSource() { } // Get a chapter, check if the manga is licensed. - val aChapterURL = chapterFromElement(document.select(chapterListSelector()).first()).url + val aChapterURL = chapterFromElement(document.select(chapterListSelector()).first()!!).url val aChapterDocument = client.newCall(GET("$baseUrl$aChapterURL", headers)).execute().asJsoup() if (aChapterDocument.select("p.detail-block-content").hasText()) manga.status = SManga.LICENSED @@ -180,8 +180,8 @@ class Mangahere : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - chapter.setUrlWithoutDomain(element.select("a").first().attr("href")) - chapter.name = element.select("a p.title3").first().text() + chapter.setUrlWithoutDomain(element.select("a").first()!!.attr("href")) + chapter.name = element.select("a p.title3").first()!!.text() chapter.date_upload = element.select("a p.title2").first()?.text()?.let { parseChapterDate(it) } ?: 0 return chapter } @@ -254,7 +254,7 @@ class Mangahere : ParsedHttpSource() { html.indexOf(";", chapterIdStartLoc), ).trim() - val chapterPagesElement = document.select(".pager-list-left > span").first() + val chapterPagesElement = document.select(".pager-list-left > span").first()!! val pagesLinksElements = chapterPagesElement.select("a") val pagesNumber = pagesLinksElements[pagesLinksElements.size - 2].attr("data-page").toInt() diff --git a/src/en/mangakatana/src/eu/kanade/tachiyomi/extension/en/mangakatana/MangaKatana.kt b/src/en/mangakatana/src/eu/kanade/tachiyomi/extension/en/mangakatana/MangaKatana.kt index 2d1991f39..bf834fcc5 100644 --- a/src/en/mangakatana/src/eu/kanade/tachiyomi/extension/en/mangakatana/MangaKatana.kt +++ b/src/en/mangakatana/src/eu/kanade/tachiyomi/extension/en/mangakatana/MangaKatana.kt @@ -62,9 +62,9 @@ class MangaKatana : ConfigurableSource, ParsedHttpSource() { override fun latestUpdatesSelector() = "div#book_list > div.item" override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { - setUrlWithoutDomain(element.selectFirst("div.text > h3 > a").attr("href")) - title = element.selectFirst("div.text > h3 > a").ownText() - thumbnail_url = element.selectFirst("img").attr("abs:src") + setUrlWithoutDomain(element.selectFirst("div.text > h3 > a")!!.attr("href")) + title = element.selectFirst("div.text > h3 > a")!!.ownText() + thumbnail_url = element.selectFirst("img")!!.attr("abs:src") } override fun latestUpdatesNextPageSelector() = "a.next.page-numbers" @@ -142,7 +142,7 @@ class MangaKatana : ConfigurableSource, ParsedHttpSource() { val document = response.asJsoup() val manga = SManga.create().apply { thumbnail_url = parseThumbnail(document) - title = document.select("h1.heading").first().text() + title = document.select("h1.heading").first()!!.text() } manga.setUrlWithoutDomain(response.request.url.toString()) MangasPage(listOf(manga), false) diff --git a/src/en/mangapark/src/eu/kanade/tachiyomi/extension/en/mangapark/MangaPark.kt b/src/en/mangapark/src/eu/kanade/tachiyomi/extension/en/mangapark/MangaPark.kt index 104405015..eb23ee261 100644 --- a/src/en/mangapark/src/eu/kanade/tachiyomi/extension/en/mangapark/MangaPark.kt +++ b/src/en/mangapark/src/eu/kanade/tachiyomi/extension/en/mangapark/MangaPark.kt @@ -83,7 +83,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() { override fun searchMangaNextPageSelector() = nextPageSelector private fun mangaFromElement(element: Element) = SManga.create().apply { - val coverElement = element.getElementsByClass("cover").first() + val coverElement = element.getElementsByClass("cover").first()!! url = coverElement.attr("href") title = coverElement.attr("title") thumbnail_url = coverElement.select("img").attr("abs:src") @@ -91,13 +91,13 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() { @SuppressLint("DefaultLocale") override fun mangaDetailsParse(document: Document) = SManga.create().apply { - document.select(".cover > img").first().let { coverElement -> + document.select(".cover > img").first()!!.let { coverElement -> title = coverElement.attr("title") thumbnail_url = coverElement.attr("abs:src") } document.select(".attr > tbody > tr").forEach { - when (it.getElementsByTag("th").first().text().trim().lowercase()) { + when (it.getElementsByTag("th").first()!!.text().trim().lowercase()) { "author(s)" -> { author = it.getElementsByTag("a").joinToString(transform = Element::text) } @@ -193,7 +193,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() { fun Float?.orIncrementLastNum() = if (this == null || this < lastNum) lastNum.incremented() else this return SChapter.create().apply { - element.select(".tit > a").first().let { + element.select(".tit > a").first()!!.let { url = it.attr("href").removeSuffix("1") name = it.text() } @@ -208,7 +208,7 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() { else -> lastNum.incremented() } } - date_upload = parseDate(element.select(".time").first().text().trim()) + date_upload = parseDate(element.select(".time").first()!!.text().trim()) scanlator = source } } diff --git a/src/en/mangapill/src/eu/kanade/tachiyomi/extension/en/mangapill/MangaPill.kt b/src/en/mangapill/src/eu/kanade/tachiyomi/extension/en/mangapill/MangaPill.kt index 7ad0b5fa8..6cfb73b16 100644 --- a/src/en/mangapill/src/eu/kanade/tachiyomi/extension/en/mangapill/MangaPill.kt +++ b/src/en/mangapill/src/eu/kanade/tachiyomi/extension/en/mangapill/MangaPill.kt @@ -62,7 +62,7 @@ class MangaPill : ParsedHttpSource() { manga.genre = genres.joinToString(", ") manga.status = parseStatus(document.select("div.container > div:first-child > div:last-child > div:nth-child(3) > div:nth-child(2) > div").text()) manga.description = document.select("div.container > div:first-child > div:last-child > div:nth-child(2) > p").text() - manga.thumbnail_url = document.select("div.container > div:first-child > div:first-child > img").first().attr("data-src") + manga.thumbnail_url = document.select("div.container > div:first-child > div:first-child > img").first()!!.attr("data-src") return manga } diff --git a/src/en/mangaplex/src/eu/kanade/tachiyomi/extension/en/mangaplex/MangaPlex.kt b/src/en/mangaplex/src/eu/kanade/tachiyomi/extension/en/mangaplex/MangaPlex.kt index 07f747cf4..7ecf7300d 100644 --- a/src/en/mangaplex/src/eu/kanade/tachiyomi/extension/en/mangaplex/MangaPlex.kt +++ b/src/en/mangaplex/src/eu/kanade/tachiyomi/extension/en/mangaplex/MangaPlex.kt @@ -101,7 +101,7 @@ class MangaPlex : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - var chapterNameSelector = element.select(".post-title a").attr("title") + val chapterNameSelector = element.select(".post-title a").attr("title") chapter.setUrlWithoutDomain(element.select(".post-title a").attr("href")) chapter.name = if (chapterNameSelector.startsWith("chapter", true) && chapterNameSelector.contains("–")) { @@ -115,7 +115,7 @@ class MangaPlex : ParsedHttpSource() { // pages override fun pageListParse(document: Document): List { - return document.select("#the-post .entry-content > img") + return document.select("#the-post .entry-content > img").toList() .filter { it.attr("src").isNotEmpty() } .mapIndexed { i, el -> Page(i, "", el.attr("src")) } } diff --git a/src/en/mangarawclub/src/eu/kanade/tachiyomi/extension/en/mangarawclub/MangaRawClub.kt b/src/en/mangarawclub/src/eu/kanade/tachiyomi/extension/en/mangarawclub/MangaRawClub.kt index 5964c7660..e9c6a94b7 100644 --- a/src/en/mangarawclub/src/eu/kanade/tachiyomi/extension/en/mangarawclub/MangaRawClub.kt +++ b/src/en/mangarawclub/src/eu/kanade/tachiyomi/extension/en/mangarawclub/MangaRawClub.kt @@ -52,7 +52,7 @@ class MangaRawClub : ParsedHttpSource() { val manga = SManga.create() manga.title = element.select(".novel-title").first()?.text() ?: "" manga.thumbnail_url = element.select(".novel-cover img").attr("abs:data-src") - manga.setUrlWithoutDomain(element.select("a").first().attr("href")) + manga.setUrlWithoutDomain(element.select("a").first()!!.attr("href")) return manga } override fun popularMangaFromElement(element: Element): SManga = searchMangaFromElement(element) @@ -262,13 +262,7 @@ class MangaRawClub : ParsedHttpSource() { ), ) - private fun getGenreList(): List { - return GenrePairList().vals.map { - Genre(it.first) - } - } - - private class Genre(name: String, id: String = name) : Filter.TriState(name) + private class Genre(name: String) : Filter.TriState(name) private class GenreList(genres: List) : Filter.Group("Genres+", genres) private open class UriPartFilter(displayName: String, val vals: Array>) : diff --git a/src/en/mangasail/src/eu/kanade/tachiyomi/extension/en/mangasail/Mangasail.kt b/src/en/mangasail/src/eu/kanade/tachiyomi/extension/en/mangasail/Mangasail.kt index b4d9b10ac..5cf037bd7 100644 --- a/src/en/mangasail/src/eu/kanade/tachiyomi/extension/en/mangasail/Mangasail.kt +++ b/src/en/mangasail/src/eu/kanade/tachiyomi/extension/en/mangasail/Mangasail.kt @@ -45,11 +45,11 @@ class Mangasail : ParsedHttpSource() { override fun popularMangaSelector() = "tbody tr" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - element.selectFirst("td:first-of-type a").let { + element.selectFirst("td:first-of-type a")!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } - thumbnail_url = element.selectFirst("td img").attr("src") + thumbnail_url = element.selectFirst("td img")!!.attr("src") } override fun popularMangaNextPageSelector() = "table + div.text-center ul.pagination li.next a" @@ -69,7 +69,7 @@ class Mangasail : ParsedHttpSource() { element.select("a:has(img)").let { url = it.attr("href") // Thumbnails are kind of low-res on latest updates page, transform the img url to get a better version - thumbnail_url = it.select("img").first().attr("src").substringBefore("?").replace("styles/minicover/public/", "") + thumbnail_url = it.select("img").first()!!.attr("src").substringBefore("?").replace("styles/minicover/public/", "") } } @@ -92,7 +92,7 @@ class Mangasail : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.selectFirst("a").let { + element.selectFirst("a")!!.let { manga.setUrlWithoutDomain(it.attr("abs:href")) manga.title = it.text() // Search page doesn't contain cover images, have to get them from the manga's page; but first we need that page's node number @@ -110,14 +110,14 @@ class Mangasail : ParsedHttpSource() { private fun getNodeDetail(node: String, field: String): String? { val requestUrl = "$baseUrl/sites/all/modules/authcache/modules/authcache_p13n/frontcontroller/authcache.php?a[field][0]=$node:full:en&r=asm/field/node/$field&o[q]=node/$node" - val responseString = client.newCall(GET(requestUrl, headers)).execute().body.string() ?: return null + val responseString = client.newCall(GET(requestUrl, headers)).execute().body.string() val htmlString = json.parseToJsonElement(responseString).jsonObject["field"]!!.jsonObject["$node:full:en"]!!.jsonPrimitive.content return parse(htmlString).let { when (field) { - "field_image2" -> it.selectFirst("img.img-responsive").attr("src") + "field_image2" -> it.selectFirst("img.img-responsive")!!.attr("src") "field_status", "field_author", "field_artist" -> it.selectFirst("div.field-item.even")?.text() "body" -> it.selectFirst("div.field-item.even p")?.text()?.substringAfter("summary: ") - "field_genres" -> it.select("a")?.text() + "field_genres" -> it.select("a").text() else -> null } } @@ -130,7 +130,7 @@ class Mangasail : ParsedHttpSource() { // On source's website most of these details are loaded through JQuery override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - title = document.select("div.main-content-inner").select("h1").first().text() + title = document.select("div.main-content-inner").select("h1").first()!!.text() getNodeNumber(document).let { node -> author = getNodeDetail(node, "field_author") artist = getNodeDetail(node, "field_artist") @@ -154,7 +154,7 @@ class Mangasail : ParsedHttpSource() { override fun chapterListSelector() = "tbody tr" override fun chapterFromElement(element: Element) = SChapter.create().apply { - setUrlWithoutDomain(element.select("a").first().attr("href")) + setUrlWithoutDomain(element.select("a").first()!!.attr("href")) name = element.select("a").text() date_upload = parseChapterDate(element.select("td + td").text()) } @@ -166,7 +166,7 @@ class Mangasail : ParsedHttpSource() { // Page List override fun pageListParse(document: Document): List { - val imgUrlArray = document.selectFirst("script:containsData(paths)").data() + val imgUrlArray = document.selectFirst("script:containsData(paths)")!!.data() .substringAfter("paths\":").substringBefore(",\"count_p") return json.parseToJsonElement(imgUrlArray).jsonArray.mapIndexed { i, el -> Page(i, "", el.jsonPrimitive.content) diff --git a/src/en/mangatown/src/eu/kanade/tachiyomi/extension/en/mangatown/Mangatown.kt b/src/en/mangatown/src/eu/kanade/tachiyomi/extension/en/mangatown/Mangatown.kt index a35234b68..f29ec8781 100644 --- a/src/en/mangatown/src/eu/kanade/tachiyomi/extension/en/mangatown/Mangatown.kt +++ b/src/en/mangatown/src/eu/kanade/tachiyomi/extension/en/mangatown/Mangatown.kt @@ -47,7 +47,7 @@ class Mangatown : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select("p.title a").first().let { + element.select("p.title a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } diff --git a/src/en/megatokyo/src/eu/kanade/tachiyomi/extension/en/megatokyo/Megatokyo.kt b/src/en/megatokyo/src/eu/kanade/tachiyomi/extension/en/megatokyo/Megatokyo.kt index 1d5a830d3..4f60ac163 100644 --- a/src/en/megatokyo/src/eu/kanade/tachiyomi/extension/en/megatokyo/Megatokyo.kt +++ b/src/en/megatokyo/src/eu/kanade/tachiyomi/extension/en/megatokyo/Megatokyo.kt @@ -107,7 +107,7 @@ class Megatokyo : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not used") - override fun searchMangaNextPageSelector(): String? = throw Exception("Not used") + override fun searchMangaNextPageSelector(): String = throw Exception("Not used") override fun searchMangaSelector(): String = throw Exception("Not used") @@ -116,13 +116,13 @@ class Megatokyo : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used") - override fun popularMangaNextPageSelector(): String? = throw Exception("Not used") + override fun popularMangaNextPageSelector(): String = throw Exception("Not used") override fun popularMangaFromElement(element: Element): SManga = throw Exception("Not used") override fun mangaDetailsParse(document: Document): SManga = throw Exception("Not used") - override fun latestUpdatesNextPageSelector(): String? = throw Exception("Not used") + override fun latestUpdatesNextPageSelector(): String = throw Exception("Not used") override fun latestUpdatesFromElement(element: Element): SManga = throw Exception("Not used") @@ -130,7 +130,7 @@ class Megatokyo : ParsedHttpSource() { override fun latestUpdatesSelector(): String = throw Exception("Not used") - protected open fun String.toDate(): Long { + private fun String.toDate(): Long { return runCatching { dateParser.parse(this.replace("(\\d+)(st|nd|rd|th)".toRegex(), "$1"))?.time } .onFailure { print("Something wrong happened: ${it.message}") }.getOrNull() ?: 0L } diff --git a/src/en/myhentaicomics/src/eu/kanade/tachiyomi/extension/en/myhentaicomics/MyHentaiComics.kt b/src/en/myhentaicomics/src/eu/kanade/tachiyomi/extension/en/myhentaicomics/MyHentaiComics.kt index 618e52b8b..992368cd5 100644 --- a/src/en/myhentaicomics/src/eu/kanade/tachiyomi/extension/en/myhentaicomics/MyHentaiComics.kt +++ b/src/en/myhentaicomics/src/eu/kanade/tachiyomi/extension/en/myhentaicomics/MyHentaiComics.kt @@ -95,7 +95,7 @@ class MyHentaiComics : ParsedHttpSource() { artist = tags.first.joinToString { it.text().substringAfter(" ") } author = artist genre = tags.second.joinToString { it.text() } - thumbnail_url = document.select("img.g-thumbnail").first().attr("abs:src").replace("/thumbs/", "/resizes/") + thumbnail_url = document.select("img.g-thumbnail").first()!!.attr("abs:src").replace("/thumbs/", "/resizes/") } } diff --git a/src/en/nana/src/eu/kanade/tachiyomi/extension/en/nana/Nana.kt b/src/en/nana/src/eu/kanade/tachiyomi/extension/en/nana/Nana.kt index 115d0e3a2..d14c978e8 100644 --- a/src/en/nana/src/eu/kanade/tachiyomi/extension/en/nana/Nana.kt +++ b/src/en/nana/src/eu/kanade/tachiyomi/extension/en/nana/Nana.kt @@ -73,11 +73,11 @@ class Nana : ParsedHttpSource() { "#thumbs_container > .id1" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { - val a = element.selectFirst(".id3 > a") + val a = element.selectFirst(".id3 > a")!! setUrlWithoutDomain(a.absUrl("href")) title = a.attr("title") - val img = a.selectFirst("> img") + val img = a.selectFirst("> img")!! thumbnail_url = img.absUrl("src") author = img.attr("alt") .replace("$title by ", "") @@ -91,7 +91,7 @@ class Nana : ParsedHttpSource() { initialized = true } - override fun searchMangaNextPageSelector(): String? = + override fun searchMangaNextPageSelector(): String = "a.paginate_button.current + a.paginate_button" // Latest @@ -104,7 +104,7 @@ class Nana : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used.") - override fun latestUpdatesNextPageSelector(): String? = + override fun latestUpdatesNextPageSelector(): String = throw UnsupportedOperationException("Not used.") // Details diff --git a/src/en/ninehentai/src/eu/kanade/tachiyomi/extension/en/ninehentai/NineHentai.kt b/src/en/ninehentai/src/eu/kanade/tachiyomi/extension/en/ninehentai/NineHentai.kt index 664f140dd..d04ec98d6 100644 --- a/src/en/ninehentai/src/eu/kanade/tachiyomi/extension/en/ninehentai/NineHentai.kt +++ b/src/en/ninehentai/src/eu/kanade/tachiyomi/extension/en/ninehentai/NineHentai.kt @@ -184,9 +184,9 @@ class NineHentai : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { return SManga.create().apply { - response.asJsoup().selectFirst("div#bigcontainer").let { info -> + response.asJsoup().selectFirst("div#bigcontainer")!!.let { info -> title = info.select("h1").text() - thumbnail_url = info.selectFirst("div#cover v-lazy-image").attr("abs:src") + thumbnail_url = info.selectFirst("div#cover v-lazy-image")!!.attr("abs:src") status = SManga.COMPLETED artist = info.selectTextOrNull("div.field-name:contains(Artist:) a.tag") author = info.selectTextOrNull("div.field-name:contains(Group:) a.tag") ?: "Unknown circle" diff --git a/src/en/nuxscans/src/eu/kanade/tachiyomi/extension/en/nuxscans/NuxScans.kt b/src/en/nuxscans/src/eu/kanade/tachiyomi/extension/en/nuxscans/NuxScans.kt index fc58e2b78..c3d9c9bbb 100644 --- a/src/en/nuxscans/src/eu/kanade/tachiyomi/extension/en/nuxscans/NuxScans.kt +++ b/src/en/nuxscans/src/eu/kanade/tachiyomi/extension/en/nuxscans/NuxScans.kt @@ -16,7 +16,7 @@ class NuxScans : ParsedHttpSource() { override val name = "Nux Scans" override val baseUrl = "https://nuxscans.blogspot.com" - val baseUrl2 = "https://nuxscans-comics.blogspot.com" + private val baseUrl2 = "https://nuxscans-comics.blogspot.com" override val lang = "en" override val supportsLatest = false override val client: OkHttpClient = network.cloudflareClient @@ -45,7 +45,7 @@ class NuxScans : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException() - override fun latestUpdatesNextPageSelector(): String? = throw UnsupportedOperationException() + override fun latestUpdatesNextPageSelector(): String = throw UnsupportedOperationException() // search override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw UnsupportedOperationException() @@ -54,7 +54,7 @@ class NuxScans : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = throw UnsupportedOperationException() - override fun searchMangaNextPageSelector(): String? = throw UnsupportedOperationException() + override fun searchMangaNextPageSelector(): String = throw UnsupportedOperationException() // manga details override fun mangaDetailsRequest(manga: SManga): Request { @@ -67,12 +67,6 @@ class NuxScans : ParsedHttpSource() { description = document.select(".gridnux .column1 .text-overflow").joinToString("\n") { it.text() } } - private fun parseStatus(element: String): Int = when { - element.lowercase().contains("ongoing") -> SManga.ONGOING - element.lowercase().contains("completed") -> SManga.COMPLETED - else -> SManga.UNKNOWN - } - // chapters override fun chapterListRequest(manga: SManga): Request { return GET(baseUrl2 + manga.url) @@ -85,7 +79,7 @@ class NuxScans : ParsedHttpSource() { } override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = element.select("p").text() diff --git a/src/en/purplecress/src/eu/kanade/tachiyomi/extension/en/purplecress/PurpleCress.kt b/src/en/purplecress/src/eu/kanade/tachiyomi/extension/en/purplecress/PurpleCress.kt index 73898d3f9..3f91040be 100644 --- a/src/en/purplecress/src/eu/kanade/tachiyomi/extension/en/purplecress/PurpleCress.kt +++ b/src/en/purplecress/src/eu/kanade/tachiyomi/extension/en/purplecress/PurpleCress.kt @@ -30,16 +30,16 @@ class PurpleCress : HttpSource() { override fun popularMangaRequest(page: Int) = GET(baseUrl) override fun popularMangaParse(response: Response): MangasPage { - val seriesContainer = response.asJsoup().selectFirst("div.container-grid--small") + val seriesContainer = response.asJsoup().selectFirst("div.container-grid--small")!! val mangaList: List = seriesContainer.select("a").map { SManga.create().apply { - title = it.selectFirst("div.card__info").selectFirst("h3").html() + title = it.selectFirst("div.card__info")!!.selectFirst("h3")!!.html() url = it.attr("href") - author = it.selectFirst("p.card__author").html().substringAfter("by ") + author = it.selectFirst("p.card__author")!!.html().substringAfter("by ") artist = author description = it.attr("description") - thumbnail_url = it.selectFirst("img.image").attr("src") - status = when (it.selectFirst("h3.card__status").html()) { + thumbnail_url = it.selectFirst("img.image")!!.attr("src") + status = when (it.selectFirst("h3.card__status")!!.html()) { "Ongoing" -> SManga.ONGOING "Dropped" -> SManga.COMPLETED // Not sure what the best status is for "Dropped" "Completed" -> SManga.COMPLETED // There aren't any completed series on the site, so I'm just guessing as to the string @@ -54,12 +54,12 @@ class PurpleCress : HttpSource() { override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl) override fun latestUpdatesParse(response: Response): MangasPage { - val seriesContainer = response.asJsoup().selectFirst("div.container-grid--large") + val seriesContainer = response.asJsoup().selectFirst("div.container-grid--large")!! val mangaList: List = seriesContainer.select("a").map { SManga.create().apply { - title = it.selectFirst("h3.chapter__series-name").html() + title = it.selectFirst("h3.chapter__series-name")!!.html() url = it.attr("href").replaceFirst("chapter", "series").substringBeforeLast("/") - thumbnail_url = it.selectFirst("img.image").attr("src") + thumbnail_url = it.selectFirst("img.image")!!.attr("src") initialized = false } } @@ -82,15 +82,15 @@ class PurpleCress : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val responseJ = response.asJsoup() - val infoBox = responseJ.selectFirst("div.series__info") + val infoBox = responseJ.selectFirst("div.series__info")!! return SManga.create().apply { - title = infoBox.selectFirst("h1.series__name").html() + title = infoBox.selectFirst("h1.series__name")!!.html() // url is set by overridden fetchMangaDetails - author = infoBox.selectFirst("p.series__author").html().substringAfter("by ") + author = infoBox.selectFirst("p.series__author")!!.html().substringAfter("by ") artist = author - description = infoBox.selectFirst("p.description-pagagraph").html() - thumbnail_url = responseJ.selectFirst("img.thumbnail").attr("src") - status = when (infoBox.selectFirst("span.series__status").html()) { + description = infoBox.selectFirst("p.description-pagagraph")!!.html() + thumbnail_url = responseJ.selectFirst("img.thumbnail")!!.attr("src") + status = when (infoBox.selectFirst("span.series__status")!!.html()) { "Ongoing" -> SManga.ONGOING "Dropped" -> SManga.COMPLETED // See comments in popularMangaParse "Completed" -> SManga.COMPLETED @@ -104,8 +104,8 @@ class PurpleCress : HttpSource() { .map { SChapter.create().apply { url = it.attr("href") - name = it.selectFirst("span.chapter__name").html() - date_upload = it.selectFirst("h5.chapter__date").html() + name = it.selectFirst("span.chapter__name")!!.html() + date_upload = it.selectFirst("h5.chapter__date")!!.html() .let { SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(it)?.time ?: 0L } } } diff --git a/src/en/randowiz/src/eu/kanade/tachiyomi/extension/en/randowiz/Randowiz.kt b/src/en/randowiz/src/eu/kanade/tachiyomi/extension/en/randowiz/Randowiz.kt index eecebda9b..cc48430ac 100644 --- a/src/en/randowiz/src/eu/kanade/tachiyomi/extension/en/randowiz/Randowiz.kt +++ b/src/en/randowiz/src/eu/kanade/tachiyomi/extension/en/randowiz/Randowiz.kt @@ -110,7 +110,7 @@ class Randowiz : ParsedHttpSource() { override fun chapterListSelector() = ".has-post-thumbnail" override fun chapterFromElement(element: Element): SChapter { - val linkTag = element.select(".elementor-post__title a").first() + val linkTag = element.select(".elementor-post__title a").first()!! val chapter = SChapter.create() chapter.name = linkTag.text() chapter.url = linkTag.attr("href").split(".com")[1] diff --git a/src/en/rawmanga/src/eu/kanade/tachiyomi/extension/en/rawmanga/RawManga.kt b/src/en/rawmanga/src/eu/kanade/tachiyomi/extension/en/rawmanga/RawManga.kt index cb3de6936..98d527b28 100644 --- a/src/en/rawmanga/src/eu/kanade/tachiyomi/extension/en/rawmanga/RawManga.kt +++ b/src/en/rawmanga/src/eu/kanade/tachiyomi/extension/en/rawmanga/RawManga.kt @@ -34,7 +34,7 @@ class RawManga : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - url = element.selectFirst("div > a").attr("href") + url = element.selectFirst("div > a")!!.attr("href") title = element.select("div > a > h2").text().trim() thumbnail_url = element.select("a > div > img").attr("src") } @@ -70,9 +70,9 @@ class RawManga : ParsedHttpSource() { return SManga.create().apply { thumbnail_url = document.select(".img-thumbnail").attr("src") title = document.select("#mangaholder h1").text().trim() - description = document.selectFirst("#info p").text() + description = document.selectFirst("#info p")!!.text() .replace(Regex("^(.*?)This Comic is About"), "").trim() // Removing boilerplate text - author = document.selectFirst("#titlecompenents dt").text().trim() + author = document.selectFirst("#titlecompenents dt")!!.text().trim() genre = document.select("#titlecompenents li").text().trim() status = when (document.select("#titlecompenents dt:nth-of-type(2)").text().trim()) { "Ongoing" -> SManga.ONGOING @@ -87,7 +87,7 @@ class RawManga : ParsedHttpSource() { override fun chapterListSelector(): String = "tbody tr" override fun chapterListParse(response: Response): List { - val mangaId = response.asJsoup().selectFirst(".btn-danger").attr("onclick") + val mangaId = response.asJsoup().selectFirst(".btn-danger")!!.attr("onclick") .substringAfter("showAllCHaps(").substringBefore(")") val chapters = client.newCall(GET("$baseUrl/pieces/chaps.php?mng=$mangaId", headers)).execute() diff --git a/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt b/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt index 270619e21..f59d53e7b 100644 --- a/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt +++ b/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt @@ -124,7 +124,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.barContent").first() + val infoElement = document.select("div.barContent").first()!! val manga = SManga.create() manga.artist = infoElement.select("p:has(span:contains(Artist:)) > a").first()?.text() @@ -160,7 +160,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { override fun chapterListSelector() = "table.listing tr:gt(1)" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) diff --git a/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt b/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt index 51da9f6c3..1523598a8 100644 --- a/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt +++ b/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt @@ -40,11 +40,11 @@ class ReadM : ParsedHttpSource() { // Popular override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/popular-manga/$page", headers) - override fun popularMangaNextPageSelector(): String? = "div.pagination a:contains(»)" + override fun popularMangaNextPageSelector(): String = "div.pagination a:contains(»)" override fun popularMangaSelector(): String = "div#discover-response li" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { thumbnail_url = element.select("img").attr("abs:src") - element.select("div.subject-title a").first().apply { + element.select("div.subject-title a").first()!!.apply { title = this.text().trim() url = this.attr("href") } @@ -57,7 +57,7 @@ class ReadM : ParsedHttpSource() { override fun latestUpdatesSelector(): String = "ul.latest-updates > li" override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { thumbnail_url = element.select("img").attr("abs:data-src") - element.select("h2 a").first().apply { + element.select("h2 a").first()!!.apply { title = this.text().trim() url = this.attr("href") } diff --git a/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt b/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt index c5e017bdd..4c6c5d688 100644 --- a/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt +++ b/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt @@ -63,7 +63,7 @@ class Readmangatoday : ParsedHttpSource() { element.selectFirst("h2")?.let { manga.title = it.text() } - element.select("a").first().let { + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) } manga.thumbnail_url = element.select("img").attr("src") @@ -107,7 +107,7 @@ class Readmangatoday : ParsedHttpSource() { override fun searchMangaNextPageSelector() = "div.next-page > a.next" override fun mangaDetailsParse(document: Document): SManga { - val detailElement = document.select("div.productDetail").first() + val detailElement = document.select("div.productDetail").first()!! val genreElement = detailElement.select("b:contains(Genres)+span.mgen>a") val manga = SManga.create() @@ -116,10 +116,7 @@ class Readmangatoday : ParsedHttpSource() { manga.description = detailElement.select("div.productRight div.infox h2:contains(Description)~p:eq(2)").first()?.text() manga.status = detailElement.select("div.imptdt:contains(Status)>i").first()?.text().orEmpty().let { parseStatus(it) } manga.thumbnail_url = detailElement.select("div.thumb img").first()?.attr("src") - - val genres = mutableListOf() - genreElement?.forEach { genres.add(it.text()) } - manga.genre = genres.joinToString(", ") + manga.genre = genreElement.joinToString(", ") { it.text() } return manga } @@ -133,7 +130,7 @@ class Readmangatoday : ParsedHttpSource() { override fun chapterListSelector() = "div#chapters-tabContent div.cardFlex div.checkBoxCard" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) diff --git a/src/en/reallifecomics/src/eu/kanade/tachiyomi/extension/en/reallifecomics/RealLifeComics.kt b/src/en/reallifecomics/src/eu/kanade/tachiyomi/extension/en/reallifecomics/RealLifeComics.kt index 5da68f6d1..1f1dcd0e2 100644 --- a/src/en/reallifecomics/src/eu/kanade/tachiyomi/extension/en/reallifecomics/RealLifeComics.kt +++ b/src/en/reallifecomics/src/eu/kanade/tachiyomi/extension/en/reallifecomics/RealLifeComics.kt @@ -77,10 +77,10 @@ class RealLifeComics : ParsedHttpSource() { // figure out a date using the calendar // perhaps there might be a better way to get this but for now this works val monthYear = element - .parent() - .parent() - .parent() - .parent() + .parent()!! + .parent()!! + .parent()!! + .parent()!! .firstElementSibling() .text() diff --git a/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt b/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt index e900f4eb2..55f2ab0d2 100644 --- a/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt +++ b/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt @@ -146,7 +146,7 @@ class ReaperScans : ParsedHttpSource() { element.select("img").first()?.let { thumbnail_url = it.attr("abs:src") } - title = element.select("p").first().text() + title = element.select("p").first()!!.text() } } @@ -166,10 +166,10 @@ class ReaperScans : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - thumbnail_url = document.select("div > img").first().attr("abs:src") - title = document.select("h1").first().text() + thumbnail_url = document.select("div > img").first()!!.attr("abs:src") + title = document.select("h1").first()!!.text() - status = when (document.select("dt:contains(Release Status)").next().first().text()) { + status = when (document.select("dt:contains(Release Status)").next().first()!!.text()) { "On hold" -> SManga.ON_HIATUS "Complete" -> SManga.COMPLETED "Ongoing" -> SManga.ONGOING @@ -186,7 +186,7 @@ class ReaperScans : ParsedHttpSource() { }?.let { add(it) } }.takeIf { it.isNotEmpty() }?.joinToString(",") - description = document.select("section > div:nth-child(1) > div > p").first().text() + description = document.select("section > div:nth-child(1) > div > p").first()!!.text() } } diff --git a/src/en/schlockmercenary/src/eu/kanade/tachiyomi/extension/en/schlockmercenary/Schlockmercenary.kt b/src/en/schlockmercenary/src/eu/kanade/tachiyomi/extension/en/schlockmercenary/Schlockmercenary.kt index 69723371c..06a77ac08 100644 --- a/src/en/schlockmercenary/src/eu/kanade/tachiyomi/extension/en/schlockmercenary/Schlockmercenary.kt +++ b/src/en/schlockmercenary/src/eu/kanade/tachiyomi/extension/en/schlockmercenary/Schlockmercenary.kt @@ -40,7 +40,7 @@ class Schlockmercenary : ParsedHttpSource() { override fun popularMangaSelector(): String = "div.archive-book" override fun popularMangaFromElement(element: Element): SManga { - val book = element.select("h4 > a").first() + val book = element.select("h4 > a").first()!! val thumb = ( baseUrl + ( element.select("img").first()?.attr("src") @@ -151,8 +151,7 @@ class Schlockmercenary : ParsedHttpSource() { private fun getImageUrlsForDay(day: String): List { val requestUrl = "$baseUrl/$day" val document = client.newCall(GET(requestUrl)).execute().asJsoup() - val urls = document.select("div#strip-$day > img").map { it.attr("abs:src") } - return urls + return document.select("div#strip-$day > img").map { it.attr("abs:src") } } override fun fetchMangaDetails(manga: SManga): Observable = Observable.just(manga) @@ -161,7 +160,7 @@ class Schlockmercenary : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used") - override fun searchMangaNextPageSelector(): String? = throw UnsupportedOperationException("Not used") + override fun searchMangaNextPageSelector(): String = throw UnsupportedOperationException("Not used") override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used") @@ -175,7 +174,7 @@ class Schlockmercenary : ParsedHttpSource() { override fun pageListParse(document: Document): List = throw UnsupportedOperationException("Not used") - override fun latestUpdatesNextPageSelector(): String? = throw UnsupportedOperationException("Not used") + override fun latestUpdatesNextPageSelector(): String = throw UnsupportedOperationException("Not used") override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used") diff --git a/src/en/silentmangaaudition/src/eu/kanade/tachiyomi/extension/en/silentmangaaudition/SilentMangaAudition.kt b/src/en/silentmangaaudition/src/eu/kanade/tachiyomi/extension/en/silentmangaaudition/SilentMangaAudition.kt index f5b817d0c..3da7d4225 100644 --- a/src/en/silentmangaaudition/src/eu/kanade/tachiyomi/extension/en/silentmangaaudition/SilentMangaAudition.kt +++ b/src/en/silentmangaaudition/src/eu/kanade/tachiyomi/extension/en/silentmangaaudition/SilentMangaAudition.kt @@ -73,8 +73,8 @@ class SilentMangaAudition : HttpSource() { private fun chapterListSelector(): String = "ol.playlist li a" private fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - name = element.select("span.ttl")!!.text() - scanlator = element.select("span.name")!!.text() + name = element.select("span.ttl").text() + scanlator = element.select("span.name").text() url = element.attr("abs:href") } diff --git a/src/en/soushiyofamiliar/src/eu/kanade/tachiyomi/extension/en/soushiyofamiliar/SoushiyoFamiliar.kt b/src/en/soushiyofamiliar/src/eu/kanade/tachiyomi/extension/en/soushiyofamiliar/SoushiyoFamiliar.kt index 0df282743..23eaeb970 100644 --- a/src/en/soushiyofamiliar/src/eu/kanade/tachiyomi/extension/en/soushiyofamiliar/SoushiyoFamiliar.kt +++ b/src/en/soushiyofamiliar/src/eu/kanade/tachiyomi/extension/en/soushiyofamiliar/SoushiyoFamiliar.kt @@ -70,7 +70,7 @@ class SoushiyoFamiliar : ParsedHttpSource() { /* Unreleased entries don't have a symbol and date */ if (dateSymbolElements.size != 0) { /* Get the text after the symbol (if there are more occurrences then take the last, so the latest date is used in the app) */ - textDate = dateSymbolElements.last().nextSibling().toString() + textDate = dateSymbolElements.last()!!.nextSibling().toString() /* Filter out any characters that do not belong to the valid date format "M/d/yy" */ textDate = textDate.replace("[^0-9/]".toRegex(), "") } @@ -100,7 +100,7 @@ class SoushiyoFamiliar : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used.") - override fun searchMangaNextPageSelector(): String? = throw UnsupportedOperationException("Not used.") + override fun searchMangaNextPageSelector(): String = throw UnsupportedOperationException("Not used.") override fun searchMangaSelector(): String = throw UnsupportedOperationException("Not used.") @@ -108,7 +108,7 @@ class SoushiyoFamiliar : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw UnsupportedOperationException("Not used.") - override fun popularMangaNextPageSelector(): String? = throw UnsupportedOperationException("Not used.") + override fun popularMangaNextPageSelector(): String = throw UnsupportedOperationException("Not used.") override fun popularMangaFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used.") diff --git a/src/en/theduckwebcomics/src/eu/kanade/tachiyomi/extension/en/theduckwebcomics/TheDuckWebcomics.kt b/src/en/theduckwebcomics/src/eu/kanade/tachiyomi/extension/en/theduckwebcomics/TheDuckWebcomics.kt index 382baaad3..3c9dc6c86 100644 --- a/src/en/theduckwebcomics/src/eu/kanade/tachiyomi/extension/en/theduckwebcomics/TheDuckWebcomics.kt +++ b/src/en/theduckwebcomics/src/eu/kanade/tachiyomi/extension/en/theduckwebcomics/TheDuckWebcomics.kt @@ -55,14 +55,14 @@ class TheDuckWebcomics : ParsedHttpSource() { override fun searchMangaFromElement(element: Element) = SManga.create().apply { - element.selectFirst(".size24").let { + element.selectFirst(".size24")!!.let { title = it.text() url = it.attr("href") } - genre = element.selectFirst(".size10").text().substringBefore(",") - description = element.selectFirst(".comicdescparagraphs").text() - thumbnail_url = element.selectFirst("img").absUrl("src") - author = element.selectFirst(".size18").text() + genre = element.selectFirst(".size10")!!.text().substringBefore(",") + description = element.selectFirst(".comicdescparagraphs")!!.text() + thumbnail_url = element.selectFirst("img")!!.absUrl("src") + author = element.selectFirst(".size18")!!.text() artist = author } @@ -85,7 +85,7 @@ class TheDuckWebcomics : ParsedHttpSource() { } override fun pageListParse(document: Document) = - listOf(Page(0, "", document.selectFirst(".page-image").attr("src"))) + listOf(Page(0, "", document.selectFirst(".page-image")!!.attr("src"))) override fun mangaDetailsParse(document: Document) = throw UnsupportedOperationException("Not used") diff --git a/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt b/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt index 5059863c2..b24918e36 100644 --- a/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt +++ b/src/en/thepropertyofhate/src/eu/kanade/tachiyomi/extension/en/thepropertyofhate/ThePropertyOfHate.kt @@ -76,8 +76,8 @@ class ThePropertyOfHate : HttpSource() { response.asJsoup().select("select > optgroup > option") .mapIndexed { num, opt -> Page(num, opt.absUrl("value")) } - override fun imageUrlParse(response: Response) = - response.asJsoup().selectFirst(".comic_comic > img").absUrl("src")!! + override fun imageUrlParse(response: Response): String = + response.asJsoup().selectFirst(".comic_comic > img")!!.absUrl("src") override fun popularMangaRequest(page: Int): Request = throw UnsupportedOperationException("Not used") diff --git a/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUtils.kt b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUtils.kt index b978f9d36..d0460668f 100644 --- a/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUtils.kt +++ b/src/en/tsumino/src/eu/kanade/tachiyomi/extension/en/tsumino/TsuminoUtils.kt @@ -33,7 +33,7 @@ class TsuminoUtils { } } - return if (stringBuilder.toString().isEmpty()) null else stringBuilder.toString() + return stringBuilder.toString().ifEmpty { null } } fun getDesc(document: Document): String { @@ -99,12 +99,12 @@ class TsuminoUtils { } fun cfDecodeEmails(document: Document) { - document.select(".__cf_email__")!! + document.select(".__cf_email__") .map { it to cfDecodeEmail(it.attr("data-cfemail")) } .forEach { (element, plaintext) -> element.text(plaintext) } } - fun cfDecodeEmail(encoded: String): String { + private fun cfDecodeEmail(encoded: String): String { val encodedList = encoded .chunked(2) .map { it.toIntOrNull(16) } diff --git a/src/en/vgperson/src/eu/kanade/tachiyomi/extension/en/vgperson/Vgperson.kt b/src/en/vgperson/src/eu/kanade/tachiyomi/extension/en/vgperson/Vgperson.kt index 481a02a7c..720b71103 100644 --- a/src/en/vgperson/src/eu/kanade/tachiyomi/extension/en/vgperson/Vgperson.kt +++ b/src/en/vgperson/src/eu/kanade/tachiyomi/extension/en/vgperson/Vgperson.kt @@ -59,12 +59,12 @@ class Vgperson : ParsedHttpSource() { } override fun mangaDetailsParse(document: Document) = SManga.create().apply { - status = when (document.select(".chaptername").first().text()) { + status = when (document.select(".chaptername").first()!!.text()) { "(Complete)" -> SManga.COMPLETED "(Series in Progress)" -> SManga.ONGOING else -> SManga.UNKNOWN } - description = document.select(".content").first() + description = document.select(".content").first()!! .childNodes().drop(5).takeWhile { it.nodeName() != "table" }.joinToString("") { @@ -82,17 +82,17 @@ class Vgperson : ParsedHttpSource() { override fun chapterListSelector() = ".chaptertable tbody tr" override fun chapterFromElement(element: Element) = SChapter.create().apply { - element.select("td > a").first().let { + element.select("td > a").first()!!.let { name = it.text() url = it.attr("href") } // append the name if it exists & remove the occasional hyphen - element.select(".chaptername")?.first()?.let { + element.select(".chaptername").first()?.let { name += " - ${it.text().substringAfter("- ")}" } // hardcode special chapter numbers for Three Days of Happiness chapter_number = url.substringAfterLast("c=").toFloatOrNull() - ?: 16.5f + "0.${url.substringAfterLast("b=")}".toFloat() + ?: (16.5f + "0.${url.substringAfterLast("b=")}".toFloat()) scanlator = "vgperson" date_upload = 0L } diff --git a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt index 49085ab0a..0e9c8e4dc 100644 --- a/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt +++ b/src/en/vizshonenjump/src/eu/kanade/tachiyomi/extension/en/vizshonenjump/VizShonenJump.kt @@ -84,7 +84,7 @@ class VizShonenJump : ParsedHttpSource() { "section.section_chapters div.o_sort_container div.o_sortable > a.o_chapters-link" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("div.pad-x-rg").text() + title = element.selectFirst("div.pad-x-rg")!!.text() thumbnail_url = element.selectFirst("div.pos-r img.disp-bl") ?.attr("data-original") url = element.attr("href") @@ -139,7 +139,7 @@ class VizShonenJump : ParsedHttpSource() { override fun searchMangaNextPageSelector(): String? = null override fun mangaDetailsParse(document: Document): SManga { - val seriesIntro = document.select("section#series-intro").first() + val seriesIntro = document.select("section#series-intro").first()!! // Get the thumbnail url from the manga list (if available), // or fetch it for the first time (in backup restore, for example). @@ -215,7 +215,7 @@ class VizShonenJump : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - val pageCount = document.select("script:containsData(var pages)").first().data() + val pageCount = document.select("script:containsData(var pages)").first()!!.data() .substringAfter("= ") .substringBefore(";") .toInt() diff --git a/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt b/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt index ae77847a8..46b705a9b 100644 --- a/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt +++ b/src/en/voyceme/src/eu/kanade/tachiyomi/extension/en/voyceme/VoyceMe.kt @@ -266,7 +266,7 @@ class VoyceMe : HttpSource() { // GraphQL endpoints do not have the chapter images, so we need // to get the buildId to fetch the chapter from NextJS static data. val document = response.asJsoup() - val nextData = document.selectFirst("script#__NEXT_DATA__").data() + val nextData = document.selectFirst("script#__NEXT_DATA__")!!.data() val nextJson = json.parseToJsonElement(nextData).jsonObject val buildId = nextJson["buildId"]!!.jsonPrimitive.content diff --git a/src/en/vyvymanga/src/eu/kanade/tachiyomi/extension/en/vyvymanga/VyvyManga.kt b/src/en/vyvymanga/src/eu/kanade/tachiyomi/extension/en/vyvymanga/VyvyManga.kt index 5019e29b4..082c96930 100644 --- a/src/en/vyvymanga/src/eu/kanade/tachiyomi/extension/en/vyvymanga/VyvyManga.kt +++ b/src/en/vyvymanga/src/eu/kanade/tachiyomi/extension/en/vyvymanga/VyvyManga.kt @@ -36,7 +36,7 @@ class VyvyManga : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga = searchMangaFromElement(element) - override fun popularMangaNextPageSelector(): String? = + override fun popularMangaNextPageSelector(): String = searchMangaNextPageSelector() // Search @@ -48,8 +48,7 @@ class VyvyManga : ParsedHttpSource() { return GET(url.toString(), headers) } - override fun searchMangaSelector(): String = - ".comic-item" + override fun searchMangaSelector(): String = ".comic-item" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { setUrlWithoutDomain(element.selectFirst("a")!!.absUrl("href")) @@ -57,8 +56,7 @@ class VyvyManga : ParsedHttpSource() { thumbnail_url = element.selectFirst(".comic-image")!!.absUrl("data-background-image") } - override fun searchMangaNextPageSelector(): String? = - "[rel=next]" + override fun searchMangaNextPageSelector(): String = "[rel=next]" // Latest override fun latestUpdatesRequest(page: Int): Request = @@ -85,7 +83,7 @@ class VyvyManga : ParsedHttpSource() { "Completed" -> SManga.COMPLETED else -> SManga.UNKNOWN } - thumbnail_url = document.selectFirst(".img-manga").absUrl("src") + thumbnail_url = document.selectFirst(".img-manga")!!.absUrl("src") } // Chapters @@ -94,7 +92,7 @@ class VyvyManga : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { url = element.absUrl("href") - name = element.selectFirst("span").text() + name = element.selectFirst("span")!!.text() date_upload = parseChapterDate(element.selectFirst("> p")?.text()) } diff --git a/src/en/webcomics/src/eu/kanade/tachiyomi/extension/en/webcomics/Webcomics.kt b/src/en/webcomics/src/eu/kanade/tachiyomi/extension/en/webcomics/Webcomics.kt index 780d8d836..82f7558bd 100644 --- a/src/en/webcomics/src/eu/kanade/tachiyomi/extension/en/webcomics/Webcomics.kt +++ b/src/en/webcomics/src/eu/kanade/tachiyomi/extension/en/webcomics/Webcomics.kt @@ -38,7 +38,7 @@ class Webcomics : ParsedHttpSource() { private fun mangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a").first().let { + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.select("h5").text() } @@ -73,7 +73,7 @@ class Webcomics : ParsedHttpSource() { val manga = SManga.create() infoElement.let { manga.title = it.select(".wiki-book-title").text().trim() - manga.setUrlWithoutDomain(it.select("a").first().attr("href")) + manga.setUrlWithoutDomain(it.select("a").first()!!.attr("href")) } return manga } @@ -97,8 +97,8 @@ class Webcomics : ParsedHttpSource() { override fun searchMangaParse(response: Response): MangasPage { val document = response.asJsoup() var nextPage = true - val mangas = document.select(searchMangaSelector()).filter { - val shouldFilter = it.select(".col-md-2 > a").first().text() == "READ" + val mangas = document.select(searchMangaSelector()).toList().filter { + val shouldFilter = it.select(".col-md-2 > a").first()!!.text() == "READ" if (nextPage) { nextPage = shouldFilter } diff --git a/src/es/heavenmanga/src/eu/kanade/tachiyomi/extension/es/heavenmanga/HeavenManga.kt b/src/es/heavenmanga/src/eu/kanade/tachiyomi/extension/es/heavenmanga/HeavenManga.kt index a04a635ff..26e416e33 100644 --- a/src/es/heavenmanga/src/eu/kanade/tachiyomi/extension/es/heavenmanga/HeavenManga.kt +++ b/src/es/heavenmanga/src/eu/kanade/tachiyomi/extension/es/heavenmanga/HeavenManga.kt @@ -152,7 +152,7 @@ class HeavenManga : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - return document.select("script:containsData(pUrl)").first().data() + return document.select("script:containsData(pUrl)").first()!!.data() .substringAfter("pUrl=[").substringBefore("\"},];").split("\"},") .mapIndexed { i, string -> Page(i, "", string.substringAfterLast("\"")) } } diff --git a/src/es/ikuhentai/src/eu/kanade/tachiyomi/extension/es/ikuhentai/Ikuhentai.kt b/src/es/ikuhentai/src/eu/kanade/tachiyomi/extension/es/ikuhentai/Ikuhentai.kt index d97d112bf..4c8eb6a39 100755 --- a/src/es/ikuhentai/src/eu/kanade/tachiyomi/extension/es/ikuhentai/Ikuhentai.kt +++ b/src/es/ikuhentai/src/eu/kanade/tachiyomi/extension/es/ikuhentai/Ikuhentai.kt @@ -45,7 +45,7 @@ class Ikuhentai : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() manga.thumbnail_url = element.select("img").attr("data-src") - element.select("div.tab-thumb > a").first().let { + element.select("div.tab-thumb > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.attr("title") } @@ -110,11 +110,11 @@ class Ikuhentai : ParsedHttpSource() { // max 200 results override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.site-content").first() + val infoElement = document.select("div.site-content").first()!! val manga = SManga.create() - manga.author = infoElement.select("div.author-content")?.text() - manga.artist = infoElement.select("div.artist-content")?.text() + manga.author = infoElement.select("div.author-content").text() + manga.artist = infoElement.select("div.artist-content").text() val genres = mutableListOf() infoElement.select("div.genres-content a").forEach { element -> @@ -124,7 +124,7 @@ class Ikuhentai : ParsedHttpSource() { manga.genre = genres.joinToString(", ") manga.status = parseStatus(infoElement.select("div.post-status > div:nth-child(2) > div.summary-content").text()) - manga.description = document.select("div.description-summary")?.text() + manga.description = document.select("div.description-summary").text() manga.thumbnail_url = document.select("div.summary_image > a > img").attr("data-src") return manga @@ -139,7 +139,7 @@ class Ikuhentai : ParsedHttpSource() { override fun chapterListSelector() = "li.wp-manga-chapter" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! var url = urlElement.attr("href") url = url.replace("/p/1", "") url += "?style=list" diff --git a/src/es/kingsofdarkness/src/eu/kanade/tachiyomi/extension/es/kingsofdarkness/KingsOfDarkness.kt b/src/es/kingsofdarkness/src/eu/kanade/tachiyomi/extension/es/kingsofdarkness/KingsOfDarkness.kt index cc634357c..f916f679d 100644 --- a/src/es/kingsofdarkness/src/eu/kanade/tachiyomi/extension/es/kingsofdarkness/KingsOfDarkness.kt +++ b/src/es/kingsofdarkness/src/eu/kanade/tachiyomi/extension/es/kingsofdarkness/KingsOfDarkness.kt @@ -26,8 +26,8 @@ class KingsOfDarkness : ParsedHttpSource() { override fun popularMangaFromElement(element: Element) = SManga.create().apply { url = element.child(0).attr("href") - title = element.nextElementSibling().text() - thumbnail_url = element.selectFirst("img").image + title = element.nextElementSibling()!!.text() + thumbnail_url = element.selectFirst("img")!!.image } override fun fetchSearchManga(page: Int, query: String, filters: FilterList) = @@ -41,8 +41,8 @@ class KingsOfDarkness : ParsedHttpSource() { override fun mangaDetailsParse(document: Document) = SManga.create().apply { url = document.location() - title = document.selectFirst("#SITE_PAGES h2").text() - thumbnail_url = document.selectFirst("#SITE_PAGES img").image + title = document.selectFirst("#SITE_PAGES h2")!!.text() + thumbnail_url = document.selectFirst("#SITE_PAGES img")!!.image document.select("#SITE_PAGES p:last-of-type").let { el -> description = el[0].text().trim() genre = el[1].select("a").joinToString { it.text() } diff --git a/src/es/kumanga/src/eu/kanade/tachiyomi/extension/es/kumanga/Kumanga.kt b/src/es/kumanga/src/eu/kanade/tachiyomi/extension/es/kumanga/Kumanga.kt index c9e35ab90..96c4af4ac 100755 --- a/src/es/kumanga/src/eu/kanade/tachiyomi/extension/es/kumanga/Kumanga.kt +++ b/src/es/kumanga/src/eu/kanade/tachiyomi/extension/es/kumanga/Kumanga.kt @@ -142,7 +142,7 @@ class Kumanga : HttpSource() { name = it.text() date_upload = parseChapterDate(it.attr("title")) } - scanlator = element.select("span.pull-right.greenSpan")?.text() + scanlator = element.select("span.pull-right.greenSpan").text() } override fun chapterListParse(response: Response): List = mutableListOf().apply { diff --git a/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt b/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt index 35a53a4b2..29a666030 100755 --- a/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt +++ b/src/es/lectormanga/src/eu/kanade/tachiyomi/extension/es/lectormanga/LectorManga.kt @@ -189,8 +189,8 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() { genre = document.select("a.py-2").joinToString(", ") { it.text() } - description = document.select(".col-12.mt-2")?.text() - status = parseStatus(document.select(".status-publishing")?.text().orEmpty()) + description = document.select(".col-12.mt-2").text() + status = parseStatus(document.select(".status-publishing").text().orEmpty()) thumbnail_url = document.select(".text-center img.img-fluid").attr("src") } @@ -232,7 +232,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() { private fun oneShotChapterFromElement(element: Element) = SChapter.create().apply { url = element.select("div.row > .text-right > a").attr("href") name = "One Shot" - scanlator = element.select("div.col-12.col-sm-12.col-md-4.text-truncate span")?.text() + scanlator = element.select("div.col-12.col-sm-12.col-md-4.text-truncate span").text() date_upload = element.select("span.badge.badge-primary.p-2").first()?.text()?.let { parseChapterDate(it) } ?: 0 } @@ -240,7 +240,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() { private fun regularChapterFromElement(chapterName: String, info: Element, number: Float) = SChapter.create().apply { url = info.select("div.row > .text-right > a").attr("href") name = chapterName - scanlator = info.select("div.col-12.col-sm-12.col-md-4.text-truncate span")?.text() + scanlator = info.select("div.col-12.col-sm-12.col-md-4.text-truncate span").text() date_upload = info.select("span.badge.badge-primary.p-2").first()?.text()?.let { parseChapterDate(it) } ?: 0 @@ -286,7 +286,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() { ) } } else { - val body = doc.select("script:containsData(var dirPath)").first().data() + val body = doc.select("script:containsData(var dirPath)").first()!!.data() val path = body.substringAfter("var dirPath = '").substringBefore("'") body.substringAfter("var images = JSON.parse('[") diff --git a/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt b/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt index cd924c054..f9653cfe4 100644 --- a/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt +++ b/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt @@ -82,9 +82,9 @@ open class LeerCapitulo : ParsedHttpSource() { ".mainpage-manga" override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { - setUrlWithoutDomain(element.selectFirst(".media-body > a").attr("abs:href")) - title = element.selectFirst("h4").text() - thumbnail_url = element.selectFirst("img").attr("abs:src") + setUrlWithoutDomain(element.selectFirst(".media-body > a")!!.attr("abs:href")) + title = element.selectFirst("h4")!!.text() + thumbnail_url = element.selectFirst("img")!!.attr("abs:src") } override fun latestUpdatesNextPageSelector(): String? = @@ -92,18 +92,18 @@ open class LeerCapitulo : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("h1").text() + title = document.selectFirst("h1")!!.text() val altNames = document.selectFirst(".description-update > span:contains(Títulos Alternativos:) + :matchText")?.text() - val desc = document.selectFirst("#example2").text() + val desc = document.selectFirst("#example2")!!.text() description = when (altNames) { null -> desc else -> "$desc\n\nAlt name(s): $altNames" } genre = document.select(".description-update a[href^='/genre/']").joinToString { it.text() } - status = document.selectFirst(".description-update > span:contains(Estado:) + :matchText").text().toStatus() - thumbnail_url = document.selectFirst(".cover-detail > img").attr("abs:src") + status = document.selectFirst(".description-update > span:contains(Estado:) + :matchText")!!.text().toStatus() + thumbnail_url = document.selectFirst(".cover-detail > img")!!.attr("abs:src") } // Chapters @@ -111,7 +111,7 @@ open class LeerCapitulo : ParsedHttpSource() { ".chapter-list > ul > li" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - val a = element.selectFirst("a.xanh") + val a = element.selectFirst("a.xanh")!! setUrlWithoutDomain(a.attr("abs:href")) name = a.text() chapter_number = name @@ -123,8 +123,7 @@ open class LeerCapitulo : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { - val urls = document.selectFirst("#arraydata").text().split(',') - + val urls = document.selectFirst("#arraydata")!!.text().split(',') return urls.mapIndexed { i, image_url -> Page(i, "", image_url) } diff --git a/src/es/leermangasxyz/src/eu/kanade/tachiyomi/extension/es/leermangasxyz/LeerMangasXYZ.kt b/src/es/leermangasxyz/src/eu/kanade/tachiyomi/extension/es/leermangasxyz/LeerMangasXYZ.kt index 1beab77a9..04c26175f 100644 --- a/src/es/leermangasxyz/src/eu/kanade/tachiyomi/extension/es/leermangasxyz/LeerMangasXYZ.kt +++ b/src/es/leermangasxyz/src/eu/kanade/tachiyomi/extension/es/leermangasxyz/LeerMangasXYZ.kt @@ -40,7 +40,7 @@ open class LeerMangasXYZ : ParsedHttpSource() { } with(row[1]) { name = text() - url = selectFirst("a").attr("href") + url = selectFirst("a")!!.attr("href") } } @@ -49,17 +49,12 @@ open class LeerMangasXYZ : ParsedHttpSource() { } override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { setUrlWithoutDomain(document.baseUri()) - val rawStatus = document.selectFirst("td:contains(Status)").text() - println(" Status: $rawStatus") + val rawStatus = document.selectFirst("td:contains(Status)")!!.text() status = getStatus(rawStatus.substringAfter("Status: ")) - - author = document.select("li[itemprop=author]")?.joinToString(separator = ", ") { it.text() } - - thumbnail_url = document.selectFirst("img.img-thumbnail").attr("abs:src") - - description = document.selectFirst("p[itemprop=description]").text() - - genre = document.select("span[itemprop=genre]")?.joinToString(", ") { it.text() } + author = document.select("li[itemprop=author]").joinToString(separator = ", ") { it.text() } + thumbnail_url = document.selectFirst("img.img-thumbnail")!!.attr("abs:src") + description = document.selectFirst("p[itemprop=description]")!!.text() + genre = document.select("span[itemprop=genre]").joinToString(", ") { it.text() } } override fun pageListParse(document: Document): List { @@ -69,16 +64,16 @@ open class LeerMangasXYZ : ParsedHttpSource() { index = it.attr("data-ngdesc").substringAfter("Page ").toInt(), ) } - if (pages.isNullOrEmpty()) { + if (pages.isEmpty()) { throw RuntimeException("Cannot fetch images from source") } return pages } override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - thumbnail_url = element.selectFirst("img.card-img-top").attr("abs:src") - element.selectFirst("div.card-body").let { - val dc = it.selectFirst("h5.card-title a") + thumbnail_url = element.selectFirst("img.card-img-top")!!.attr("abs:src") + element.selectFirst("div.card-body")!!.let { + val dc = it.selectFirst("h5.card-title a")!! url = dc.attr("href") title = dc.text() } @@ -86,13 +81,13 @@ open class LeerMangasXYZ : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { with(element) { - thumbnail_url = selectFirst("img").attr("abs:src") - title = selectFirst("span[itemprop=name]").text() - url = selectFirst("div.col-4 a").attr("href") + thumbnail_url = selectFirst("img")!!.attr("abs:src") + title = selectFirst("span[itemprop=name]")!!.text() + url = selectFirst("div.col-4 a")!!.attr("href") } } - fun encodeString(str: String): String = URLEncoder.encode(str, "utf-8") + private fun encodeString(str: String): String = URLEncoder.encode(str, "utf-8") private fun getStatus(str: String): Int = when (str) { "Emitiéndose", "Ongoing", "En emisión" -> SManga.ONGOING diff --git a/src/es/mahnwalatino/src/eu/kanade/tachiyomi/extension/es/manhwalatino/ManhwaLatinoSiteParser.kt b/src/es/mahnwalatino/src/eu/kanade/tachiyomi/extension/es/manhwalatino/ManhwaLatinoSiteParser.kt index 10aefad95..b2089c033 100644 --- a/src/es/mahnwalatino/src/eu/kanade/tachiyomi/extension/es/manhwalatino/ManhwaLatinoSiteParser.kt +++ b/src/es/mahnwalatino/src/eu/kanade/tachiyomi/extension/es/manhwalatino/ManhwaLatinoSiteParser.kt @@ -46,7 +46,7 @@ class ManhwaLatinoSiteParser( val manga = SManga.create() manga.url = getUrlWithoutDomain( - element.select(MLConstants.latestUpdatesSelectorUrl).first().attr("abs:href"), + element.select(MLConstants.latestUpdatesSelectorUrl).first()!!.attr("abs:href"), ) manga.title = element.select(MLConstants.latestUpdatesSelectorTitle).text().trim() manga.thumbnail_url = getImage(element.select(MLConstants.latestUpdatesSelectorThumbnailUrl)).replace("//", "/") @@ -133,7 +133,7 @@ class ManhwaLatinoSiteParser( val tagList = document.select(MLConstants.mangaDetailsTagsHTMLSelector).map { it.text() } val genreTagList = genrelist + tagList - manga.title = titleElements.last().ownText().trim() + manga.title = titleElements.last()!!.ownText().trim() manga.thumbnail_url = getImage(document.select(MLConstants.mangaDetailsThumbnailUrlHTMLSelector)) manga.description = descriptionList.joinToString("\n") manga.author = author.ifBlank { "Autor Desconocido" } @@ -148,8 +148,8 @@ class ManhwaLatinoSiteParser( return SManga.COMPLETED } elements.forEach { element -> - val key = element.select("div.summary-heading h5")?.text()?.trim() - val value = element.select("div.summary-content")?.text()?.trim() + val key = element.select("div.summary-heading h5").text().trim() + val value = element.select("div.summary-content").text().trim() if (key == "Estado del comic") { return when (value) { diff --git a/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaOni.kt b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaOni.kt index 1759ac919..f704ac5eb 100644 --- a/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaOni.kt +++ b/src/es/mangamx/src/eu/kanade/tachiyomi/extension/es/mangamx/MangaOni.kt @@ -177,7 +177,7 @@ open class MangaOni : ConfigurableSource, ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() manga.thumbnail_url = document.select("img[src*=cover]").attr("abs:src") - manga.description = document.select("div#sinopsis").last().ownText() + manga.description = document.select("div#sinopsis").last()!!.ownText() manga.author = document.select("div#info-i").text().let { if (it.contains("Autor", true)) { it.substringAfter("Autor:").substringBefore("Fecha:").trim() @@ -187,7 +187,7 @@ open class MangaOni : ConfigurableSource, ParsedHttpSource() { } manga.artist = manga.author manga.genre = document.select("div#categ a").joinToString(", ") { it.text() } - manga.status = when (document.select("span#desarrollo")?.first()?.text()) { + manga.status = when (document.select("span#desarrollo").first()?.text()) { "En desarrollo" -> SManga.ONGOING // "Completed" -> SManga.COMPLETED else -> SManga.UNKNOWN diff --git a/src/es/manhwasnet/src/eu/kanade/tachiyomi/extension/es/manhwasnet/ManhwasNet.kt b/src/es/manhwasnet/src/eu/kanade/tachiyomi/extension/es/manhwasnet/ManhwasNet.kt index acb9218aa..df80c91ce 100644 --- a/src/es/manhwasnet/src/eu/kanade/tachiyomi/extension/es/manhwasnet/ManhwasNet.kt +++ b/src/es/manhwasnet/src/eu/kanade/tachiyomi/extension/es/manhwasnet/ManhwasNet.kt @@ -38,8 +38,8 @@ class ManhwasNet : HttpSource() { override fun latestUpdatesParse(response: Response): MangasPage { val document = response.asJsoup() - val content18 = document.select(".list-unstyled.row").get(0) - val content15 = document.select(".list-unstyled.row").get(1) + val content18 = document.select(".list-unstyled.row")[0] + val content15 = document.select(".list-unstyled.row")[1] val manhwas = parseManhwas(content18) + parseManhwas(content15) return MangasPage(manhwas, false) } @@ -50,11 +50,11 @@ class ManhwasNet : HttpSource() { override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() - val profileManga = document.selectFirst(".anime-single") + val profileManga = document.selectFirst(".anime-single")!! val manhwa = SManga.create() - manhwa.title = profileManga.selectFirst(".title").text() - manhwa.thumbnail_url = profileManga.selectFirst("img").attr("src") - manhwa.description = profileManga.selectFirst(".sinopsis").text().substringAfter(manhwa.title + " ") + manhwa.title = profileManga.selectFirst(".title")!!.text() + manhwa.thumbnail_url = profileManga.selectFirst("img")!!.attr("src") + manhwa.description = profileManga.selectFirst(".sinopsis")!!.text().substringAfter(manhwa.title + " ") val status = profileManga.select(".anime-type-peli.text-white").text() manhwa.status = SManga.ONGOING if (!status.contains("Publicándose")) manhwa.status = SManga.COMPLETED @@ -66,7 +66,7 @@ class ManhwasNet : HttpSource() { val document = response.asJsoup() return document.select("#chapter_imgs img").mapIndexed { i, img -> var url = img.attr("src") - if (url.toString().equals("/discord.jpg")) { + if (url.toString() == "/discord.jpg") { url = "$baseUrl/discord.jpg" } Page(i, imageUrl = url) @@ -100,7 +100,7 @@ class ManhwasNet : HttpSource() { private fun parseLibraryMangas(response: Response): MangasPage { val document = response.asJsoup() - val content = document.selectFirst(".animes") + val content = document.selectFirst(".animes")!! val manhwas = parseManhwas(content) val hasNextPage = document.selectFirst(".pagination .page-link[rel=\"next\"]") != null return MangasPage(manhwas, hasNextPage) @@ -109,8 +109,8 @@ class ManhwasNet : HttpSource() { private fun parseManhwas(element: Element): List { return element.select(".anime").map { anime -> val manhwa = SManga.create() - manhwa.title = anime.selectFirst(".title").text().trim() - manhwa.thumbnail_url = anime.selectFirst("img").attr("src") + manhwa.title = anime.selectFirst(".title")!!.text().trim() + manhwa.thumbnail_url = anime.selectFirst("img")!!.attr("src") manhwa.url = getUrlWithoutDomain( transformUrl(anime.select("a").attr("href")), ) diff --git a/src/es/tmohentai/src/eu/kanade/tachiyomi/extension/es/tmohentai/TMOHentai.kt b/src/es/tmohentai/src/eu/kanade/tachiyomi/extension/es/tmohentai/TMOHentai.kt index b2fcb3ccf..9bd86b4f5 100755 --- a/src/es/tmohentai/src/eu/kanade/tachiyomi/extension/es/tmohentai/TMOHentai.kt +++ b/src/es/tmohentai/src/eu/kanade/tachiyomi/extension/es/tmohentai/TMOHentai.kt @@ -105,11 +105,11 @@ class TMOHentai : ConfigurableSource, ParsedHttpSource() { override fun pageListParse(document: Document): List = mutableListOf().apply { if (getPageMethodPref() == "cascade") { - document.select("div#content-images img.content-image")?.forEach { + document.select("div#content-images img.content-image").forEach { add(Page(size, "", it.attr("data-original"))) } } else { - val pageList = document.select("select#select-page").first().select("option").map { it.attr("value").toInt() } + val pageList = document.select("select#select-page").first()!!.select("option").map { it.attr("value").toInt() } val url = document.baseUri() pageList.forEach { @@ -118,7 +118,7 @@ class TMOHentai : ConfigurableSource, ParsedHttpSource() { } } - override fun imageUrlParse(document: Document) = document.select("div#content-images img.content-image").attr("data-original") + override fun imageUrlParse(document: Document): String = document.select("div#content-images img.content-image").attr("data-original") override fun imageRequest(page: Page) = GET("$baseUrl${page.imageUrl!!}", headers) @@ -317,7 +317,6 @@ class TMOHentai : ConfigurableSource, ParsedHttpSource() { private const val PAGE_METHOD_PREF_TITLE = "Método de descarga de imágenes" private const val PAGE_METHOD_PREF_SUMMARY = "Puede corregir errores al cargar las imágenes.\nConfiguración actual: %s" private const val PAGE_METHOD_PREF_CASCADE = "cascade" - private const val PAGE_METHOD_PREF_PAGINATED = "paginated" private const val PAGE_METHOD_PREF_DEFAULT_VALUE = PAGE_METHOD_PREF_CASCADE const val PREFIX_CONTENTS = "contents" diff --git a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt index 7f32e950e..1e18053d8 100644 --- a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt +++ b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt @@ -159,14 +159,14 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { override fun mangaDetailsParse(document: Document) = SManga.create().apply { title = document.select("h2.element-subtitle").text() document.select("h5.card-title").let { - author = it?.first()?.attr("title")?.substringAfter(", ") - artist = it?.last()?.attr("title")?.substringAfter(", ") + author = it.first()?.attr("title")?.substringAfter(", ") + artist = it.last()?.attr("title")?.substringAfter(", ") } genre = document.select("a.py-2").joinToString(", ") { it.text() } - description = document.select("p.element-description")?.text() - status = parseStatus(document.select("span.book-status")?.text().orEmpty()) + description = document.select("p.element-description").text() + status = parseStatus(document.select("span.book-status").text().orEmpty()) thumbnail_url = document.select(".book-thumbnail").attr("src") } private fun parseStatus(status: String) = when { @@ -200,7 +200,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { private fun oneShotChapterFromElement(element: Element) = SChapter.create().apply { url = element.select("div.row > .text-right > a").attr("href") name = "One Shot" - scanlator = element.select("div.col-md-6.text-truncate")?.text() + scanlator = element.select("div.col-md-6.text-truncate").text() date_upload = element.select("span.badge.badge-primary.p-2").first()?.text()?.let { parseChapterDate(it) } ?: 0 } @@ -208,7 +208,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { private fun regularChapterFromElement(element: Element, chName: String) = SChapter.create().apply { url = element.select("div.row > .text-right > a").attr("href") name = chName - scanlator = element.select("div.col-md-6.text-truncate")?.text() + scanlator = element.select("div.col-md-6.text-truncate").text() date_upload = element.select("span.badge.badge-primary.p-2").first()?.text()?.let { parseChapterDate(it) } ?: 0 } @@ -247,7 +247,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { ) } } else { - val pageList = doc.select("#viewer-pages-select").first().select("option").map { it.attr("value").toInt() } + val pageList = doc.select("#viewer-pages-select").first()!!.select("option").map { it.attr("value").toInt() } val url = doc.baseUri() pageList.forEach { add(Page(it, "$url/$it")) @@ -442,7 +442,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { } override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) { - val SFWModePref = androidx.preference.CheckBoxPreference(screen.context).apply { + val sfwModePref = androidx.preference.CheckBoxPreference(screen.context).apply { key = SFW_MODE_PREF title = SFW_MODE_PREF_TITLE summary = SFW_MODE_PREF_SUMMARY @@ -524,7 +524,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() { } } - screen.addPreference(SFWModePref) + screen.addPreference(sfwModePref) screen.addPreference(scanlatorPref) screen.addPreference(pageMethodPref) screen.addPreference(apiRateLimitPreference) diff --git a/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMP.kt b/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMP.kt index 1c82fc0f3..f01381e80 100644 --- a/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMP.kt +++ b/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMP.kt @@ -32,7 +32,7 @@ open class VCPVMP(override val name: String, override val baseUrl: String) : Par override fun popularMangaSelector() = "div#ccontent div.gallery" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - element.select("a.cover").first().let { + element.select("a.cover").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.select("div.caption").text() thumbnail_url = it.select("img").attr("abs:src").substringBefore("?") diff --git a/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMPFactory.kt b/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMPFactory.kt index 96643bdec..c7c26cd92 100644 --- a/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMPFactory.kt +++ b/src/es/vcpvmp/src/eu/kanade/tachiyomi/extension/es/vcpvmp/VCPVMPFactory.kt @@ -22,9 +22,9 @@ class VCP : VCPVMP("VCP", "https://vercomicsporno.com") { override fun popularMangaNextPageSelector() = "span.current + a" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - element.select("a.popimg").first().let { + element.select("a.popimg").first()!!.let { setUrlWithoutDomain(it.attr("href")) - it.select("figure img").first().let { img -> + it.select("figure img").first()!!.let { img -> title = img.attr("alt") thumbnail_url = img.attr("abs:src") } diff --git a/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt b/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt index 391badc60..358bfdb17 100644 --- a/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt +++ b/src/fr/furyosquad/src/eu/kanade/tachiyomi/extension/fr/furyosquad/FuryoSquad.kt @@ -122,9 +122,9 @@ class FuryoSquad : ParsedHttpSource() { document.select("div.comic-info").let { it.select("p.fs-comic-label").forEach { el -> when (el.text().lowercase(Locale.ROOT)) { - "scénario" -> manga.author = el.nextElementSibling().text() - "dessins" -> manga.artist = el.nextElementSibling().text() - "genre" -> manga.genre = el.nextElementSibling().text() + "scénario" -> manga.author = el.nextElementSibling()!!.text() + "dessins" -> manga.artist = el.nextElementSibling()!!.text() + "genre" -> manga.genre = el.nextElementSibling()!!.text() } } manga.description = it.select("div.fs-comic-description").text() diff --git a/src/fr/japanread/src/eu/kanade/tachiyomi/extension/fr/japanread/Japanread.kt b/src/fr/japanread/src/eu/kanade/tachiyomi/extension/fr/japanread/Japanread.kt index 458d40209..2d475260a 100644 --- a/src/fr/japanread/src/eu/kanade/tachiyomi/extension/fr/japanread/Japanread.kt +++ b/src/fr/japanread/src/eu/kanade/tachiyomi/extension/fr/japanread/Japanread.kt @@ -213,7 +213,7 @@ class Japanread : ParsedHttpSource() { val document = response.asJsoup() val mangaId = document.select("div[data-avg]").attr("data-avg") - client.newCall(GET(baseUrl + document.select("#chapters div[data-row=chapter]").first().select("div.col-lg-5 a").attr("href"), headers)).execute() + client.newCall(GET(baseUrl + document.select("#chapters div[data-row=chapter]").first()!!.select("div.col-lg-5 a").attr("href"), headers)).execute() val apiResponse = client.newCall(GET("$baseUrl/api/?id=$mangaId&type=manga", apiHeaders())).execute() diff --git a/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt b/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt index 525866992..8582f7ba7 100644 --- a/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt +++ b/src/fr/japscan/src/eu/kanade/tachiyomi/extension/fr/japscan/Japscan.kt @@ -91,7 +91,7 @@ class Japscan : ConfigurableSource, ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a").first().let { + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() manga.thumbnail_url = "$baseUrl/imgs/${it.attr("href").replace(Regex("/$"),".jpg").replace("manga","mangas")}".lowercase(Locale.ROOT) @@ -207,7 +207,7 @@ class Japscan : ConfigurableSource, ParsedHttpSource() { } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.selectFirst("#main .card-body") + val infoElement = document.selectFirst("#main .card-body")!! val manga = SManga.create() manga.thumbnail_url = infoElement.select("img").attr("abs:src") @@ -240,13 +240,13 @@ class Japscan : ConfigurableSource, ParsedHttpSource() { // Those have a span.badge "SPOILER" or "RAW". The additional pseudo selector makes sure to exclude these from the chapter list. override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.selectFirst("a") + val urlElement = element.selectFirst("a")!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = urlElement.ownText() // Using ownText() doesn't include childs' text, like "VUS" or "RAW" badges, in the chapter name. - chapter.date_upload = element.selectFirst("span").text().trim().let { parseChapterDate(it) } + chapter.date_upload = element.selectFirst("span")!!.text().trim().let { parseChapterDate(it) } return chapter } @@ -289,7 +289,7 @@ class Japscan : ConfigurableSource, ParsedHttpSource() { } Log.d("japscan", "lookup tables: $stringLookupTables") - val scrambledData = document.getElementById("data").attr("data-data") + val scrambledData = document.getElementById("data")!!.attr("data-data") for (i in 0..1) { Log.d("japscan", "descramble attempt $i") diff --git a/src/fr/lirescan/src/eu/kanade/tachiyomi/extension/fr/lirescan/LireScan.kt b/src/fr/lirescan/src/eu/kanade/tachiyomi/extension/fr/lirescan/LireScan.kt index 2674508c6..ece1de1b3 100644 --- a/src/fr/lirescan/src/eu/kanade/tachiyomi/extension/fr/lirescan/LireScan.kt +++ b/src/fr/lirescan/src/eu/kanade/tachiyomi/extension/fr/lirescan/LireScan.kt @@ -57,7 +57,7 @@ class LireScan : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga { return SManga.create().apply { title = element.text() - url = element.nextElementSibling().select("a").first().attr("href") + url = element.nextElementSibling()!!.select("a").first()!!.attr("href") .removeSuffix("/").dropLastWhile { it.isDigit() } } } @@ -79,7 +79,8 @@ class LireScan : ParsedHttpSource() { } private fun searchMangaParse(response: Response, query: String): MangasPage { - val mangas = response.asJsoup().select(popularMangaSelector()).filter { it.text().contains(query, ignoreCase = true) } + val mangas = response.asJsoup().select(popularMangaSelector()).toList() + .filter { it.text().contains(query, ignoreCase = true) } .map { searchMangaFromElement(it) } return MangasPage(mangas, false) @@ -107,7 +108,7 @@ class LireScan : ParsedHttpSource() { return SChapter.create().apply { element.text().let { chNum -> name = "Chapter $chNum" - setUrlWithoutDomain("${element.ownerDocument().location()}$chNum/") + setUrlWithoutDomain("${element.ownerDocument()!!.location()}$chNum/") } } } @@ -115,8 +116,9 @@ class LireScan : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { - val lastPage = document.select("ul.pagination li.page-item:contains(Suiv)").first() - .previousElementSibling().text().toInt() + val lastPage = document.select("ul.pagination li.page-item:contains(Suiv)").first()!! + .previousElementSibling()!! + .text().toInt() return IntRange(1, lastPage).map { num -> Page(num - 1, document.location() + num) } } diff --git a/src/fr/scantradunion/src/eu/kanade/tachiyomi/extension/fr/scantradunion/ScantradUnion.kt b/src/fr/scantradunion/src/eu/kanade/tachiyomi/extension/fr/scantradunion/ScantradUnion.kt index 84d1f54f9..85eea953d 100644 --- a/src/fr/scantradunion/src/eu/kanade/tachiyomi/extension/fr/scantradunion/ScantradUnion.kt +++ b/src/fr/scantradunion/src/eu/kanade/tachiyomi/extension/fr/scantradunion/ScantradUnion.kt @@ -27,7 +27,7 @@ class ScantradUnion : ParsedHttpSource() { val chapterNumberStr = element.select(".chapter-number").text() // We don't have a css selector to select the date directly, but we know that it will always // be the third child of a .name-chapter. - val dateUploadStr = element.select(".name-chapter").first().children().elementAt(2).text() + val dateUploadStr = element.select(".name-chapter").first()!!.children().elementAt(2).text() val chapterName = element.select(".chapter-name").text() // The only way to get the chapter url is to check all .btnlel and take the one starting with https://... val url = element.select(".btnlel").map { it.attr("href") }.first { it.startsWith("https://scantrad-union.com/read/") } diff --git a/src/id/KomikFan/src/eu/kanade/tachiyomi/extension/id/komikfan/KomikFan.kt b/src/id/KomikFan/src/eu/kanade/tachiyomi/extension/id/komikfan/KomikFan.kt index c1b35f137..9bc591c5f 100644 --- a/src/id/KomikFan/src/eu/kanade/tachiyomi/extension/id/komikfan/KomikFan.kt +++ b/src/id/KomikFan/src/eu/kanade/tachiyomi/extension/id/komikfan/KomikFan.kt @@ -100,7 +100,7 @@ class KomikFan : ParsedHttpSource() { override fun chapterListSelector() = "#Chapter > table tr:has(a)" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("td.judulseries a").first() + val urlElement = element.select("td.judulseries a").first()!! val chapter = SChapter.create() val mangaTitle = element.select("td.judulseries a span").text() chapter.setUrlWithoutDomain(urlElement.attr("href")) @@ -109,7 +109,7 @@ class KomikFan : ParsedHttpSource() { return chapter } - fun parseChapterDate(date: String): Long { + private fun parseChapterDate(date: String): Long { return if (date.contains("yang lalu")) { val value = date.split(' ')[0].toInt() when { diff --git a/src/id/bacakomik/src/eu/kanade/tachiyomi/extension/id/bacakomik/BacaKomik.kt b/src/id/bacakomik/src/eu/kanade/tachiyomi/extension/id/bacakomik/BacaKomik.kt index 093034837..7101c4f0a 100644 --- a/src/id/bacakomik/src/eu/kanade/tachiyomi/extension/id/bacakomik/BacaKomik.kt +++ b/src/id/bacakomik/src/eu/kanade/tachiyomi/extension/id/bacakomik/BacaKomik.kt @@ -52,7 +52,7 @@ class BacaKomik : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() manga.thumbnail_url = element.select("div.limit img").attr("src") - element.select("div.animposx > a").first().let { + element.select("div.animposx > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.attr("title") } @@ -97,8 +97,8 @@ class BacaKomik : ParsedHttpSource() { return GET(url.build().toString(), headers) } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.infoanime").first() - val descElement = document.select("div.desc > .entry-content.entry-content-single").first() + val infoElement = document.select("div.infoanime").first()!! + val descElement = document.select("div.desc > .entry-content.entry-content-single").first()!! val manga = SManga.create() // need authorCleaner to take "pengarang:" string to remove it from author val authorCleaner = document.select(".infox .spe b:contains(Pengarang)").text() @@ -125,7 +125,7 @@ class BacaKomik : ParsedHttpSource() { override fun chapterListSelector() = "#chapter_list li" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select(".lchx a").first() + val urlElement = element.select(".lchx a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = urlElement.text() @@ -133,7 +133,7 @@ class BacaKomik : ParsedHttpSource() { return chapter } - fun parseChapterDate(date: String): Long { + private fun parseChapterDate(date: String): Long { return if (date.contains("yang lalu")) { val value = date.split(' ')[0].toInt() when { @@ -198,18 +198,18 @@ class BacaKomik : ParsedHttpSource() { override fun imageUrlParse(document: Document) = "" override fun imageRequest(page: Page): Request { - if (page.imageUrl!!.contains("i2.wp.com")) { + return if (page.imageUrl!!.contains("i2.wp.com")) { val headers = Headers.Builder() headers.apply { add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3") } - return GET(page.imageUrl!!, headers.build()) + GET(page.imageUrl!!, headers.build()) } else { val imgHeader = Headers.Builder().apply { add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30") add("Referer", baseUrl) }.build() - return GET(page.imageUrl!!, imgHeader) + GET(page.imageUrl!!, imgHeader) } } diff --git a/src/id/comicfx/src/eu/kanade/tachiyomi/extension/id/comicfx/ComicFx.kt b/src/id/comicfx/src/eu/kanade/tachiyomi/extension/id/comicfx/ComicFx.kt index 17a7bbbfb..279aeea01 100644 --- a/src/id/comicfx/src/eu/kanade/tachiyomi/extension/id/comicfx/ComicFx.kt +++ b/src/id/comicfx/src/eu/kanade/tachiyomi/extension/id/comicfx/ComicFx.kt @@ -156,7 +156,7 @@ class ComicFx : ParsedHttpSource() { thumbnail_url = document.select(".thumb img").attr("abs:src") } - protected fun parseStatus(element: String?): Int = when { + private fun parseStatus(element: String?): Int = when { element == null -> SManga.UNKNOWN listOf("ongoing", "publishing").any { it.contains(element, ignoreCase = true) } -> SManga.ONGOING listOf("completed").any { it.contains(element, ignoreCase = true) } -> SManga.COMPLETED @@ -197,8 +197,8 @@ class ComicFx : ParsedHttpSource() { override fun chapterFromElement(element: Element) = SChapter.create().apply { setUrlWithoutDomain(element.attr("href")) - name = element.selectFirst("span.chapternum").text() - date_upload = parseDate(element.selectFirst("span.chapterdate").text()) + name = element.selectFirst("span.chapternum")!!.text() + date_upload = parseDate(element.selectFirst("span.chapterdate")!!.text()) } // Pages @@ -315,6 +315,4 @@ class ComicFx : ParsedHttpSource() { Filter.Select(displayName, vals.map { it.second }.toTypedArray()) { fun toUriPart() = vals[state].first } - - private inline fun Iterable<*>.findInstance() = find { it is T } as? T } diff --git a/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt b/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt index 6395a0b7b..968bd866d 100644 --- a/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt +++ b/src/id/doujindesu/src/eu/kanade/tachiyomi/extension/id/doujindesu/DoujinDesu.kt @@ -299,7 +299,7 @@ class DoujinDesu : ParsedHttpSource() { // Search & FIlter override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - var url = "$baseUrl/manga/page/$page/".toHttpUrlOrNull()?.newBuilder()!!.addQueryParameter("title", query) + val url = "$baseUrl/manga/page/$page/".toHttpUrlOrNull()?.newBuilder()!!.addQueryParameter("title", query) (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is CategoryNames -> { @@ -341,11 +341,11 @@ class DoujinDesu : ParsedHttpSource() { // Detail Parse override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("section.metadata").first() + val infoElement = document.select("section.metadata").first()!! val manga = SManga.create() manga.description = when { document.select("section.metadata > div.pb-2 > p:nth-child(1)").isEmpty() -> "Tidak ada deskripsi yang tersedia bosque" - else -> document.select("section.metadata > div.pb-2 > p:nth-child(1)").first().text() + else -> document.select("section.metadata > div.pb-2 > p:nth-child(1)").first()!!.text() } val genres = mutableListOf() infoElement.select("div.tags > a").forEach { element -> @@ -354,7 +354,7 @@ class DoujinDesu : ParsedHttpSource() { } manga.author = document.select("section.metadata > table:nth-child(2) > tbody > tr.pages > td:contains(Author) + td:nth-child(2) > a").joinToString { it.text() } manga.genre = infoElement.select("div.tags > a").joinToString { it.text() } - manga.status = parseStatus(document.select("section.metadata > table:nth-child(2) > tbody > tr:nth-child(1) > td:nth-child(2) > a").first().text()) + manga.status = parseStatus(document.select("section.metadata > table:nth-child(2) > tbody > tr:nth-child(1) > td:nth-child(2) > a").first()!!.text()) manga.thumbnail_url = document.select("figure.thumbnail > img").attr("src") manga.artist = document.select("section.metadata > table:nth-child(2) > tbody > tr.pages > td:contains(Character) + td:nth-child(2) > a").joinToString { it.text() } diff --git a/src/id/komikindoid/src/eu/kanade/tachiyomi/extension/id/komikindoid/KomikIndoID.kt b/src/id/komikindoid/src/eu/kanade/tachiyomi/extension/id/komikindoid/KomikIndoID.kt index 04a3e1a18..a1e59b6c1 100644 --- a/src/id/komikindoid/src/eu/kanade/tachiyomi/extension/id/komikindoid/KomikIndoID.kt +++ b/src/id/komikindoid/src/eu/kanade/tachiyomi/extension/id/komikindoid/KomikIndoID.kt @@ -48,7 +48,7 @@ class KomikIndoID : ParsedHttpSource() { val manga = SManga.create() manga.thumbnail_url = element.select("div.limit img").attr("src") manga.title = element.select("div.tt h4").text() - element.select("div.animposx > a").first().let { + element.select("div.animposx > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) } return manga @@ -123,8 +123,8 @@ class KomikIndoID : ParsedHttpSource() { return GET(url.toString(), headers) } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.infoanime").first() - val descElement = document.select("div.desc > .entry-content.entry-content-single").first() + val infoElement = document.select("div.infoanime").first()!! + val descElement = document.select("div.desc > .entry-content.entry-content-single").first()!! val manga = SManga.create() // need authorCleaner to take "pengarang:" string to remove it from author val authorCleaner = document.select(".infox .spe b:contains(Pengarang)").text() @@ -152,7 +152,7 @@ class KomikIndoID : ParsedHttpSource() { override fun chapterListSelector() = "#chapter_list li" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select(".lchx a").first() + val urlElement = element.select(".lchx a").first()!! val chapter = SChapter.create() chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = urlElement.text() @@ -160,7 +160,7 @@ class KomikIndoID : ParsedHttpSource() { return chapter } - fun parseChapterDate(date: String): Long { + private fun parseChapterDate(date: String): Long { return if (date.contains("yang lalu")) { val value = date.split(' ')[0].toInt() when { diff --git a/src/id/komiku/src/eu/kanade/tachiyomi/extension/id/komiku/Komiku.kt b/src/id/komiku/src/eu/kanade/tachiyomi/extension/id/komiku/Komiku.kt index 9dd2276d2..58c9737ff 100644 --- a/src/id/komiku/src/eu/kanade/tachiyomi/extension/id/komiku/Komiku.kt +++ b/src/id/komiku/src/eu/kanade/tachiyomi/extension/id/komiku/Komiku.kt @@ -66,10 +66,10 @@ class Komiku : ParsedHttpSource() { override fun latestUpdatesSelector() = popularMangaSelector() override fun latestUpdatesRequest(page: Int): Request { - if (page == 1) { - return GET("$baseUrl/pustaka/?orderby=modified", headers) + return if (page == 1) { + GET("$baseUrl/pustaka/?orderby=modified", headers) } else { - return GET("$baseUrl/pustaka/page/$page/?orderby=modified", headers) + GET("$baseUrl/pustaka/page/$page/?orderby=modified", headers) } } @@ -160,10 +160,10 @@ class Komiku : ParsedHttpSource() { Filter.Separator(), Filter.Header("NOTE: cant be used with other filter!"), Filter.Header("$name Project List page"), - ProjectList(ProjectFilter), + ProjectList(projectFilter), ) - private val ProjectFilter = arrayOf( + private val projectFilter = arrayOf( Status("Show all manga", ""), Status("Show only project manga", "project-filter-on"), ) @@ -274,17 +274,17 @@ class Komiku : ParsedHttpSource() { name = element.select("a").text() val timeStamp = element.select("td.tanggalseries") - if (timeStamp.text().contains("lalu")) { - date_upload = parseRelativeDate(timeStamp.text().trim()) ?: 0 + date_upload = if (timeStamp.text().contains("lalu")) { + parseRelativeDate(timeStamp.text().trim()) } else { - date_upload = parseDate(timeStamp.last()) + parseDate(timeStamp.last()!!) } } private fun parseDate(element: Element): Long = SimpleDateFormat("dd/MM/yyyy", Locale.US).parse(element.text())?.time ?: 0 // Used Google translate here - private fun parseRelativeDate(date: String): Long? { + private fun parseRelativeDate(date: String): Long { val trimmedDate = date.substringBefore(" lalu").removeSuffix("s").split(" ") val calendar = Calendar.getInstance() diff --git a/src/id/mangaku/src/eu/kanade/tachiyomi/extension/id/mangaku/Mangaku.kt b/src/id/mangaku/src/eu/kanade/tachiyomi/extension/id/mangaku/Mangaku.kt index 6139c9cee..271b70389 100644 --- a/src/id/mangaku/src/eu/kanade/tachiyomi/extension/id/mangaku/Mangaku.kt +++ b/src/id/mangaku/src/eu/kanade/tachiyomi/extension/id/mangaku/Mangaku.kt @@ -113,8 +113,7 @@ class Mangaku : ParsedHttpSource() { title = document.select(".post.singlep .titles a").text().replace("Bahasa Indonesia", "").trim() thumbnail_url = document.select(".post.singlep img").attr("abs:src") document.select("#wrapper-a #content-a .inf").forEach { - val key = it.select(".infx").text() - when (key) { + when (it.select(".infx").text()) { "Genre" -> genre = it.select("p a[rel=tag]").joinToString { it.text() } "Author" -> author = it.select("p").text() "Sinopsis" -> description = it.select("p").text() @@ -136,7 +135,7 @@ class Mangaku : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - val wpRoutineUrl = document.selectFirst("script[src*=wp-routine]").attr("abs:src") + val wpRoutineUrl = document.selectFirst("script[src*=wp-routine]")!!.attr("abs:src") Log.d("mangaku", "wp-routine: $wpRoutineUrl") val wpRoutineJs = client.newCall(GET(wpRoutineUrl, headers)).execute().use { @@ -151,7 +150,7 @@ class Mangaku : ParsedHttpSource() { .reversed() Log.d("mangaku", "app-mgk: $appMgk") - val dtxScript = document.selectFirst("script:containsData(var dtx =)").html() + val dtxScript = document.selectFirst("script:containsData(var dtx =)")!!.html() val dtxIsEqualTo = dtxScript .substringAfter("var dtx = ") .substringBefore(";") @@ -159,7 +158,7 @@ class Mangaku : ParsedHttpSource() { .substringAfter("var $dtxIsEqualTo= \"") .substringBefore("\"") - val mainScriptTag = document.selectFirst("script:containsData(await jrsx)").html() + val mainScriptTag = document.selectFirst("script:containsData(await jrsx)")!!.html() val jrsxArgs = mainScriptTag .substringAfter("await jrsx(") .substringBefore(");") diff --git a/src/it/animegdrclub/src/eu/kanade/tachiyomi/extension/it/animegdrclub/AnimeGDRClub.kt b/src/it/animegdrclub/src/eu/kanade/tachiyomi/extension/it/animegdrclub/AnimeGDRClub.kt index 4a230b07f..825e5d96a 100644 --- a/src/it/animegdrclub/src/eu/kanade/tachiyomi/extension/it/animegdrclub/AnimeGDRClub.kt +++ b/src/it/animegdrclub/src/eu/kanade/tachiyomi/extension/it/animegdrclub/AnimeGDRClub.kt @@ -109,9 +109,9 @@ class AnimeGDRClub : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = "$baseUrl/${element.selectFirst("img").attr("src")}" - manga.url = element.selectFirst("a.linkalmanga").attr("href") - manga.title = element.selectFirst("div.nomeserie > span").text() + manga.thumbnail_url = "$baseUrl/${element.selectFirst("img")!!.attr("src")}" + manga.url = element.selectFirst("a.linkalmanga")!!.attr("href") + manga.title = element.selectFirst("div.nomeserie > span")!!.text() return manga } @@ -119,8 +119,8 @@ class AnimeGDRClub : ParsedHttpSource() { val manga = SManga.create() manga.setUrlWithoutDomain("http://www.agcscanlation.it/progetto.php?nome=${element.attr("href").toHttpUrlOrNull()!!.queryParameter("nome")}") - manga.title = element.selectFirst(".titolo").text() - manga.thumbnail_url = "$baseUrl/${element.selectFirst("img").attr("src")}" + manga.title = element.selectFirst(".titolo")!!.text() + manga.thumbnail_url = "$baseUrl/${element.selectFirst("img")!!.attr("src")}" return manga } @@ -139,7 +139,7 @@ class AnimeGDRClub : ParsedHttpSource() { manga.genre = infoElement.select("span.generi > a").joinToString(", ") { it.text() } - manga.description = document.select("span.trama")?.text()?.substringAfter("Trama: ") + manga.description = document.select("span.trama").text().substringAfter("Trama: ") return manga } diff --git a/src/it/demoneceleste/src/eu/kanade/tachiyomi/extension/it/demoneceleste/DemoneCeleste.kt b/src/it/demoneceleste/src/eu/kanade/tachiyomi/extension/it/demoneceleste/DemoneCeleste.kt index 230858417..53ac642d0 100644 --- a/src/it/demoneceleste/src/eu/kanade/tachiyomi/extension/it/demoneceleste/DemoneCeleste.kt +++ b/src/it/demoneceleste/src/eu/kanade/tachiyomi/extension/it/demoneceleste/DemoneCeleste.kt @@ -107,8 +107,8 @@ class DemoneCeleste : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = "$baseUrl/${(bgImgUrlRegex.find(element.select("a > div > div").first().attr("style")))!!.groupValues[1]}".replace("pub", "det") - element.select("a").first().let { + manga.thumbnail_url = "$baseUrl/${(bgImgUrlRegex.find(element.select("a > div > div").first()!!.attr("style")))!!.groupValues[1]}".replace("pub", "det") + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -118,8 +118,8 @@ class DemoneCeleste : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = "$baseUrl/${(bgImgUrlRegex.find(element.select(".col-md-auto.no-pad > a > div").first().attr("style")))!!.groupValues[1]}".replace("pub", "det") - element.select("a.manga[href^=manga]").first().let { + manga.thumbnail_url = "$baseUrl/${(bgImgUrlRegex.find(element.select(".col-md-auto.no-pad > a > div").first()!!.attr("style")))!!.groupValues[1]}".replace("pub", "det") + element.select("a.manga[href^=manga]").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -136,10 +136,10 @@ class DemoneCeleste : ParsedHttpSource() { infoElement.text().lowercase().contains("sospeso") -> SManga.ON_HIATUS else -> SManga.UNKNOWN } - manga.author = infoElement.select("p:has(strong:contains(Autore))")?.text()!!.replace("Autore: ", "") - manga.artist = infoElement.select("p:has(strong:contains(Artista))")?.text()!!.replace("Artista: ", "") - manga.genre = infoElement.select("p:has(strong:contains(Tag))")?.text()!!.replace("Tag: ", "") - manga.description = document.select(".text-justify")?.text().let { + manga.author = infoElement.select("p:has(strong:contains(Autore))").text().replace("Autore: ", "") + manga.artist = infoElement.select("p:has(strong:contains(Artista))").text().replace("Artista: ", "") + manga.genre = infoElement.select("p:has(strong:contains(Tag))").text().replace("Tag: ", "") + manga.description = document.select(".text-justify").text().let { if (it.isNullOrEmpty()) "Questo manga non è ancora stato pubblicato dagli scanner. Controlla tra un po'. Per cercare aggiornamenti riavvia la pagina." else it } @@ -164,11 +164,11 @@ class DemoneCeleste : ParsedHttpSource() { chapter.setUrlWithoutDomain(element.attr("href") + "#0") chapter.name = element.text() } else { - val container = element.parent().parent() + val container = element.parent()!!.parent()!! - chapter.setUrlWithoutDomain("${element.attr("href")}#${element.parent().select("small").first().text().filter { it.isDigit() }.toInt()}") - chapter.name = container.parent().previousElementSibling().text().replace("""Capp.*""".toRegex(), " Ch.").replace("Volume", "Vol.") + element.text().replace(" #", " - ") - chapter.date_upload = SimpleDateFormat("dd-MM-yyyy", Locale.ITALY).parse(container.select("small").last().text().replace('/', '-'))!!.time + chapter.setUrlWithoutDomain("${element.attr("href")}#${element.parent()!!.select("small").first()!!.text().filter { it.isDigit() }.toInt()}") + chapter.name = container.parent()!!.previousElementSibling()!!.text().replace("""Capp.*""".toRegex(), " Ch.").replace("Volume", "Vol.") + element.text().replace(" #", " - ") + chapter.date_upload = SimpleDateFormat("dd-MM-yyyy", Locale.ITALY).parse(container.select("small").last()!!.text().replace('/', '-'))!!.time } return chapter diff --git a/src/it/digitalteam/src/eu/kanade/tachiyomi/extension/it/digitalteam/DigitalTeam.kt b/src/it/digitalteam/src/eu/kanade/tachiyomi/extension/it/digitalteam/DigitalTeam.kt index 3df070d11..865736bc9 100644 --- a/src/it/digitalteam/src/eu/kanade/tachiyomi/extension/it/digitalteam/DigitalTeam.kt +++ b/src/it/digitalteam/src/eu/kanade/tachiyomi/extension/it/digitalteam/DigitalTeam.kt @@ -57,7 +57,7 @@ class DigitalTeam : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { title = element.select(".manga_title a").text() thumbnail_url = element.select("img").attr("src") - setUrlWithoutDomain(element.select(".manga_title a").first().attr("href")) + setUrlWithoutDomain(element.select(".manga_title a").first()!!.attr("href")) } override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not Used") @@ -75,11 +75,11 @@ class DigitalTeam : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { val infoElement = document.select("#manga_left") - author = infoElement.select(".info_name:contains(Autore)").next()?.text() - artist = infoElement.select(".info_name:contains(Artista)").next()?.text() - genre = infoElement.select(".info_name:contains(Genere)").next()?.text() + author = infoElement.select(".info_name:contains(Autore)").next().text() + artist = infoElement.select(".info_name:contains(Artista)").next().text() + genre = infoElement.select(".info_name:contains(Genere)").next().text() status = parseStatus(infoElement.select(".info_name:contains(Status)").next().text()) - description = document.select("div.plot")?.text() + description = document.select("div.plot").text() thumbnail_url = infoElement.select(".cover img").attr("src") } @@ -92,7 +92,7 @@ class DigitalTeam : ParsedHttpSource() { override fun chapterListSelector() = ".chapter_list ul li" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! setUrlWithoutDomain(urlElement.attr("href")) name = urlElement.text() @@ -143,7 +143,7 @@ class DigitalTeam : ParsedHttpSource() { val scriptContent = document.body().toString() .substringAfter("current_page=") .substringBefore(";") - val title = document.select("title").first().text() + val title = document.select("title").first()!!.text() val external = document.select("script[src*='jq_rext.js']").isNotEmpty() val xhrPages = getXhrPages(scriptContent, title, external) diff --git a/src/it/hentaifantasy/src/eu/kanade/tachiyomi/extension/it/hentaifantasy/HentaiFantasy.kt b/src/it/hentaifantasy/src/eu/kanade/tachiyomi/extension/it/hentaifantasy/HentaiFantasy.kt index 2f9f0946a..3bc30eb40 100644 --- a/src/it/hentaifantasy/src/eu/kanade/tachiyomi/extension/it/hentaifantasy/HentaiFantasy.kt +++ b/src/it/hentaifantasy/src/eu/kanade/tachiyomi/extension/it/hentaifantasy/HentaiFantasy.kt @@ -31,7 +31,7 @@ class HentaiFantasy : ParsedHttpSource() { override val client: OkHttpClient = network.cloudflareClient companion object { - val pagesUrlPattern by lazy { + val pagesUrlPattern: Pattern by lazy { Pattern.compile("""\"url\":\"(.*?)\"""") } @@ -120,17 +120,17 @@ class HentaiFantasy : ParsedHttpSource() { val manga = SManga.create() val genres = mutableListOf() document.select("div#tablelist > div.row").forEach { row -> - when (row.select("div.cell > b").first().text().trim()) { + when (row.select("div.cell > b").first()!!.text().trim()) { "Autore" -> manga.author = row.select("div.cell > a").text().trim() "Genere", "Tipo" -> row.select("div.cell > a > span.label").forEach { genres.add(it.text().trim()) } - "Descrizione" -> manga.description = row.select("div.cell").last().text().trim() + "Descrizione" -> manga.description = row.select("div.cell").last()!!.text().trim() } } manga.genre = genres.joinToString(", ") manga.status = SManga.UNKNOWN - manga.thumbnail_url = document.select("div.thumbnail > img")?.attr("src") + manga.thumbnail_url = document.select("div.thumbnail > img").attr("src") return manga } diff --git a/src/it/novelleleggere/src/eu/kanade/tachiyomi/extension/it/novelleleggere/NovelleLeggere.kt b/src/it/novelleleggere/src/eu/kanade/tachiyomi/extension/it/novelleleggere/NovelleLeggere.kt index 6d7a33544..5462a91b0 100644 --- a/src/it/novelleleggere/src/eu/kanade/tachiyomi/extension/it/novelleleggere/NovelleLeggere.kt +++ b/src/it/novelleleggere/src/eu/kanade/tachiyomi/extension/it/novelleleggere/NovelleLeggere.kt @@ -25,7 +25,7 @@ class NovelleLeggere : ParsedHttpSource() { override fun popularMangaNextPageSelector(): String? = null override fun popularMangaSelector(): String = "table:contains(Manga) tr:gt(0)" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - val a = element.select("a").first() + val a = element.select("a").first()!! title = a.text() setUrlWithoutDomain(a.attr("abs:href")) } @@ -33,7 +33,7 @@ class NovelleLeggere : ParsedHttpSource() { // Latest override fun latestUpdatesRequest(page: Int): Request = throw Exception("Latest Not Supported") - override fun latestUpdatesNextPageSelector(): String? = throw Exception("Latest Not Supported") + override fun latestUpdatesNextPageSelector(): String = throw Exception("Latest Not Supported") override fun latestUpdatesSelector(): String = throw Exception("Latest Not Supported") override fun latestUpdatesFromElement(element: Element): SManga = throw Exception("Latest Not Supported") @@ -42,14 +42,14 @@ class NovelleLeggere : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Search Not Supported") - override fun searchMangaNextPageSelector(): String? = throw Exception("Search Not Supported") + override fun searchMangaNextPageSelector(): String = throw Exception("Search Not Supported") override fun searchMangaSelector(): String = throw Exception("Search Not Supported") override fun searchMangaFromElement(element: Element): SManga = throw Exception("Search Not Supported") // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - thumbnail_url = document.select("div.post-content img").first().attr("abs:src") + thumbnail_url = document.select("div.post-content img").first()!!.attr("abs:src") title = document.select("div.post-content h3").text().trim() description = document.select("div.post-content div:contains(Trama) div.su-spoiler-content").text() diff --git a/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt b/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt index 506f84f8c..04f71399a 100644 --- a/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt +++ b/src/it/shingekinoshoujo/src/eu/kanade/tachiyomi/extension/it/shingekinoshoujo/ShingekiNoShoujo.kt @@ -75,8 +75,8 @@ class ShingekiNoShoujo : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create().apply { - thumbnail_url = element.selectFirst("img").attr("src") - element.select("a").last().let { + thumbnail_url = element.selectFirst("img")!!.attr("src") + element.select("a").last()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -84,20 +84,20 @@ class ShingekiNoShoujo : ParsedHttpSource() { return manga } override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { - thumbnail_url = element.select("img").first().attr("src") + thumbnail_url = element.select("img").first()!!.attr("src") setUrlWithoutDomain(element.attr("href")) - title = element.select("span").first().text() + title = element.select("span").first()!!.text() } override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { - thumbnail_url = element.select(".entry-thumbnail > img")?.attr("src") ?: "" - element.select("a").first().let { + thumbnail_url = element.select(".entry-thumbnail > img").attr("src") ?: "" + element.select("a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } } override fun mangaDetailsParse(document: Document): SManga { - val statusElementText = document.select("blockquote").last().text().lowercase() + val statusElementText = document.select("blockquote").last()!!.text().lowercase() return SManga.create().apply { thumbnail_url = document.select(".entry-thumbnail > img").attr("src") status = when { @@ -105,9 +105,9 @@ class ShingekiNoShoujo : ParsedHttpSource() { statusElementText.contains("fine") -> SManga.COMPLETED else -> SManga.UNKNOWN } - author = document.select("span:has(strong:contains(Autore))")?.text()!!.substringAfter("Autore:").trim() - genre = document.select("span:has(strong:contains(Genere))")?.text()!!.substringAfter("Genere:").replace(".", "").trim() - description = document.select("p:has(strong:contains(Trama))")?.text()!!.substringAfter("Trama:").trim() + author = document.select("span:has(strong:contains(Autore))").text().substringAfter("Autore:").trim() + genre = document.select("span:has(strong:contains(Genere))").text().substringAfter("Genere:").replace(".", "").trim() + description = document.select("p:has(strong:contains(Trama))").text().substringAfter("Trama:").trim() } } //endregion @@ -130,7 +130,7 @@ class ShingekiNoShoujo : ParsedHttpSource() { setUrlWithoutDomain(it.attr("href")) name = it.text() chapter_number = it.text().replace(Regex("OneShot|Prologo"), "0").filter { it.isDigit() }.let { - if (it.isEmpty()) "$i" else it + it.ifEmpty { "$i" } }.toFloat() }, ) diff --git a/src/it/zeurelscan/src/eu/kanade/tachiyomi/extension/it/zeurelscan/ZeurelScan.kt b/src/it/zeurelscan/src/eu/kanade/tachiyomi/extension/it/zeurelscan/ZeurelScan.kt index 703813f08..40c6b7620 100644 --- a/src/it/zeurelscan/src/eu/kanade/tachiyomi/extension/it/zeurelscan/ZeurelScan.kt +++ b/src/it/zeurelscan/src/eu/kanade/tachiyomi/extension/it/zeurelscan/ZeurelScan.kt @@ -52,8 +52,8 @@ class ZeurelScan : HttpSource() { val document = response.asJsoup() // The titles of all unique manga in the latest section val titles = document.select("div.capitoli_mini").distinctBy { - it.selectFirst("div:not(:has(img))").text() - }.map { it.selectFirst("div:not(:has(img))").text() } + it.selectFirst("div:not(:has(img))")!!.text() + }.map { it.selectFirst("div:not(:has(img))")!!.text() } // Gets manga link from dropdown menu as latest section links directly to chapter val latestManga = document.select("a.titoliSerie").mapNotNull { element -> @@ -82,16 +82,16 @@ class ZeurelScan : HttpSource() { override fun mangaDetailsParse(response: Response) = SManga.create().apply { val document = response.asJsoup() - val info = document.selectFirst("div.testo") + val info = document.selectFirst("div.testo")!! - title = info.selectFirst("div.intestazione:contains(Titolo)").nextElementSibling().text() - author = info.selectFirst("div.intestazione:contains(Autore)").nextElementSibling().text() - artist = info.selectFirst("div.intestazione:contains(Artista)").nextElementSibling().text() - genre = info.selectFirst("div.intestazione:contains(Genere)").nextElementSibling().text() - description = info.selectFirst("div.intestazione:contains(Trama)").nextElementSibling().text() + title = info.selectFirst("div.intestazione:contains(Titolo)")!!.nextElementSibling()!!.text() + author = info.selectFirst("div.intestazione:contains(Autore)")!!.nextElementSibling()!!.text() + artist = info.selectFirst("div.intestazione:contains(Artista)")!!.nextElementSibling()!!.text() + genre = info.selectFirst("div.intestazione:contains(Genere)")!!.nextElementSibling()!!.text() + description = info.selectFirst("div.intestazione:contains(Trama)")!!.nextElementSibling()!!.text() thumbnail_url = document.select("div.immagine > img").attr("abs:src") - status = parseStatus(info.selectFirst("div.intestazione:contains(Stato)").nextElementSibling().text()) + status = parseStatus(info.selectFirst("div.intestazione:contains(Stato)")!!.nextElementSibling()!!.text()) } private fun parseStatus(status: String) = when { @@ -106,10 +106,10 @@ class ZeurelScan : HttpSource() { val list = response.asJsoup().select("div.rigaCap") return list.map { SChapter.create().apply { - setUrlWithoutDomain(it.selectFirst("a").attr("abs:href")) - name = it.selectFirst("div.titolo").text() - date_upload = parseChapterDate(it.selectFirst("div.data").text()) - chapter_number = it.selectFirst("div.numCap").text().substringAfter("#").toFloatOrNull() ?: 0f + setUrlWithoutDomain(it.selectFirst("a")!!.attr("abs:href")) + name = it.selectFirst("div.titolo")!!.text() + date_upload = parseChapterDate(it.selectFirst("div.data")!!.text()) + chapter_number = it.selectFirst("div.numCap")!!.text().substringAfter("#").toFloatOrNull() ?: 0f } } } diff --git a/src/ja/comicnewtype/src/eu/kanade/tachiyomi/extension/ja/comicnewtype/ComicNewtype.kt b/src/ja/comicnewtype/src/eu/kanade/tachiyomi/extension/ja/comicnewtype/ComicNewtype.kt index ecad48018..9c71056e5 100644 --- a/src/ja/comicnewtype/src/eu/kanade/tachiyomi/extension/ja/comicnewtype/ComicNewtype.kt +++ b/src/ja/comicnewtype/src/eu/kanade/tachiyomi/extension/ja/comicnewtype/ComicNewtype.kt @@ -38,17 +38,17 @@ class ComicNewtype : HttpSource() { return MangasPage(emptyList(), false) } - val list = document.selectFirst(Evaluator.Class("content__col-list--common")) + val list = document.selectFirst(Evaluator.Class("content__col-list--common"))!! val mangas = list.children().map { - val eyeCatcher = it.selectFirst(Evaluator.Class("catch__txt")).ownText() - val root = it.selectFirst(Evaluator.Tag("a")) + val eyeCatcher = it.selectFirst(Evaluator.Class("catch__txt"))!!.ownText() + val root = it.selectFirst(Evaluator.Tag("a"))!! SManga.create().apply { url = root.attr("href") - title = root.selectFirst(Evaluator.Class("detail__txt--ttl")).text() - author = root.selectFirst(Evaluator.Class("detail__txt--info")).ownText() - thumbnail_url = baseUrl + root.selectFirst(Evaluator.Tag("img")) + title = root.selectFirst(Evaluator.Class("detail__txt--ttl"))!!.text() + author = root.selectFirst(Evaluator.Class("detail__txt--info"))!!.ownText() + thumbnail_url = baseUrl + root.selectFirst(Evaluator.Tag("img"))!! .attr("src").removeSuffix("/w250/") - val genreText = root.selectFirst(Evaluator.Class("detail__txt--label")).ownText() + val genreText = root.selectFirst(Evaluator.Class("detail__txt--label"))!!.ownText() if (genreText.isNotEmpty()) { genre = genreText.substring(1).replace("#", ", ") } @@ -74,23 +74,23 @@ class ComicNewtype : HttpSource() { override fun searchMangaParse(response: Response) = popularMangaParse(response) override fun mangaDetailsParse(response: Response) = SManga.create().apply { - val root = response.asJsoup().selectFirst(Evaluator.Class("pc__list--contents")) - title = root.selectFirst(Evaluator.Tag("h1")).ownText() - author = root.selectFirst(Evaluator.Class("contents__info")).ownText() + val root = response.asJsoup().selectFirst(Evaluator.Class("pc__list--contents"))!! + title = root.selectFirst(Evaluator.Tag("h1"))!!.ownText() + author = root.selectFirst(Evaluator.Class("contents__info"))!!.ownText() // This one is horizontal. Prefer the square one from manga list. // thumbnail_url = baseUrl + root.selectFirst(Evaluator.Class("contents__thumb-comic")) // .child(0).attr("src").removeSuffix("/w500/") genre = root.selectFirst(Evaluator.Class("container__link-list--genre-btn")) ?.run { children().joinToString { it.text() } } - val updates = root.selectFirst(Evaluator.Class("contents__date--info-comic")) + val updates = root.selectFirst(Evaluator.Class("contents__date--info-comic"))!! .textNodes().filterNot { it.isBlank }.joinToString(" || ") { it.text() } val isCompleted = (updates == "連載終了") status = if (isCompleted) SManga.COMPLETED else SManga.ONGOING description = buildString { if (!isCompleted) append(updates).append("\n\n") - append(root.selectFirst(Evaluator.Class("contents__txt-catch")).ownText()).append("\n\n") - append(root.selectFirst(Evaluator.Class("contents__txt--desc")).ownText()) + append(root.selectFirst(Evaluator.Class("contents__txt-catch"))!!.ownText()).append("\n\n") + append(root.selectFirst(Evaluator.Class("contents__txt--desc"))!!.ownText()) } } @@ -104,7 +104,7 @@ class ComicNewtype : HttpSource() { if (url[0] != '/') return@mapNotNull null val dateEl = element.selectFirst(Evaluator.Class("detail__txt--date")) - val title = element.selectFirst(Evaluator.Tag("h2")).ownText().halfwidthDigits() + val title = element.selectFirst(Evaluator.Tag("h2"))!!.ownText().halfwidthDigits() val noteEl = element.selectFirst(Evaluator.Class("detail__txt--caution")) SChapter.create().apply { this.url = url diff --git a/src/ja/nikkangecchan/src/eu/kanade/tachiyomi/extension/ja/nikkangecchan/Nikkangecchan.kt b/src/ja/nikkangecchan/src/eu/kanade/tachiyomi/extension/ja/nikkangecchan/Nikkangecchan.kt index 8550824d3..193c1995f 100644 --- a/src/ja/nikkangecchan/src/eu/kanade/tachiyomi/extension/ja/nikkangecchan/Nikkangecchan.kt +++ b/src/ja/nikkangecchan/src/eu/kanade/tachiyomi/extension/ja/nikkangecchan/Nikkangecchan.kt @@ -36,13 +36,13 @@ class Nikkangecchan : ParsedHttpSource() { override fun popularMangaSelector(): String = ".contentInner > figure" override fun popularMangaFromElement(element: Element): SManga { - val imgBox = element.select(".imgBox").first() - val detailBox = element.select(".detailBox").last() + val imgBox = element.select(".imgBox").first()!! + val detailBox = element.select(".detailBox").last()!! return SManga.create().apply { - title = detailBox.select("h3").first().text() - thumbnail_url = baseUrl + imgBox.select("a > img").first().attr("src") - setUrlWithoutDomain(baseUrl + imgBox.select("a").first().attr("href")) + title = detailBox.select("h3").first()!!.text() + thumbnail_url = baseUrl + imgBox.select("a > img").first()!!.attr("src") + setUrlWithoutDomain(baseUrl + imgBox.select("a").first()!!.attr("href")) } } @@ -70,10 +70,10 @@ class Nikkangecchan : ParsedHttpSource() { val detailBox = document.select("#comicDetail .detailBox") return SManga.create().apply { - title = detailBox.select("h3").first().text() - author = detailBox.select(".author").first().text() - artist = detailBox.select(".author").first().text() - description = document.select(".description").first().text() + title = detailBox.select("h3").first()!!.text() + author = detailBox.select(".author").first()!!.text() + artist = detailBox.select(".author").first()!!.text() + description = document.select(".description").first()!!.text() status = SManga.ONGOING } } @@ -84,13 +84,13 @@ class Nikkangecchan : ParsedHttpSource() { super.chapterListParse(response).reversed() override fun chapterFromElement(element: Element): SChapter { - val episodePage = element.select(".episode-page").first() - val title = element.select("h4.episodeTitle").first().text() + val episodePage = element.select(".episode-page").first()!! + val title = element.select("h4.episodeTitle").first()!!.text() val dataTitle = episodePage.attr("data-title").substringBefore("|").trim() return SChapter.create().apply { name = "$title - $dataTitle" - chapter_number = element.select("h4.episodeTitle").first().text().toFloatOrNull() ?: -1f + chapter_number = element.select("h4.episodeTitle").first()!!.text().toFloatOrNull() ?: -1f scanlator = "Akita Publishing" setUrlWithoutDomain(baseUrl + episodePage.attr("data-src").substringBeforeLast("/")) } diff --git a/src/ja/senmanga/src/eu/kanade/tachiyomi/extension/ja/senmanga/SenManga.kt b/src/ja/senmanga/src/eu/kanade/tachiyomi/extension/ja/senmanga/SenManga.kt index 87098fa45..6f8224e56 100644 --- a/src/ja/senmanga/src/eu/kanade/tachiyomi/extension/ja/senmanga/SenManga.kt +++ b/src/ja/senmanga/src/eu/kanade/tachiyomi/extension/ja/senmanga/SenManga.kt @@ -90,9 +90,9 @@ class SenManga : ParsedHttpSource() { override fun mangaDetailsParse(document: Document) = SManga.create().apply { title = document.select("h1.series").text() - thumbnail_url = document.select("div.cover img").first().attr("src") + thumbnail_url = document.select("div.cover img").first()!!.attr("src") - description = document.select("div.summary").first().text() + description = document.select("div.summary").first()!!.text() val seriesElement = document.select("div.series-desc .info ") @@ -119,7 +119,7 @@ class SenManga : ParsedHttpSource() { setUrlWithoutDomain(linkElement.attr("href")) - name = linkElement.first().text() + name = linkElement.first()!!.text() chapter_number = element.child(0).text().trim().toFloatOrNull() ?: -1f @@ -131,7 +131,7 @@ class SenManga : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - return listOf(1..document.select("select[name=page] option:last-of-type").first().text().toInt()).flatten().map { i -> + return listOf(1..document.select("select[name=page] option:last-of-type").first()!!.text().toInt()).flatten().map { i -> Page(i - 1, "", "${document.location().replace(baseUrl, "$baseUrl/viewer")}/$i") } } diff --git a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComic.kt b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComic.kt index a9c9fd204..e5456eab0 100644 --- a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComic.kt +++ b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComic.kt @@ -18,8 +18,8 @@ class NaverWebtoon : NaverComicBase("webtoon") { override fun popularMangaSelector() = ".list_area.daily_all .col ul > li" override fun popularMangaNextPageSelector() = null override fun popularMangaFromElement(element: Element): SManga { - val thumb = element.select("div.thumb img").first().attr("src") - val title = element.select("a.title").first() + val thumb = element.select("div.thumb img").first()!!.attr("src") + val title = element.select("a.title").first()!! val manga = SManga.create() manga.url = title.attr("href").substringBefore("&week") diff --git a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt index 8285b7506..774cae5a1 100644 --- a/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt +++ b/src/ko/navercomic/src/eu/kanade/tachiyomi/extension/ko/navercomic/NaverComicBase.kt @@ -108,10 +108,10 @@ abstract class NaverComicBase(protected val mType: String) : ParsedHttpSource() val titleElement = element.select(".detail > h2") val manga = SManga.create() - manga.title = titleElement.first().ownText().trim() + manga.title = titleElement.first()!!.ownText().trim() manga.author = titleElement.select("span").text().trim() manga.description = document.select("div.detail p").text().trim() - manga.thumbnail_url = element.select(".thumb > a > img").last().attr("src") + manga.thumbnail_url = element.select(".thumb > a > img").last()!!.attr("src") return manga } @@ -142,8 +142,8 @@ abstract class NaverComicChallengeBase(mType: String) : NaverComicBase(mType) { override fun popularMangaSelector() = ".weekchallengeBox tbody td:not([class])" override fun popularMangaNextPageSelector(): String? = ".paginate .page_wrap a.next" override fun popularMangaFromElement(element: Element): SManga { - val thumb = element.select("a img").first().attr("src") - val title = element.select(".challengeTitle a").first() + val thumb = element.select("a img").first()!!.attr("src") + val title = element.select(".challengeTitle a").first()!! val manga = SManga.create() manga.url = title.attr("href").substringBefore("&week") diff --git a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/ManaToki.kt b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/ManaToki.kt index e29f79a99..bc0e83e76 100644 --- a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/ManaToki.kt +++ b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/ManaToki.kt @@ -22,7 +22,7 @@ object ManaToki : NewToki("ManaToki", "comic", manaTokiPreferences) { fun latestUpdatesElementParse(element: Element): SManga { val linkElement = element.select("a.btn-primary") - val rawTitle = element.select(".post-subject > a").first().ownText().trim() + val rawTitle = element.select(".post-subject > a").first()!!.ownText().trim() val title = rawTitle.trim().replace(chapterRegex, "") diff --git a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt index b7dbf0ab0..a880241ab 100644 --- a/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt +++ b/src/ko/newtoki/src/eu/kanade/tachiyomi/extension/ko/newtoki/NewToki.kt @@ -51,11 +51,11 @@ abstract class NewToki( override fun popularMangaSelector() = "div#webtoon-list > ul > li" override fun popularMangaFromElement(element: Element): SManga { - val linkElement = element.getElementsByTag("a").first() + val linkElement = element.getElementsByTag("a").first()!! val manga = SManga.create() manga.url = getUrlPath(linkElement.attr("href")) - manga.title = element.select("span.title").first().ownText() + manga.title = element.select("span.title").first()!!.ownText() manga.thumbnail_url = linkElement.getElementsByTag("img").attr("src") return manga } @@ -111,7 +111,7 @@ abstract class NewToki( } override fun mangaDetailsParse(document: Document): SManga { - val info = document.select("div.view-title > .view-content").first() + val info = document.select("div.view-title > .view-content").first()!! val title = document.select("div.view-content > span > b").text() val thumbnail = document.select("div.row div.view-img > img").attr("src") val descriptionElement = info.select("div.row div.view-content:not([style])") @@ -150,14 +150,14 @@ abstract class NewToki( override fun chapterListSelector() = "div.serial-list > ul.list-body > li.list-item" override fun chapterFromElement(element: Element): SChapter { - val linkElement = element.select(".wr-subject > a.item-subject").last() + val linkElement = element.select(".wr-subject > a.item-subject").last()!! val rawName = linkElement.ownText().trim() val chapter = SChapter.create() chapter.setUrlWithoutDomain(linkElement.attr("href")) chapter.chapter_number = parseChapterNumber(rawName) chapter.name = rawName - chapter.date_upload = parseChapterDate(element.select(".wr-date").last().text().trim()) + chapter.date_upload = parseChapterDate(element.select(".wr-date").last()!!.text().trim()) return chapter } diff --git a/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt b/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt index 6302a26da..576c45090 100644 --- a/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt +++ b/src/pt/bakai/src/eu/kanade/tachiyomi/extension/pt/bakai/Bakai.kt @@ -98,9 +98,9 @@ class Bakai : ParsedHttpSource() { name = element.selectFirst("p:contains(Tipo:) a")!!.text() scanlator = element.select("p:contains(Tradução:) a").firstOrNull() ?.text()?.trim() - date_upload = element.ownerDocument().select("div.ipsPageHeader__meta time").firstOrNull() + date_upload = element.ownerDocument()!!.select("div.ipsPageHeader__meta time").firstOrNull() ?.attr("datetime")?.toDate() ?: 0L - setUrlWithoutDomain(element.ownerDocument().location()) + setUrlWithoutDomain(element.ownerDocument()!!.location()) } override fun pageListParse(document: Document): List { diff --git a/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt b/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt index b84619bc9..6d0c3f760 100644 --- a/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt +++ b/src/pt/brmangas/src/eu/kanade/tachiyomi/extension/pt/brmangas/BrMangas.kt @@ -92,7 +92,7 @@ class BrMangas : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { val infoElement = document.select("div.serie-geral div.infoall").first()!! - title = document.select("title").first().text().substringBeforeLast(" - ") + title = document.select("title").first()!!.text().substringBeforeLast(" - ") author = infoElement.select("div.serie-infos li:contains(Autor)").firstOrNull()?.ownText() genre = infoElement.select("a.category.tag").joinToString { it.text() } description = document.select("div.manga_sinopse ~ p").text().trim() diff --git a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt index 5ef8aa8ee..1d40f456e 100644 --- a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt +++ b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt @@ -62,8 +62,8 @@ class GoldenMangas : ParsedHttpSource() { override fun latestUpdatesSelector() = "div.col-sm-12.atualizacao > div.row" override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { - val infoElement = element.select("div.col-sm-10.col-xs-8 h3").first() - val thumbElement = element.select("a:first-child div img").first() + val infoElement = element.select("div.col-sm-10.col-xs-8 h3").first()!! + val thumbElement = element.select("a:first-child div img").first()!! title = infoElement.text().withoutLanguage() thumbnail_url = thumbElement.attr("abs:src") @@ -96,14 +96,14 @@ class GoldenMangas : ParsedHttpSource() { override fun searchMangaNextPageSelector(): String? = null override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val infoElement = document.select("div.row > div.col-sm-8 > div.row").first() - val firstColumn = infoElement.select("div.col-sm-4.text-right > img").first() - val secondColumn = infoElement.select("div.col-sm-8").first() + val infoElement = document.select("div.row > div.col-sm-8 > div.row").first()!! + val firstColumn = infoElement.select("div.col-sm-4.text-right > img").first()!! + val secondColumn = infoElement.select("div.col-sm-8").first()!! title = secondColumn.select("h2:eq(0)").text().withoutLanguage() - author = secondColumn.select("h5:contains(Autor)")!!.text().withoutLabel() - artist = secondColumn.select("h5:contains(Artista)")!!.text().withoutLabel() - genre = secondColumn.select("h5:contains(Genero) a") + author = secondColumn.select("h5:contains(Autor)").text().withoutLabel() + artist = secondColumn.select("h5:contains(Artista)").text().withoutLabel() + genre = secondColumn.select("h5:contains(Genero) a").toList() .filter { it.text().isNotEmpty() } .joinToString { it.text() } status = secondColumn.select("h5:contains(Status) a").text().toStatus() @@ -117,9 +117,9 @@ class GoldenMangas : ParsedHttpSource() { val firstColumn = element.select("a > div.col-sm-5") val secondColumn = element.select("div.col-sm-5.text-right a[href^='http']") - name = firstColumn.select("div.col-sm-5").first().text() + name = firstColumn.select("div.col-sm-5").first()!!.text() .substringBefore("(").trim() - scanlator = secondColumn?.joinToString { it.text() } + scanlator = secondColumn.joinToString { it.text() } date_upload = firstColumn.select("div.col-sm-5 span[style]").text().toDate() url = element.select("a").attr("href") } @@ -181,8 +181,6 @@ class GoldenMangas : ParsedHttpSource() { private const val ACCEPT_IMAGE = "image/webp,image/apng,image/*,*/*;q=0.8" private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5" private const val REFERER = "https://google.com/" - private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + - "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36" private val FLAG_REGEX = "\\((Pt[-/]br|Scan)\\)".toRegex(RegexOption.IGNORE_CASE) diff --git a/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt b/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt index b256c2687..254aacce7 100644 --- a/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt +++ b/src/pt/mundohentai/src/eu/kanade/tachiyomi/extension/pt/mundohentai/MundoHentai.kt @@ -106,7 +106,7 @@ class MundoHentai : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { name = "Capítulo" chapter_number = 1f - setUrlWithoutDomain(element.ownerDocument().location()) + setUrlWithoutDomain(element.ownerDocument()!!.location()) } override fun pageListParse(document: Document): List { diff --git a/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt b/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt index a1c916ed2..7cb35ef45 100644 --- a/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt +++ b/src/pt/mundowebtoon/src/eu/kanade/tachiyomi/extension/pt/mundowebtoon/MundoWebtoon.kt @@ -99,10 +99,10 @@ class MundoWebtoon : ParsedHttpSource() { title = infoElement.select("div.mangaTitulo h3").text().withoutLanguage() author = infoElement.select("div.BlDataItem a[href*=autor]") - ?.joinToString(", ") { it.text() } + .joinToString(", ") { it.text() } artist = infoElement.select("div.BlDataItem a[href*=artista]") - ?.joinToString(", ") { it.text() } - genre = infoElement.select("div.col-md-12 a.label-warning[href*=genero]") + .joinToString(", ") { it.text() } + genre = infoElement.select("div.col-md-12 a.label-warning[href*=genero]").toList() .filter { it.text().isNotEmpty() } .joinToString { it.text().trim() } status = infoElement.selectFirst("div.BlDataItem a[href*=status]") @@ -114,11 +114,11 @@ class MundoWebtoon : ParsedHttpSource() { override fun chapterListSelector() = "div.CapitulosListaTodos div.CapitulosListaItem" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - name = element.selectFirst("h5").ownText() + name = element.selectFirst("h5")!!.ownText() scanlator = element.select("a.color_gray[target='_blank']") .joinToString(", ") { it.text() } date_upload = element.select("h5 span[style]").text().toDate() - setUrlWithoutDomain(element.selectFirst("a").attr("abs:href")) + setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href")) } override fun pageListRequest(chapter: SChapter): Request { diff --git a/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt b/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt index 5acd62939..028abef72 100644 --- a/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt +++ b/src/pt/opex/src/eu/kanade/tachiyomi/extension/pt/opex/OnePieceEx.kt @@ -174,7 +174,7 @@ class OnePieceEx : ParsedHttpSource() { override fun chapterListSelector() = "div.capitulos li.volume-capitulo" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { - val mangaUrl = element.ownerDocument().location().toHttpUrlOrNull()!! + val mangaUrl = element.ownerDocument()!!.location().toHttpUrlOrNull()!! when (mangaUrl.queryParameter("type")!!) { "main" -> { diff --git a/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt b/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt index 0c6dab48f..837731e95 100644 --- a/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt +++ b/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt @@ -99,8 +99,8 @@ class AComics : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = baseUrl + element.select("a > img").first().attr("src") - element.select("div.title > a").first().let { + manga.thumbnail_url = baseUrl + element.select("a > img").first()!!.attr("src") + element.select("div.title > a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href") + "/about") manga.title = it.text() } @@ -120,7 +120,7 @@ class AComics : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select(".about-summary").first() + val infoElement = document.select(".about-summary").first()!! val manga = SManga.create() manga.author = infoElement.select(".about-summary > p:contains(Автор)").text().split(":")[1] manga.genre = infoElement.select("a.button").joinToString { it.text() } @@ -151,7 +151,7 @@ class AComics : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter = throw Exception("Not used") override fun pageListParse(document: Document): List { - val imageElement = document.select("img#mainImage").first() + val imageElement = document.select("img#mainImage").first()!! return listOf(Page(0, imageUrl = baseUrl + imageElement.attr("src"))) } diff --git a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt index 290a61a83..6724568a5 100644 --- a/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt +++ b/src/ru/comx/src/eu/kanade/tachiyomi/extension/ru/comx/ComX.kt @@ -127,8 +127,8 @@ class ComX : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = baseUrl + element.select("img").first().attr("data-src") - element.select(".readed__title a").first().let { + manga.thumbnail_url = baseUrl + element.select("img").first()!!.attr("data-src") + element.select(".readed__title a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text().split(" / ").first() } @@ -153,8 +153,8 @@ class ComX : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = baseUrl + element.select("img").first().attr("src").replace("mini/mini", "mini/mid") - element.select("a.latest__title").first().let { + manga.thumbnail_url = baseUrl + element.select("img").first()!!.attr("src").replace("mini/mini", "mini/mid") + element.select("a.latest__title").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text().split(" / ").first() } @@ -181,7 +181,7 @@ class ComX : ParsedHttpSource() { val mutableAge = mutableListOf() var orderBy = "rating" var ascEnd = "desc" - var sectionPub = mutableListOf() + val sectionPub = mutableListOf() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is OrderBy -> { @@ -231,10 +231,10 @@ class ComX : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.page__grid").first() + val infoElement = document.select("div.page__grid").first()!! val ratingValue = infoElement.select(".page__activity-votes").textNodes().first().text().trim().toFloat() * 2 - val ratingVotes = infoElement.select(".page__activity-votes span > span").first().text().trim() + val ratingVotes = infoElement.select(".page__activity-votes span > span").first()!!.text().trim() val ratingStar = when { ratingValue > 9.5 -> "★★★★★" ratingValue > 8.5 -> "★★★★✬" @@ -248,7 +248,7 @@ class ComX : ParsedHttpSource() { ratingValue > 0.5 -> "✬☆☆☆☆" else -> "☆☆☆☆☆" } - val rawCategory = document.select(".speedbar a").last().text().trim() + val rawCategory = document.select(".speedbar a").last()!!.text().trim() val category = when (rawCategory.lowercase()) { "manga" -> "Манга" "manhwa" -> "Манхва" @@ -262,7 +262,7 @@ class ComX : ParsedHttpSource() { manga.genre = category + ", " + rawAgeStop + ", " + infoElement.select(".page__tags a").joinToString { it.text() } manga.status = parseStatus(infoElement.select(".page__list li:contains(Статус)").text()) - manga.description = infoElement.select(".page__header h1").text().replace(" / ", " | ").split(" | ").first() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + Jsoup.parse(infoElement.select(".page__text ").first().html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n") + manga.description = infoElement.select(".page__header h1").text().replace(" / ", " | ").split(" | ").first() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + Jsoup.parse(infoElement.select(".page__text ").first()!!.html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n") val src = infoElement.select(".img-wide img").attr("data-src") if (src.contains("://")) { manga.thumbnail_url = src diff --git a/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt b/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt index 23998c70f..92ea32520 100644 --- a/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt +++ b/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt @@ -39,9 +39,9 @@ class MangaBook : ParsedHttpSource() { override fun popularMangaSelector() = "article.short:not(.shnews) .short-in" override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select(".sh-desc a").first().let { + element.select(".sh-desc a").first()!!.let { setUrlWithoutDomain(it.attr("href")) - title = it.select("div.sh-title").text().split(" / ").sorted().first() + title = it.select("div.sh-title").text().split(" / ").min() } thumbnail_url = element.select(".short-poster.img-box > img").attr("src") } @@ -67,8 +67,8 @@ class MangaBook : ParsedHttpSource() { } is CategoryList -> { if (filter.state > 0) { - val CatQ = getCategoryList()[filter.state].query - url.addQueryParameter("cat", CatQ) + val catQ = getCategoryList()[filter.state].query + url.addQueryParameter("cat", catQ) } } is StatusList -> filter.state.forEach { status -> @@ -93,9 +93,9 @@ class MangaBook : ParsedHttpSource() { override fun searchMangaSelector(): String = popularMangaSelector() override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select(".flist.row a").first().let { + element.select(".flist.row a").first()!!.let { setUrlWithoutDomain(it.attr("href")) - title = it.select("h4 strong").text().split(" / ").sorted().first() + title = it.select("h4 strong").text().split(" / ").min() } thumbnail_url = element.select(".sposter img.img-responsive").attr("src") } @@ -114,11 +114,11 @@ class MangaBook : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("article.full .fmid").first() + val infoElement = document.select("article.full .fmid").first()!! val manga = SManga.create() val titlestr = document.select(".fheader h1").text().split(" / ").sorted() manga.title = titlestr.first() - manga.thumbnail_url = infoElement.select("img.img-responsive").first().attr("src") + manga.thumbnail_url = infoElement.select("img.img-responsive").first()!!.attr("src") manga.author = infoElement.select(".vis:contains(Автор) > a").text() manga.artist = infoElement.select(".vis:contains(Художник) > a").text() manga.status = if (document.select(".fheader h2").text() == "Чтение заблокировано") { @@ -156,7 +156,7 @@ class MangaBook : ParsedHttpSource() { val altSelector = document.select(".vis:contains(Другие названия) span") var altName = "" if (altSelector.isNotEmpty()) { - altName = "Альтернативные названия:\n" + altSelector.last().text() + "\n\n" + altName = "Альтернативные названия:\n" + altSelector.last()!!.text() + "\n\n" } manga.description = titlestr.last() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + infoElement.select(".fdesc.slice-this").text() return manga diff --git a/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt b/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt index 75e6bb06b..18d28c412 100644 --- a/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt +++ b/src/ru/mangahub/src/eu/kanade/tachiyomi/extension/ru/mangahub/Mangahub.kt @@ -87,7 +87,7 @@ open class Mangahub : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - manga.author = document.select("div.detail-attr:contains(Автор) div:gt(0)")?.text() // TODO: Add "Сценарист" and "Художник" + manga.author = document.select("div.detail-attr:contains(Автор) div:gt(0)").text() // TODO: Add "Сценарист" and "Художник" manga.genre = document.select(".tags").text().replace(" ", ", ") manga.description = document.select("div.markdown-style").text() manga.status = parseStatus(document.select("div.detail-attr:contains(перевод):eq(0)").toString()) @@ -103,12 +103,12 @@ open class Mangahub : ParsedHttpSource() { override fun chapterListSelector() = "div.py-2.px-3" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("div.align-items-center > a").first() + val urlElement = element.select("div.align-items-center > a").first()!! val chapter = SChapter.create() chapter.name = urlElement.text() - chapter.date_upload = element.select("div.text-muted").text()?.let { + chapter.date_upload = element.select("div.text-muted").text().let { SimpleDateFormat("dd.MM.yyyy", Locale.US).parse(it)?.time ?: 0L - } ?: 0 + } chapter.setUrlWithoutDomain(urlElement.attr("href")) return chapter } diff --git a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt index 59fd8dfdd..fbca87714 100644 --- a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt +++ b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt @@ -89,13 +89,11 @@ class MangaPoisk : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - thumbnail_url = getImage(element.select("a > img").first()) + thumbnail_url = getImage(element.select("a > img").first()!!) - element.select("a.card-about").first().let { - setUrlWithoutDomain(it.attr("href")) - } + setUrlWithoutDomain(element.select("a.card-about").first()!!.attr("href")) - element.select("a > h2.entry-title").first().let { + element.select("a > h2.entry-title").first()!!.let { title = it.text().split("/").first() } } @@ -113,7 +111,7 @@ class MangaPoisk : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("article div.card-body").first() + val infoElement = document.select("article div.card-body").first()!! val manga = SManga.create() val entitle = infoElement.select(".post-name-en") manga.title = if (entitle.isNullOrEmpty()) { infoElement.select(".post-name").text() } else entitle.text().replaceRange(0, 2, "") @@ -124,7 +122,7 @@ class MangaPoisk : ParsedHttpSource() { } else { parseStatus(infoElement.select(".post-info > span:eq(7)").text()) } - manga.thumbnail_url = infoElement.select("img.img-fluid").first().attr("src") + manga.thumbnail_url = infoElement.select("img.img-fluid").first()!!.attr("src") return manga } @@ -164,8 +162,8 @@ class MangaPoisk : ParsedHttpSource() { override fun chapterListSelector() = ".chapter-item" private fun chapterFromElement(element: Element, manga: SManga): SChapter { - val title = element.select("span.chapter-title").first().text() - val urlElement = element.select("a").first() + val title = element.select("span.chapter-title").first()!!.text() + val urlElement = element.select("a").first()!! val urlText = urlElement.text() val chapter = SChapter.create() diff --git a/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt b/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt index 8cd267814..47735631c 100644 --- a/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt +++ b/src/ru/nudemoon/src/eu/kanade/tachiyomi/extension/ru/nudemoon/Nudemoon.kt @@ -140,12 +140,12 @@ class Nudemoon : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val manga = SManga.create() - val infoElement = document.select("table.news_pic2").first() - manga.title = document.select("h1").first().text().substringBefore(" / ").substringBefore(" №") + val infoElement = document.select("table.news_pic2").first()!! + manga.title = document.select("h1").first()!!.text().substringBefore(" / ").substringBefore(" №") manga.author = infoElement.select("a[href*=mangaka]").text() manga.genre = infoElement.select("div.tag-links a").joinToString { it.text() } manga.description = document.select(".description").text() - manga.thumbnail_url = document.selectFirst("meta[property=og:image]").attr("abs:content") + manga.thumbnail_url = document.selectFirst("meta[property=og:image]")!!.attr("abs:content") return manga } diff --git a/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt b/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt index b14b275b1..445e13cf2 100644 --- a/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt +++ b/src/ru/unicomics/src/eu/kanade/tachiyomi/extension/ru/unicomics/UniComics.kt @@ -51,7 +51,7 @@ class UniComics : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { - is getEventsList -> { + is GetEventsList -> { if (filter.state > 0) { return GET("$baseDefaultUrl$PATH_events", headers) } @@ -82,7 +82,7 @@ class UniComics : ParsedHttpSource() { override fun searchMangaNextPageSelector() = ".b-pager__next" override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select("a.b-serp-item__title-link").first().let { + element.select("a.b-serp-item__title-link").first()!!.let { val originUrl = it.attr("href") val urlString = "/characters$|/creators$".toRegex().replace( @@ -115,7 +115,7 @@ class UniComics : ParsedHttpSource() { if (document.location().contains("$baseDefaultUrl$PATH_events")) { val mangas = document.select(".list_events").map { element -> SManga.create().apply { - element.select("a").first().let { + element.select("a").first()!!.let { setUrlWithoutDomain("/" + it.attr("href")) title = it.text() } @@ -178,11 +178,11 @@ class UniComics : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select(".left_comics img")!!.first().attr("src").replace(".jpg", "_big.jpg") - element.select("a").first().let { + manga.thumbnail_url = element.select(".left_comics img").first()!!.attr("src").replace(".jpg", "_big.jpg") + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) } - manga.title = element.select(".list_title").first().text() + manga.title = element.select(".list_title").first()!!.text() return manga } override fun popularMangaParse(response: Response) = searchMangaParse(response) @@ -199,14 +199,14 @@ class UniComics : ParsedHttpSource() { } override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val infoElement = document.select(".left_container div").first() - title = infoElement.select("h1").first().text() + val infoElement = document.select(".left_container div").first()!! + title = infoElement.select("h1").first()!!.text() thumbnail_url = if (infoElement.select("img").isNotEmpty()) { - infoElement.select("img").first().attr("src") + infoElement.select("img").first()!!.attr("src") } else { - document.select(".left_comics img").first().attr("src").replace(".jpg", "_big.jpg") + document.select(".left_comics img").first()!!.attr("src").replace(".jpg", "_big.jpg") } - description = infoElement.select("H2").first().text() + "\n" + infoElement.select("p").last()?.text().orEmpty() + description = infoElement.select("H2").first()!!.text() + "\n" + infoElement.select("p").last()?.text().orEmpty() author = infoElement.select("tr:contains(Издательство)").text() genre = infoElement.select("tr:contains(Жанр) a").joinToString { it.text() } } @@ -240,9 +240,9 @@ class UniComics : ParsedHttpSource() { } private fun chapterFromElement(element: Element, manga: SManga): SChapter { - val urlElement = element.select("td:contains(Читать) a").first() + val urlElement = element.select("td:contains(Читать) a").first()!! val chapter = SChapter.create() - element.select(".list_title").first().text().let { + element.select(".list_title").first()!!.text().let { val titleNoPrefix = it.removePrefix(manga.title).removePrefix(":").trim() chapter.name = if (titleNoPrefix.isNotEmpty()) { titleNoPrefix.replaceFirst(titleNoPrefix.first(), titleNoPrefix.first().uppercaseChar()) @@ -279,9 +279,9 @@ class UniComics : ParsedHttpSource() { override fun getFilterList() = FilterList( Publishers(publishersName), - getEventsList(), + GetEventsList(), ) - private class getEventsList : Filter.Select( + private class GetEventsList : Filter.Select( "События (только)", arrayOf("Нет", "в комиксах"), ) diff --git a/src/ru/waymanga/src/eu/kanade/tachiyomi/extension/ru/waymanga/WayManga.kt b/src/ru/waymanga/src/eu/kanade/tachiyomi/extension/ru/waymanga/WayManga.kt index b5490678a..fea2fbc9e 100644 --- a/src/ru/waymanga/src/eu/kanade/tachiyomi/extension/ru/waymanga/WayManga.kt +++ b/src/ru/waymanga/src/eu/kanade/tachiyomi/extension/ru/waymanga/WayManga.kt @@ -40,8 +40,8 @@ class WayManga : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("div.card-150 > img").first().attr("src") - element.select("a").first().let { + manga.thumbnail_url = element.select("div.card-150 > img").first()!!.attr("src") + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -50,8 +50,8 @@ class WayManga : ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("src") - element.select("div.col-6 a").first().let { + manga.thumbnail_url = element.select("img").first()!!.attr("src") + element.select("div.col-6 a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -60,8 +60,8 @@ class WayManga : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = element.select("img").first().attr("src") - element.select("a").first().let { + manga.thumbnail_url = element.select("img").first()!!.attr("src") + element.select("a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } @@ -76,16 +76,16 @@ class WayManga : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { setUrlWithoutDomain(document.location()) - title = document.selectFirst("title").text() - thumbnail_url = document.selectFirst("img.object-0").attr("src") + title = document.selectFirst("title")!!.text() + thumbnail_url = document.selectFirst("img.object-0")!!.attr("src") } override fun chapterListSelector() = "div.chapters-list > div" override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first() + val urlElement = element.select("a").first()!! val chapter = SChapter.create() - element.select("div.col-5").first().let { + element.select("div.col-5").first()!!.let { chapter.name = it.text() chapter.chapter_number = it.text().substringBefore(" глава").substringAfter("том ").toFloat() } diff --git a/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt b/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt index e9e03bc3c..55cc538ae 100644 --- a/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt +++ b/src/ru/webofcomics/src/eu/kanade/tachiyomi/extension/ru/webofcomics/WebOfComics.kt @@ -195,8 +195,8 @@ class WebOfComics : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - manga.thumbnail_url = baseUrl + element.select(".lazyload").first().attr("data-src").replace("/thumbs", "") - element.select(".movie-title").first().let { + manga.thumbnail_url = baseUrl + element.select(".lazyload").first()!!.attr("data-src").replace("/thumbs", "") + element.select(".movie-title").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.html().substringBefore("
") } @@ -239,37 +239,37 @@ class WebOfComics : ParsedHttpSource() { } val manga = SManga.create() - val infoElement = document.select(".page-cols").first() + val infoElement = document.select(".page-cols").first()!! val infoElement2 = document.select(".m-info2 .sliceinfo1") - manga.title = infoElement.select("h1").first().text() - manga.thumbnail_url = baseUrl + infoElement.select(".lazyload").first().attr("data-src") - manga.description = infoElement.select("H2").first().text() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + Jsoup.parse(document.select(".slice-this").first().html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n").substringAfter("Описание:").trim() + manga.title = infoElement.select("h1").first()!!.text() + manga.thumbnail_url = baseUrl + infoElement.select(".lazyload").first()!!.attr("data-src") + manga.description = infoElement.select("H2").first()!!.text() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + Jsoup.parse(document.select(".slice-this").first()!!.html().replace("
", "REPLACbR")).text().replace("REPLACbR", "\n").substringAfter("Описание:").trim() manga.author = infoElement2.select(":contains(Автор) a").joinToString { it.text() } if (manga.author.isNullOrEmpty()) { - manga.author = infoElement.select(".mi-item:contains(Издательство)").first().text() + manga.author = infoElement.select(".mi-item:contains(Издательство)").first()!!.text() } manga.artist = infoElement2.select(":contains(Художник) a").joinToString { it.text() } manga.genre = (infoElement.select(".mi-item:contains(Тип) a") + infoElement.select(".mi-item:contains(Возраст) a") + infoElement.select(".mi-item:contains(Формат) a") + infoElement.select(".mi-item:contains(Жанр) a")).joinToString { it.text() } manga.status = if (document.toString().contains("Удалено по просьбе правообладателя")) { SManga.LICENSED } else { - parseStatus(infoElement.select(".mi-item:contains(Перевод) a").first().text()) + parseStatus(infoElement.select(".mi-item:contains(Перевод) a").first()!!.text()) } return manga } override fun chapterListRequest(manga: SManga): Request { - val TypeSeries = if (manga.url.contains("/manga/")) { + val typeSeries = if (manga.url.contains("/manga/")) { "xsort='tommanga,glavamanga' template='custom-linkstocomics-xfmanga-guest'" } else { "xsort='number' template='custom-linkstocomics-xfcomics-guest'" } return POST( - baseUrl + "/engine/ajax/customajax.php", + "$baseUrl/engine/ajax/customajax.php", body = FormBody.Builder() - .add("castom", "custom senxf='fastnavigation|${manga.url.substringAfterLast("/").substringBefore("-")}' $TypeSeries limit='3000' sort='asc' cache='yes'") + .add("castom", "custom senxf='fastnavigation|${manga.url.substringAfterLast("/").substringBefore("-")}' $typeSeries limit='3000' sort='asc' cache='yes'") .build(), headers = headers, ) @@ -279,7 +279,7 @@ class WebOfComics : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() - element.select("a").first().let { + element.select("a").first()!!.let { val numberSection = it.text().substringBefore(" - ") chapter.name = it.text().substringAfterLast(":") chapter.chapter_number = if (numberSection.contains("#")) { @@ -289,7 +289,7 @@ class WebOfComics : ParsedHttpSource() { } chapter.setUrlWithoutDomain(it.attr("href")) } - chapter.date_upload = simpleDateFormat.parse(element.select("div").first().text().trim())?.time ?: 0L + chapter.date_upload = simpleDateFormat.parse(element.select("div").first()!!.text().trim())?.time ?: 0L return chapter } @@ -298,7 +298,7 @@ class WebOfComics : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - var baseImgUrl = document.select("link[rel='image_src']").last().attr("href") + var baseImgUrl = document.select("link[rel='image_src']").last()!!.attr("href") val publicUrl = "/public_html" val uploadUrl = diff --git a/src/ru/yagamiproject/src/eu/kanade/tachiyomi/extension/ru/mangabook/YagamiProject.kt b/src/ru/yagamiproject/src/eu/kanade/tachiyomi/extension/ru/mangabook/YagamiProject.kt index 6495f3825..e269f28ea 100644 --- a/src/ru/yagamiproject/src/eu/kanade/tachiyomi/extension/ru/mangabook/YagamiProject.kt +++ b/src/ru/yagamiproject/src/eu/kanade/tachiyomi/extension/ru/mangabook/YagamiProject.kt @@ -35,10 +35,10 @@ class YagamiProject : ParsedHttpSource() { override fun popularMangaSelector() = ".list .group" override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select(".title a").first().let { + element.select(".title a").first()!!.let { setUrlWithoutDomain(it.attr("href")) val baseTitle = it.attr("title") - title = if (baseTitle.isNullOrEmpty()) { it.text() } else baseTitle.split(" / ").sorted().first() + title = if (baseTitle.isNullOrEmpty()) { it.text() } else baseTitle.split(" / ").min() } thumbnail_url = element.select(".cover_mini > img").attr("src").replace("thumb_", "") } @@ -59,15 +59,15 @@ class YagamiProject : ParsedHttpSource() { when (filter) { is CategoryList -> { if (filter.state > 0) { - val CatQ = getCategoryList()[filter.state].name - val catUrl = "$baseUrl/tags/$CatQ".toHttpUrlOrNull()!!.newBuilder() + val catQ = getCategoryList()[filter.state].name + val catUrl = "$baseUrl/tags/$catQ".toHttpUrlOrNull()!!.newBuilder() return GET(catUrl.toString(), headers) } } is FormatList -> { if (filter.state > 0) { - val FormN = getFormatList()[filter.state].query - val formaUrl = "$baseUrl/$FormN".toHttpUrlOrNull()!!.newBuilder() + val formN = getFormatList()[filter.state].query + val formaUrl = "$baseUrl/$formN".toHttpUrlOrNull()!!.newBuilder() return GET(formaUrl.toString(), headers) } } @@ -86,26 +86,26 @@ class YagamiProject : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select(".large.comic .info").first() + val infoElement = document.select(".large.comic .info").first()!! val manga = SManga.create() val titlestr = document.select("title").text().substringBefore(" :: Yagami").split(" :: ").sorted() manga.title = titlestr.first().replace(":: ", "") - manga.thumbnail_url = document.select(".cover img").first().attr("src") - manga.author = infoElement.select("li:contains(Автор(ы):)")?.first()?.text()?.substringAfter("Автор(ы): ")?.split(" / ")?.sorted()?.first()?.replace("N/A", "")?.trim() - manga.artist = infoElement.select("li:contains(Художник(и):)")?.first()?.text()?.substringAfter("Художник(и): ")?.split(" / ")?.sorted()?.first()?.replace("N/A", "")?.trim() - manga.status = when (infoElement.select("li:contains(Статус перевода:) span")?.first()?.text()) { + manga.thumbnail_url = document.select(".cover img").first()!!.attr("src") + manga.author = infoElement.select("li:contains(Автор(ы):)").first()?.text()?.substringAfter("Автор(ы): ")?.split(" / ")?.min()?.replace("N/A", "")?.trim() + manga.artist = infoElement.select("li:contains(Художник(и):)").first()?.text()?.substringAfter("Художник(и): ")?.split(" / ")?.min()?.replace("N/A", "")?.trim() + manga.status = when (infoElement.select("li:contains(Статус перевода:) span").first()?.text()) { "онгоинг" -> SManga.ONGOING "активный" -> SManga.ONGOING "завершён" -> SManga.COMPLETED else -> SManga.UNKNOWN } - manga.genre = infoElement.select("li:contains(Жанры:)")?.first()?.text()?.substringAfter("Жанры: ") + manga.genre = infoElement.select("li:contains(Жанры:)").first()?.text()?.substringAfter("Жанры: ") val altSelector = infoElement.select("li:contains(Название:)") var altName = "" if (altSelector.isNotEmpty()) { altName = "Альтернативные названия:\n" + altSelector.first().toString().replace("
  • Название: ", "").replace("
    ", " / ").substringAfter(" / ").substringBefore("
  • ") + "\n\n" } - val descriptElem = infoElement.select("li:contains(Описание:)")?.first()?.text()?.substringAfter("Описание: ") ?: "" + val descriptElem = infoElement.select("li:contains(Описание:)").first()?.text()?.substringAfter("Описание: ") ?: "" manga.description = titlestr.last().replace(":: ", "") + "\n" + altName + descriptElem return manga } @@ -114,7 +114,7 @@ class YagamiProject : ParsedHttpSource() { override fun chapterListSelector(): String = ".list .element" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { val chapter = element.select(".title a") - val chapterScan_Date = element.select(".meta_r") + val chapterScanDate = element.select(".meta_r") name = if (chapter.attr("title").isNullOrBlank()) { chapter.text() @@ -125,9 +125,9 @@ class YagamiProject : ParsedHttpSource() { chapter_number = name.substringBefore(":").substringAfterLast(" ").substringAfterLast("№").substringAfterLast("#").toFloatOrNull() ?: chapter.attr("href").substringBeforeLast("/").substringAfterLast("/").toFloatOrNull() ?: -1f setUrlWithoutDomain(chapter.attr("href")) - date_upload = parseDate(chapterScan_Date.text().substringAfter(", ")) - scanlator = if (chapterScan_Date.select("a").isNotEmpty()) { - chapterScan_Date.select("a").map { it.text() }.joinToString(" / ") + date_upload = parseDate(chapterScanDate.text().substringAfter(", ")) + scanlator = if (chapterScanDate.select("a").isNotEmpty()) { + chapterScanDate.select("a").joinToString(" / ") { it.text() } } else { null } @@ -158,7 +158,7 @@ class YagamiProject : ParsedHttpSource() { override fun imageUrlParse(document: Document): String { val defaultimg = document.select("#page img").attr("src") return if (defaultimg.contains("string(1)")) { - document.select("#get_download").first().attr("href") + document.select("#get_download").first()!!.attr("href") } else { defaultimg } diff --git a/src/th/mikudoujin/src/eu/kanade/tachiyomi/extension/th/mikudoujin/MikuDoujin.kt b/src/th/mikudoujin/src/eu/kanade/tachiyomi/extension/th/mikudoujin/MikuDoujin.kt index b90ca601e..4267e05a6 100644 --- a/src/th/mikudoujin/src/eu/kanade/tachiyomi/extension/th/mikudoujin/MikuDoujin.kt +++ b/src/th/mikudoujin/src/eu/kanade/tachiyomi/extension/th/mikudoujin/MikuDoujin.kt @@ -124,7 +124,7 @@ class MikuDoujin : ParsedHttpSource() { // Manga summary page override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.sr-card-body").first() + val infoElement = document.select("div.sr-card-body").first()!! return SManga.create().apply { title = document.title() @@ -133,8 +133,8 @@ class MikuDoujin : ParsedHttpSource() { status = SManga.UNKNOWN genre = infoElement.select("div.sr-card-body div.col-md-8 div.tags a") .joinToString { it.text() } - description = infoElement.select("div.col-md-8").first().ownText() - thumbnail_url = infoElement.select("div.col-md-4 img").first().attr("abs:src") + description = infoElement.select("div.col-md-8").first()!!.ownText() + thumbnail_url = infoElement.select("div.col-md-4 img").first()!!.attr("abs:src") initialized = true } } diff --git a/src/th/niceoppai/src/eu/kanade/tachiyomi/extension/th/niceoppai/Niceoppai.kt b/src/th/niceoppai/src/eu/kanade/tachiyomi/extension/th/niceoppai/Niceoppai.kt index d3594bfe7..3e905ef94 100644 --- a/src/th/niceoppai/src/eu/kanade/tachiyomi/extension/th/niceoppai/Niceoppai.kt +++ b/src/th/niceoppai/src/eu/kanade/tachiyomi/extension/th/niceoppai/Niceoppai.kt @@ -100,8 +100,8 @@ class Niceoppai : ParsedHttpSource() { else -> SManga.UNKNOWN } override fun mangaDetailsParse(document: Document): SManga { - val infoElement = document.select("div.det").first() - val titleElement = document.select("h1.ttl").first() + val infoElement = document.select("div.det").first()!! + val titleElement = document.select("h1.ttl").first()!! return SManga.create().apply { title = titleElement.text() @@ -109,8 +109,8 @@ class Niceoppai : ParsedHttpSource() { artist = author status = getStatus(infoElement.select("p")[9].ownText().replace(": ", "")) genre = infoElement.select("p")[5].select("a").joinToString { it.text() } - description = infoElement.select("p").first().ownText().replace(": ", "") - thumbnail_url = document.select("div.mng_ifo div.cvr_ara img").first().attr("abs:src") + description = infoElement.select("p").first()!!.ownText().replace(": ", "") + thumbnail_url = document.select("div.mng_ifo div.cvr_ara img").first()!!.attr("abs:src") initialized = true } } @@ -222,7 +222,7 @@ class Niceoppai : ParsedHttpSource() { override fun chapterListParse(response: Response): List { val document = response.asJsoup() - val listPage = document.select("ul.pgg li a") + val listPage = document.select("ul.pgg li a").toList() .filter { it.text() != "Next" && it.text() != "Last" } .map { it.select("a").attr("href") } .distinct() diff --git a/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt b/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt index 2178fcd1a..adec6abe7 100644 --- a/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt +++ b/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt @@ -104,7 +104,7 @@ class SeriManga : ParsedHttpSource() { override fun chapterFromElement(element: Element) = SChapter.create().apply { setUrlWithoutDomain(element.select("a").attr("href")) - name = "${element.select("span").first().text()}: ${element.select("span")[1].text()}" + name = "${element.select("span").first()!!.text()}: ${element.select("span")[1].text()}" date_upload = dateFormat.parse(element.select("span")[2].ownText())?.time ?: 0 } diff --git a/src/uk/mangainua/src/eu/kanade/tachiyomi/extension/uk/mangainua/Mangainua.kt b/src/uk/mangainua/src/eu/kanade/tachiyomi/extension/uk/mangainua/Mangainua.kt index d6defda74..1dfc8e0a2 100644 --- a/src/uk/mangainua/src/eu/kanade/tachiyomi/extension/uk/mangainua/Mangainua.kt +++ b/src/uk/mangainua/src/eu/kanade/tachiyomi/extension/uk/mangainua/Mangainua.kt @@ -37,7 +37,7 @@ class Mangainua : ParsedHttpSource() { override fun popularMangaSelector() = "div.owl-carousel div.card--big" override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select("h3.card__title a").first().let { + element.select("h3.card__title a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -53,7 +53,7 @@ class Mangainua : ParsedHttpSource() { override fun latestUpdatesSelector() = "main.main article.item" override fun latestUpdatesFromElement(element: Element): SManga { return SManga.create().apply { - element.select("h3.card__title a").first().let { + element.select("h3.card__title a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -83,7 +83,7 @@ class Mangainua : ParsedHttpSource() { override fun searchMangaSelector() = latestUpdatesSelector() override fun searchMangaFromElement(element: Element): SManga { return SManga.create().apply { - element.select("h3.card__title a").first().let { + element.select("h3.card__title a").first()!!.let { setUrlWithoutDomain(it.attr("href")) title = it.text() } @@ -97,8 +97,8 @@ class Mangainua : ParsedHttpSource() { return SManga.create().apply { title = document.select("span.UAname").text() description = document.select("div.item__full-description").text() - genre = document.select("div.item__full-sideba--header:eq(4) span").first().select("a").joinToString { it.text() } - thumbnail_url = document.select("div.item__full-sidebar--poster img").first().attr("abs:src") + genre = document.select("div.item__full-sideba--header:eq(4) span").first()!!.select("a").joinToString { it.text() } + thumbnail_url = document.select("div.item__full-sidebar--poster img").first()!!.attr("abs:src") } } diff --git a/src/vi/blogtruyen/src/eu/kanade/tachiyomi/extension/vi/blogtruyen/BlogTruyen.kt b/src/vi/blogtruyen/src/eu/kanade/tachiyomi/extension/vi/blogtruyen/BlogTruyen.kt index 02ffdff19..0c73e9884 100644 --- a/src/vi/blogtruyen/src/eu/kanade/tachiyomi/extension/vi/blogtruyen/BlogTruyen.kt +++ b/src/vi/blogtruyen/src/eu/kanade/tachiyomi/extension/vi/blogtruyen/BlogTruyen.kt @@ -63,7 +63,7 @@ class BlogTruyen : ParsedHttpSource() { val manga = document.select(popularMangaSelector()).map { val tiptip = it.attr("data-tiptip") - popularMangaFromElement(it, document.getElementById(tiptip)) + popularMangaFromElement(it, document.getElementById(tiptip)!!) } val hasNextPage = document.selectFirst(popularMangaNextPageSelector()) != null @@ -77,12 +77,12 @@ class BlogTruyen : ParsedHttpSource() { throw UnsupportedOperationException("Not used") private fun popularMangaFromElement(element: Element, tiptip: Element) = SManga.create().apply { - val anchor = element.selectFirst("a") + val anchor = element.selectFirst("a")!! setUrlWithoutDomain(anchor.attr("href")) title = anchor.attr("title").replace("truyện tranh ", "").trim() - thumbnail_url = tiptip.selectFirst("img").attr("abs:src") - description = tiptip.selectFirst(".al-j").text() + thumbnail_url = tiptip.selectFirst("img")!!.attr("abs:src") + description = tiptip.selectFirst(".al-j")!!.text() } override fun popularMangaNextPageSelector() = ".paging:last-child:not(.current_page)" @@ -112,7 +112,7 @@ class BlogTruyen : ParsedHttpSource() { // it's a chapter, resolve to manga ID if (id.startsWith("c")) { val document = client.newCall(GET("$baseUrl/$id", headers)).execute().asJsoup() - id = document.selectFirst(".breadcrumbs a:last-child").attr("href").removePrefix("/") + id = document.selectFirst(".breadcrumbs a:last-child")!!.attr("href").removePrefix("/") } fetchMangaDetails( @@ -195,7 +195,7 @@ class BlogTruyen : ParsedHttpSource() { val manga = document.select(searchMangaSelector()).map { val tiptip = it.attr("data-tiptip") - searchMangaFromElement(it, document.getElementById(tiptip)) + searchMangaFromElement(it, document.getElementById(tiptip)!!) } val hasNextPage = document.selectFirst(searchMangaNextPageSelector()) != null @@ -213,13 +213,13 @@ class BlogTruyen : ParsedHttpSource() { override fun searchMangaNextPageSelector() = ".pagination .glyphicon-step-forward" - private fun getMangaTitle(document: Document) = document.selectFirst(".entry-title a") + private fun getMangaTitle(document: Document) = document.selectFirst(".entry-title a")!! .attr("title") .replaceFirst("truyện tranh", "", false) .trim() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val anchor = document.selectFirst(".entry-title a") + val anchor = document.selectFirst(".entry-title a")!! setUrlWithoutDomain(anchor.attr("href")) title = getMangaTitle(document) @@ -232,7 +232,7 @@ class BlogTruyen : ParsedHttpSource() { description = StringBuilder().apply { // the actual synopsis - val synopsisBlock = document.selectFirst(".manga-detail .detail .content") + val synopsisBlock = document.selectFirst(".manga-detail .detail .content")!! // replace the facebook blockquote in synopsis with the link (if there is one) val fbElement = synopsisBlock.selectFirst(".fb-page, .fb-group") @@ -302,13 +302,13 @@ class BlogTruyen : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter = throw UnsupportedOperationException("Not used") private fun chapterFromElement(element: Element, title: String): SChapter = SChapter.create().apply { - val anchor = element.select("span > a").first() + val anchor = element.select("span > a").first()!! setUrlWithoutDomain(anchor.attr("href")) name = anchor.attr("title").replace(title, "", true).trim() - date_upload = kotlin.runCatching { + date_upload = runCatching { dateFormat.parse( - element.selectFirst("span.publishedDate").text(), + element.selectFirst("span.publishedDate")!!.text(), )?.time }.getOrNull() ?: 0L } @@ -323,9 +323,9 @@ class BlogTruyen : ParsedHttpSource() { ) private fun countView(document: Document) { - val mangaId = document.getElementById("MangaId").attr("value") - val chapterId = document.getElementById("ChapterId").attr("value") - kotlin.runCatching { + val mangaId = document.getElementById("MangaId")!!.attr("value") + val chapterId = document.getElementById("ChapterId")!!.attr("value") + runCatching { client.newCall(countViewRequest(mangaId, chapterId)).execute().close() } } diff --git a/src/vi/cuutruyen/src/eu/kanade/tachiyomi/extension/vi/cuutruyen/dto/ChapterDto.kt b/src/vi/cuutruyen/src/eu/kanade/tachiyomi/extension/vi/cuutruyen/dto/ChapterDto.kt index 05afce745..7c66da9a2 100644 --- a/src/vi/cuutruyen/src/eu/kanade/tachiyomi/extension/vi/cuutruyen/dto/ChapterDto.kt +++ b/src/vi/cuutruyen/src/eu/kanade/tachiyomi/extension/vi/cuutruyen/dto/ChapterDto.kt @@ -31,7 +31,7 @@ data class ChapterDto( name += ": ${dto.name}" } - date_upload = kotlin.runCatching { + date_upload = runCatching { DATE_FORMATTER.parse(dto.updatedAt.replace("+07:00", "Z"))?.time }.getOrNull() ?: 0L diff --git a/src/vi/hentaivn/src/eu/kanade/tachiyomi/extension/vi/hentaivn/HentaiVN.kt b/src/vi/hentaivn/src/eu/kanade/tachiyomi/extension/vi/hentaivn/HentaiVN.kt index 6f0dfe673..56f9c31c8 100644 --- a/src/vi/hentaivn/src/eu/kanade/tachiyomi/extension/vi/hentaivn/HentaiVN.kt +++ b/src/vi/hentaivn/src/eu/kanade/tachiyomi/extension/vi/hentaivn/HentaiVN.kt @@ -66,7 +66,7 @@ class HentaiVN : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "ul.pagination > li:contains(Next)" override fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() - element.select(".box-description a").first().let { + element.select(".box-description a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text().trim() } @@ -88,7 +88,7 @@ class HentaiVN : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { if (element.select("a").isEmpty()) throw Exception(element.select("h2").html()) val chapter = SChapter.create() - element.select("a").first().let { + element.select("a").first()!!.let { chapter.name = it.select("h2").text() chapter.setUrlWithoutDomain(it.attr("href")) } @@ -115,7 +115,7 @@ class HentaiVN : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select(".main > .page-left > .left-info > .page-info") val manga = SManga.create() - manga.title = document.selectFirst(".breadcrumb2 li:last-child span").text() + manga.title = document.selectFirst(".breadcrumb2 li:last-child span")!!.text() manga.author = infoElement.select("p:contains(Tác giả:) a").text() manga.description = infoElement.select(":root > p:contains(Nội dung:) + p").text() manga.genre = infoElement.select("p:contains(Thể loại:) a").joinToString { it.text() } @@ -162,7 +162,7 @@ class HentaiVN : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select(".search-des > a, .box-description a").first().let { + element.select(".search-des > a, .box-description a").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text().trim() } diff --git a/src/vi/lxhentai/src/eu/kanade/tachiyomi/extension/vi/lxhentai/LxHentai.kt b/src/vi/lxhentai/src/eu/kanade/tachiyomi/extension/vi/lxhentai/LxHentai.kt index 97e229ac7..e424ce81a 100644 --- a/src/vi/lxhentai/src/eu/kanade/tachiyomi/extension/vi/lxhentai/LxHentai.kt +++ b/src/vi/lxhentai/src/eu/kanade/tachiyomi/extension/vi/lxhentai/LxHentai.kt @@ -110,10 +110,10 @@ class LxHentai : ParsedHttpSource() { override fun searchMangaSelector(): String = "div.grid div.manga-vertical" override fun searchMangaFromElement(element: Element) = SManga.create().apply { - setUrlWithoutDomain(element.select("div.p-2.truncate a").first().attr("href")) - title = element.select("div.p-2.truncate a").first().text() + setUrlWithoutDomain(element.select("div.p-2.truncate a").first()!!.attr("href")) + title = element.select("div.p-2.truncate a").first()!!.text() thumbnail_url = element.select("div.cover") - .first() + .first()!! .attr("style") .substringAfter("url('") .substringBefore("')") @@ -122,7 +122,7 @@ class LxHentai : ParsedHttpSource() { override fun searchMangaNextPageSelector() = "li:contains(Cuối)" override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.select("span.text-lg.ml-1.font-semibold").first().text() + title = document.select("span.text-lg.ml-1.font-semibold").first()!!.text() author = document.select("div.grow div.mt-2:contains(Tác giả) span a") .joinToString { it.text().trim(',', ' ') } genre = document.select("div.grow div.mt-2:contains(Thể loại) span a") @@ -146,12 +146,12 @@ class LxHentai : ParsedHttpSource() { }.trim() thumbnail_url = document.select(".cover") - .first() + .first()!! .attr("style") .substringAfter("url('") .substringBefore("')") - val statusString = document.select("div.grow div.mt-2:contains(Tình trạng) a").first().text() + val statusString = document.select("div.grow div.mt-2:contains(Tình trạng) a").first()!!.text() status = when (statusString) { "Đã hoàn thành" -> SManga.COMPLETED "Đang tiến hành" -> SManga.ONGOING @@ -164,7 +164,7 @@ class LxHentai : ParsedHttpSource() { override fun chapterFromElement(element: Element) = SChapter.create().apply { setUrlWithoutDomain(element.attr("href")) name = element.select("span.text-ellipsis").text() - date_upload = kotlin.runCatching { + date_upload = runCatching { dateFormat.parse(element.select("span.timeago").attr("datetime"))?.time }.getOrNull() ?: 0L diff --git a/src/vi/mangaxy/src/eu/kanade/tachiyomi/extension/vi/MangaXY/MangaXY.kt b/src/vi/mangaxy/src/eu/kanade/tachiyomi/extension/vi/MangaXY/MangaXY.kt index 3798bb1af..6430a022d 100644 --- a/src/vi/mangaxy/src/eu/kanade/tachiyomi/extension/vi/MangaXY/MangaXY.kt +++ b/src/vi/mangaxy/src/eu/kanade/tachiyomi/extension/vi/MangaXY/MangaXY.kt @@ -52,12 +52,12 @@ class MangaXY : ParsedHttpSource() { override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a.name").first().let { + element.select("a.name").first()!!.let { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text().trim() } manga.thumbnail_url = element.select(".item img") - .first() + .first()!! .attr("style") .substringAfter("url('") .substringBefore("')") @@ -241,19 +241,19 @@ class MangaXY : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val infoElement = document.selectFirst(".tab-content") - val infoTop = document.selectFirst(".detail-top-wrap") + val infoElement = document.selectFirst(".tab-content")!! + val infoTop = document.selectFirst(".detail-top-wrap")!! val statusString0 = infoElement.select("div.manga-info > ul > li:nth-child(3) > a").firstOrNull()?.text() val statusString1 = infoElement.select("div.manga-info > ul > li:nth-child(4) > a").firstOrNull()?.text() val statusString2 = infoElement.select("div.manga-info > ul > li:nth-child(5) > a").firstOrNull()?.text() title = infoTop.select("h1.comics-title").text() author = infoTop.select(".created-by").joinToString { it.text() } - genre = infoTop.select(".top-comics-type a") + genre = infoTop.select(".top-comics-type a").toList() .filter { it.text().isNotEmpty() } .joinToString(", ") { it.text() } description = infoElement.select(".manga-info p").textWithLinebreaks() thumbnail_url = infoTop.select(".detail-top-right img") - .first() + .first()!! .attr("style") .substringAfter("url('") .substringBefore("')") @@ -296,8 +296,8 @@ class MangaXY : ParsedHttpSource() { override fun chapterListSelector() = "#ChapList > .episode-item" override fun chapterFromElement(element: Element) = SChapter.create().apply { - setUrlWithoutDomain(element.select(".episode-item").first().attr("abs:href")) - name = element.select(".episode-title").first().text() + setUrlWithoutDomain(element.select(".episode-item").first()!!.attr("abs:href")) + name = element.select(".episode-title").first()!!.text() date_upload = runCatching { dateFormat.parse(element.select("div.episode-date > time").attr("datetime"))?.time }.getOrNull() ?: 0L diff --git a/src/vi/medoctruyentranh/src/eu/kanade/tachiyomi/extension/vi/medoctruyentranh/MeDocTruyenTranh.kt b/src/vi/medoctruyentranh/src/eu/kanade/tachiyomi/extension/vi/medoctruyentranh/MeDocTruyenTranh.kt index 9c2666ff5..d8d7dc94f 100644 --- a/src/vi/medoctruyentranh/src/eu/kanade/tachiyomi/extension/vi/medoctruyentranh/MeDocTruyenTranh.kt +++ b/src/vi/medoctruyentranh/src/eu/kanade/tachiyomi/extension/vi/medoctruyentranh/MeDocTruyenTranh.kt @@ -46,7 +46,7 @@ class MeDocTruyenTranh : ParsedHttpSource() { val document = response.asJsoup() // trying to build URLs from this JSONObject could cause issues but we need it to get thumbnails - val nextData = document.select("script#__NEXT_DATA__").first() + val nextData = document.select("script#__NEXT_DATA__").first()!! .let { json.parseToJsonElement(it.data()).jsonObject } val titleCoverMap = nextData["props"]!! @@ -54,14 +54,12 @@ class MeDocTruyenTranh : ParsedHttpSource() { .jsonObject["initialState"]!! .jsonObject["classify"]!! .jsonObject["comics"]!! - .jsonArray - .map { + .jsonArray.associate { Pair( it.jsonObject["title"]!!.jsonPrimitive.content, it.jsonObject["coverimg"]!!.jsonPrimitive.content, ) } - .toMap() val mangas = document.select(popularMangaSelector()).map { popularMangaFromElement(it).apply { @@ -87,7 +85,7 @@ class MeDocTruyenTranh : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - val jsonData = element.ownerDocument().select("#__NEXT_DATA__").first()!!.data() + val jsonData = element.ownerDocument()!!.select("#__NEXT_DATA__").first()!!.data() manga.setUrlWithoutDomain(element.attr("href")) manga.title = element.select("div.storytitle").text() @@ -102,7 +100,7 @@ class MeDocTruyenTranh : ParsedHttpSource() { override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val nextData = document.select("script#__NEXT_DATA__").first() + val nextData = document.select("script#__NEXT_DATA__").first()!! .let { json.parseToJsonElement(it.data()).jsonObject } val mangaDetail = nextData["props"]!! @@ -129,7 +127,7 @@ class MeDocTruyenTranh : ParsedHttpSource() { override fun chapterListSelector() = "div.chapters a" override fun chapterListParse(response: Response): List { - val nextData = response.asJsoup().select("script#__NEXT_DATA__").first() + val nextData = response.asJsoup().select("script#__NEXT_DATA__").first()!! .let { json.parseToJsonElement(it.data()).jsonObject } return nextData["props"]!! diff --git a/src/vi/qmanga/src/eu/kanade/tachiyomi/extension/vi/qmanga/QManga.kt b/src/vi/qmanga/src/eu/kanade/tachiyomi/extension/vi/qmanga/QManga.kt index 9d7ede572..ddc2219e1 100644 --- a/src/vi/qmanga/src/eu/kanade/tachiyomi/extension/vi/qmanga/QManga.kt +++ b/src/vi/qmanga/src/eu/kanade/tachiyomi/extension/vi/qmanga/QManga.kt @@ -135,7 +135,7 @@ class QManga : ParsedHttpSource() { val dateUploadString = element.select("span").first()?.text() if (!dateUploadString.isNullOrEmpty()) { - date_upload = kotlin.runCatching { + date_upload = runCatching { dateFormat.parse(dateUploadString)?.time }.getOrNull() ?: 0L } diff --git a/src/vi/truyengihot/src/eu/kanade/tachiyomi/extension/vi/truyengihot/TruyenGiHot.kt b/src/vi/truyengihot/src/eu/kanade/tachiyomi/extension/vi/truyengihot/TruyenGiHot.kt index c4e56bdaa..158d4eb29 100644 --- a/src/vi/truyengihot/src/eu/kanade/tachiyomi/extension/vi/truyengihot/TruyenGiHot.kt +++ b/src/vi/truyengihot/src/eu/kanade/tachiyomi/extension/vi/truyengihot/TruyenGiHot.kt @@ -99,7 +99,7 @@ class TruyenGiHot : ParsedHttpSource() { id += ".html" } if (!id.startsWith("/")) { - id = "/" + id + id = "/$id" } fetchMangaDetails( @@ -182,7 +182,7 @@ class TruyenGiHot : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { setUrlWithoutDomain(element.attr("href")) - val infoBlock = element.selectFirst("span.info") + val infoBlock = element.selectFirst("span.info")!! name = infoBlock.select("span.no").text() date_upload = parseChapterDate(infoBlock.select("span.date").text()) } diff --git a/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt b/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt index a06605c4f..9a052bc3e 100644 --- a/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt +++ b/src/vi/truyenqq/src/eu/kanade/tachiyomi/extension/vi/truyenqq/TruyenQQ.kt @@ -50,7 +50,7 @@ class TruyenQQ : ParsedHttpSource() { override fun popularMangaSelector(): String = "ul.grid > li" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - val anchor = element.selectFirst(".book_info .qtip a") + val anchor = element.selectFirst(".book_info .qtip a")!! setUrlWithoutDomain(anchor.attr("href")) title = anchor.text() thumbnail_url = element.select(".book_avatar img").attr("abs:src") @@ -95,7 +95,7 @@ class TruyenQQ : ParsedHttpSource() { override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - val info = document.selectFirst(".list-info") + val info = document.selectFirst(".list-info")!! title = document.select("h1").text() author = info.select(".org").joinToString { it.text() } @@ -124,7 +124,7 @@ class TruyenQQ : ParsedHttpSource() { date_upload = parseDate(element.select(".time-chap").text()) } - private fun parseDate(date: String): Long = kotlin.runCatching { + private fun parseDate(date: String): Long = runCatching { dateFormat.parse(date)?.time }.getOrNull() ?: 0L diff --git a/src/vi/truyentranh8/src/eu/kanade/tachiyomi/extension/vi/truyentranh8/TruyenTranh8.kt b/src/vi/truyentranh8/src/eu/kanade/tachiyomi/extension/vi/truyentranh8/TruyenTranh8.kt index b9f650701..042e2cdc8 100644 --- a/src/vi/truyentranh8/src/eu/kanade/tachiyomi/extension/vi/truyentranh8/TruyenTranh8.kt +++ b/src/vi/truyentranh8/src/eu/kanade/tachiyomi/extension/vi/truyentranh8/TruyenTranh8.kt @@ -60,9 +60,9 @@ class TruyenTranh8 : ParsedHttpSource() { override fun popularMangaSelector(): String = "div#tblChap figure.col" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - setUrlWithoutDomain(element.select("figcaption h3 a").first().attr("href")) - title = element.select("figcaption h3 a").first().text().replace("[TT8] ", "") - thumbnail_url = element.select("img").first().attr("abs:src") + setUrlWithoutDomain(element.select("figcaption h3 a").first()!!.attr("href")) + title = element.select("figcaption h3 a").first()!!.text().replace("[TT8] ", "") + thumbnail_url = element.select("img").first()!!.attr("abs:src") } override fun latestUpdatesRequest(page: Int) = GET( @@ -166,26 +166,26 @@ class TruyenTranh8 : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.select("h1.fs-5").first().text().replace("Truyện Tranh ", "") + title = document.select("h1.fs-5").first()!!.text().replace("Truyện Tranh ", "") - author = document.select("span[itemprop=author]") + author = document.select("span[itemprop=author]").toList() .filter { it.text().isNotEmpty() } .joinToString(", ") { it.text() } - thumbnail_url = document.select("img.thumbnail").first().attr("abs:src") + thumbnail_url = document.select("img.thumbnail").first()!!.attr("abs:src") - genre = document.select("a[itemprop=genre]") + genre = document.select("a[itemprop=genre]").toList() .filter { it.text().isNotEmpty() } .joinToString(", ") { it.text() } - status = when (document.select("ul.mangainfo b:contains(Tình Trạng) + a").first().text().trim()) { + status = when (document.select("ul.mangainfo b:contains(Tình Trạng) + a").first()!!.text().trim()) { "Đang tiến hành" -> SManga.ONGOING "Đã hoàn thành" -> SManga.COMPLETED "Tạm ngưng" -> SManga.ON_HIATUS else -> SManga.UNKNOWN } - val descnode = document.select("div.card-body.border-start.border-info.border-3").first() + val descnode = document.select("div.card-body.border-start.border-info.border-3").first()!! descnode.select(Evaluator.Tag("br")).prepend("\\n") description = if (descnode.select("p").any()) { @@ -200,10 +200,10 @@ class TruyenTranh8 : ParsedHttpSource() { override fun chapterListSelector() = "ul#ChapList li" override fun chapterFromElement(element: Element) = SChapter.create().apply { - setUrlWithoutDomain(element.select("a").first().attr("abs:href")) - name = element.text().replace(element.select("time").first().text(), "") + setUrlWithoutDomain(element.select("a").first()!!.attr("abs:href")) + name = element.text().replace(element.select("time").first()!!.text(), "") date_upload = runCatching { - dateFormatter.parse(element.select("time").first().attr("datetime"))?.time + dateFormatter.parse(element.select("time").first()!!.attr("datetime"))?.time }.getOrNull() ?: 0L val match = floatingNumberRegex.find(name) @@ -216,7 +216,7 @@ class TruyenTranh8 : ParsedHttpSource() { override fun pageListParse(document: Document) = document.select("div.page-chapter") .mapIndexed { i, elem -> - Page(i, "", elem.select("img").first().attr("abs:src")) + Page(i, "", elem.select("img").first()!!.attr("abs:src")) } override fun imageUrlParse(document: Document): String = throw Exception("Not used") diff --git a/src/vi/yurineko/src/eu/kanade/tachiyomi/extension/vi/yurineko/YuriNeko.kt b/src/vi/yurineko/src/eu/kanade/tachiyomi/extension/vi/yurineko/YuriNeko.kt index 6d26be8a1..b929e7cff 100644 --- a/src/vi/yurineko/src/eu/kanade/tachiyomi/extension/vi/yurineko/YuriNeko.kt +++ b/src/vi/yurineko/src/eu/kanade/tachiyomi/extension/vi/yurineko/YuriNeko.kt @@ -65,7 +65,7 @@ class YuriNeko : HttpSource() { private fun errorIntercept(chain: Interceptor.Chain): Response { val response = chain.proceed(chain.request()) - if (response.code >= 400 && response.body != null) { + if (response.code >= 400) { val error = try { response.parseAs() } catch (_: Throwable) { diff --git a/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt b/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt index fe8c09fda..4987b87a6 100644 --- a/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt +++ b/src/zh/baimangu/src/eu/kanade/tachiyomi/extension/zh/baimangu/Baimangu.kt @@ -55,10 +55,10 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() { private var commonSelector = "li.fed-list-item" private var commonNextPageSelector = "a.fed-btns-info.fed-rims-info:nth-last-child(4)" private fun commonMangaFromElement(element: Element): SManga { - val picElement = element.select("a.fed-list-pics").first() + val picElement = element.select("a.fed-list-pics").first()!! val picUrl = picElement.attr("data-original") val manga = SManga.create().apply { - title = element.select("a.fed-list-title").first().text() + title = element.select("a.fed-list-title").first()!!.text() if (!invalidCoverImageDomains.any { picUrl.contains(it) }) { thumbnail_url = picUrl @@ -141,20 +141,20 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() { return commonMangaFromElement(element) } - val picElement = element.select("a.fed-list-pics").first() + val picElement = element.select("a.fed-list-pics").first()!! return SManga.create().apply { - title = element.select("dd.fed-deta-content a:first-child").first().text() + title = element.select("dd.fed-deta-content a:first-child").first()!!.text() thumbnail_url = picElement.attr("data-original") setUrlWithoutDomain(picElement.attr("href")) } } override fun mangaDetailsParse(document: Document): SManga { - val picElement = document.select("a.fed-list-pics").first() + val picElement = document.select("a.fed-list-pics").first()!! val picUrl = picElement.attr("data-original") val detailElements = document.select("dd.fed-deta-content ul.fed-part-rows") return SManga.create().apply { - title = document.select("h1.fed-part-eone").first().text().trim() + title = document.select("h1.fed-part-eone").first()!!.text().trim() if (!invalidCoverImageDomains.any { picUrl.contains(it) }) { thumbnail_url = picUrl @@ -164,7 +164,7 @@ class Baimangu : ConfigurableSource, ParsedHttpSource() { author = detailElements.select("li:nth-child(1) a").firstOrNull()?.text()?.trim() - genre = detailElements.select("li.fed-show-md-block:nth-last-child(2) a:not(:empty)")?.joinToString { it.text().trim() } + genre = detailElements.select("li.fed-show-md-block:nth-last-child(2) a:not(:empty)").joinToString { it.text().trim() } // It has both "简介:" and "简介" in the description description = detailElements.select("li.fed-show-md-block:nth-last-child(1)") diff --git a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt index a5a2492a3..d3325fa4a 100644 --- a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt +++ b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt @@ -66,7 +66,7 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { document.select(Evaluator.Class("comics-chapters")) } else { // chapters are listed oldest to newest in the source - fullListTitle.parent().select(Evaluator.Class("comics-chapters")).reversed() + fullListTitle.parent()!!.select(Evaluator.Class("comics-chapters")).reversed() }.map { chapterFromElement(it) }.apply { val chapterOrderPref = preferences.getString(CHAPTER_ORDER_PREF, CHAPTER_ORDER_DISABLED) if (chapterOrderPref != CHAPTER_ORDER_DISABLED) { @@ -97,9 +97,9 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { override fun popularMangaFromElement(element: Element): SManga { return SManga.create().apply { - setUrlWithoutDomain(element.attr("href")!!.trim()) - title = element.attr("title")!!.trim() - thumbnail_url = element.select("> amp-img").attr("src")!!.trim() + setUrlWithoutDomain(element.attr("href").trim()) + title = element.attr("title").trim() + thumbnail_url = element.select("> amp-img").attr("src").trim() } } @@ -128,7 +128,7 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { thumbnail_url = document.select("div.pure-g div > amp-img").attr("src").trim() author = document.select("h2.comics-detail__author").text() description = document.select("p.comics-detail__desc").text() - status = when (document.selectFirst("div.tag-list > span.tag").text()) { + status = when (document.selectFirst("div.tag-list > span.tag")!!.text()) { "连载中", "連載中" -> SManga.ONGOING "已完结", "已完結" -> SManga.COMPLETED else -> SManga.UNKNOWN @@ -144,7 +144,7 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { while (true) { val document = client.newCall(GET(url, headers)).execute().asJsoup() document.select(".comic-contain amp-img").dropWhile { element -> - element.selectFirst(pageNumberSelector).text().substringBefore('/').toInt() <= i + element.selectFirst(pageNumberSelector)!!.text().substringBefore('/').toInt() <= i }.mapTo(pageList) { element -> Page(i++, imageUrl = element.attr("src")) } diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt index 525d39acd..11d42ec26 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt +++ b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt @@ -64,10 +64,10 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { val document = response.asJsoup().also(::parseGenres) val mangas = document.select("article.wp-manga").map { element -> SManga.create().apply { - val link = element.selectFirst(Evaluator.Tag("h2")).child(0) + val link = element.selectFirst(Evaluator.Tag("h2"))!!.child(0) url = getKey(link.attr("href")) title = link.ownText() - thumbnail_url = element.selectFirst(Evaluator.Tag("img")).imgSrc + thumbnail_url = element.selectFirst(Evaluator.Tag("img"))!!.imgSrc } } val hasNextPage = document.selectFirst(Evaluator.Class("next"))?.tagName() == "a" || @@ -101,12 +101,12 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { override fun mangaDetailsParse(response: Response) = SManga.create().apply { val document = response.asJsoup() - title = document.selectFirst(Evaluator.Tag("h1")).ownText() - author = document.selectFirst(Evaluator.Class("author-content")).children().joinToString { it.ownText() } - description = document.selectFirst(".descrip_manga_info, .wp-block-stackable-text").text() - thumbnail_url = document.selectFirst("img.wp-post-image").imgSrc + title = document.selectFirst(Evaluator.Tag("h1"))!!.ownText() + author = document.selectFirst(Evaluator.Class("author-content"))!!.children().joinToString { it.ownText() } + description = document.selectFirst(".descrip_manga_info, .wp-block-stackable-text")!!.text() + thumbnail_url = document.selectFirst("img.wp-post-image")!!.imgSrc - val genreList = document.selectFirst(Evaluator.Class("genres-content")) + val genreList = document.selectFirst(Evaluator.Class("genres-content"))!! .children().eachText().toMutableSet() if ("连载中" in genreList) { genreList.remove("连载中") @@ -126,7 +126,7 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { override fun chapterListParse(response: Response): List { val document = response.asJsoup() - return document.selectFirst(Evaluator.Class("version-chaps")).children().map { + return document.selectFirst(Evaluator.Class("version-chaps"))!!.children().map { SChapter.create().apply { url = getKey(it.attr("href")) name = it.ownText() @@ -152,7 +152,7 @@ class BaozimhOrg : HttpSource(), ConfigurableSource { override fun imageUrlParse(response: Response) = throw UnsupportedOperationException() - var genres: Array> = emptyArray() + private var genres: Array> = emptyArray() private fun parseGenres(document: Document) { if (!enableGenres || genres.isNotEmpty()) return diff --git a/src/zh/boylove/src/eu/kanade/tachiyomi/extension/zh/boylove/BoyLove.kt b/src/zh/boylove/src/eu/kanade/tachiyomi/extension/zh/boylove/BoyLove.kt index 85e630362..bbe746995 100644 --- a/src/zh/boylove/src/eu/kanade/tachiyomi/extension/zh/boylove/BoyLove.kt +++ b/src/zh/boylove/src/eu/kanade/tachiyomi/extension/zh/boylove/BoyLove.kt @@ -111,7 +111,7 @@ class BoyLove : HttpSource(), ConfigurableSource { private fun fetchPageList(chapterUrl: String): Observable> = client.newCall(GET(baseUrl + chapterUrl, headers)).asObservableSuccess().map { response -> - val root = response.asJsoup().selectFirst(Evaluator.Tag("section")) + val root = response.asJsoup().selectFirst(Evaluator.Tag("section"))!! val images = root.select(Evaluator.Class("reader-cartoon-image")) val urlList = if (images.isEmpty()) { root.select(Evaluator.Tag("img")).map { it.attr("src").trim().toImageUrl() } diff --git a/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt b/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt index 386c06beb..02e2c23be 100644 --- a/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt +++ b/src/zh/comicabc/src/eu/kanade/tachiyomi/extension/zh/comicabc/Comicabc.kt @@ -22,12 +22,12 @@ class Comicabc : ParsedHttpSource() { // Popular override fun popularMangaRequest(page: Int) = GET("$baseUrl/comic/h-$page.html", headers) - override fun popularMangaNextPageSelector(): String? = "div.pager a span.mdi-skip-next" + override fun popularMangaNextPageSelector(): String = "div.pager a span.mdi-skip-next" override fun popularMangaSelector(): String = "div.default_row_width > div.col-2" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("li.cat2_list_name").text() - setUrlWithoutDomain(element.selectFirst("a").attr("abs:href")) - thumbnail_url = element.selectFirst("img").attr("abs:src") + title = element.selectFirst("li.cat2_list_name")!!.text() + setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href")) + thumbnail_url = element.selectFirst("img")!!.attr("abs:src") } // Latest @@ -43,21 +43,21 @@ class Comicabc : ParsedHttpSource() { return GET("$baseUrl/member/search.aspx?key=$query&page=$page", headers) } - override fun searchMangaNextPageSelector(): String? = popularMangaNextPageSelector() + override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector() override fun searchMangaSelector(): String = popularMangaSelector() override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("div.item-top-content h3.item_name").text() - thumbnail_url = document.selectFirst("div.item-topbar img.item_cover").attr("abs:src") - author = document.selectFirst("div.item-top-content > li:nth-of-type(3)").ownText() + title = document.selectFirst("div.item-top-content h3.item_name")!!.text() + thumbnail_url = document.selectFirst("div.item-topbar img.item_cover")!!.attr("abs:src") + author = document.selectFirst("div.item-top-content > li:nth-of-type(3)")!!.ownText() artist = author - description = document.selectFirst("div.item-top-content > li.item_info_detail").text() + description = document.selectFirst("div.item-top-content > li.item_info_detail")!!.text() status = when { - document.selectFirst("div.item_comic_eps_div").text().contains("連載中") -> SManga.ONGOING - document.selectFirst("div.item_comic_eps_div").text().contains("已完結") -> SManga.COMPLETED + document.selectFirst("div.item_comic_eps_div")!!.text().contains("連載中") -> SManga.ONGOING + document.selectFirst("div.item_comic_eps_div")!!.text().contains("已完結") -> SManga.COMPLETED else -> SManga.UNKNOWN } } @@ -81,7 +81,7 @@ class Comicabc : ParsedHttpSource() { override fun pageListParse(response: Response): List = mutableListOf().apply { val document = response.asJsoup() val url = response.request.url.toString() - val script = document.selectFirst("script:containsData(function request)").data() + val script = document.selectFirst("script:containsData(function request)")!!.data() .replace("function ge(e){return document.getElementById(e);}", "") .replace("ge\\(.*\\).src".toRegex(), "imageUrl") .replace("spp()", "") diff --git a/src/zh/happymh/src/eu/kanade/tachiyomi/extension/zh/happymh/Happymh.kt b/src/zh/happymh/src/eu/kanade/tachiyomi/extension/zh/happymh/Happymh.kt index 7b4cd5c87..c7608e0a2 100644 --- a/src/zh/happymh/src/eu/kanade/tachiyomi/extension/zh/happymh/Happymh.kt +++ b/src/zh/happymh/src/eu/kanade/tachiyomi/extension/zh/happymh/Happymh.kt @@ -77,12 +77,12 @@ class Happymh : HttpSource() { override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply { val document = response.asJsoup() - title = document.selectFirst("div.mg-property > h2.mg-title").text() - thumbnail_url = document.selectFirst("div.mg-cover > mip-img").attr("abs:src") - author = document.selectFirst("div.mg-property > p.mg-sub-title:nth-of-type(2)").text() + title = document.selectFirst("div.mg-property > h2.mg-title")!!.text() + thumbnail_url = document.selectFirst("div.mg-cover > mip-img")!!.attr("abs:src") + author = document.selectFirst("div.mg-property > p.mg-sub-title:nth-of-type(2)")!!.text() artist = author genre = document.select("div.mg-property > p.mg-cate > a").eachText().joinToString(", ") - description = document.selectFirst("div.manga-introduction > mip-showmore#showmore").text() + description = document.selectFirst("div.manga-introduction > mip-showmore#showmore")!!.text() } // Chapters @@ -90,7 +90,7 @@ class Happymh : HttpSource() { override fun chapterListParse(response: Response): List { val comicId = response.request.url.pathSegments.last() val document = response.asJsoup() - val script = document.selectFirst("mip-data > script:containsData(chapterList)").html() + val script = document.selectFirst("mip-data > script:containsData(chapterList)")!!.html() return json.parseToJsonElement(script).jsonObject["chapterList"]!!.jsonArray.map { SChapter.create().apply { val chapterId = it.jsonObject["id"]!!.jsonPrimitive.content diff --git a/src/zh/iqiyi/src/eu/kanade/tachiyomi/extension/zh/iqiyi/Iqiyi.kt b/src/zh/iqiyi/src/eu/kanade/tachiyomi/extension/zh/iqiyi/Iqiyi.kt index efb043582..80731361a 100644 --- a/src/zh/iqiyi/src/eu/kanade/tachiyomi/extension/zh/iqiyi/Iqiyi.kt +++ b/src/zh/iqiyi/src/eu/kanade/tachiyomi/extension/zh/iqiyi/Iqiyi.kt @@ -28,18 +28,18 @@ class Iqiyi : ParsedHttpSource() { // Popular override fun popularMangaRequest(page: Int) = GET("$baseUrl/category/全部_0_9_$page/", headers) - override fun popularMangaNextPageSelector(): String? = "div.mod-page > a.a1:contains(下一页)" + override fun popularMangaNextPageSelector(): String = "div.mod-page > a.a1:contains(下一页)" override fun popularMangaSelector(): String = "ul.cartoon-hot-ul > li.cartoon-hot-list" override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("a.cartoon-item-tit").text() - url = element.selectFirst("a.cartoon-item-tit").attr("href").drop(7) - thumbnail_url = element.selectFirst("img").attr("src") + title = element.selectFirst("a.cartoon-item-tit")!!.text() + url = element.selectFirst("a.cartoon-item-tit")!!.attr("href").drop(7) + thumbnail_url = element.selectFirst("img")!!.attr("src") } // Latest override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/category/全部_0_4_$page/", headers) - override fun latestUpdatesNextPageSelector(): String? = popularMangaNextPageSelector() + override fun latestUpdatesNextPageSelector(): String = popularMangaNextPageSelector() override fun latestUpdatesSelector() = popularMangaSelector() override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element) @@ -49,24 +49,24 @@ class Iqiyi : ParsedHttpSource() { return GET("$baseUrl/search-keyword=${query}_$page", headers) } - override fun searchMangaNextPageSelector(): String? = popularMangaNextPageSelector() + override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector() override fun searchMangaSelector(): String = "ul.stacksList > li.stacksBook" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("h3.stacksBook-tit > a").text() - url = element.selectFirst("h3.stacksBook-tit > a").attr("href").drop(7) - thumbnail_url = element.selectFirst("img").attr("src") + title = element.selectFirst("h3.stacksBook-tit > a")!!.text() + url = element.selectFirst("h3.stacksBook-tit > a")!!.attr("href").drop(7) + thumbnail_url = element.selectFirst("img")!!.attr("src") } // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("div.detail-tit > h1").text() - thumbnail_url = document.selectFirst("div.detail-cover > img").attr("src") - author = document.selectFirst("p.author > span.author-name").text() + title = document.selectFirst("div.detail-tit > h1")!!.text() + thumbnail_url = document.selectFirst("div.detail-cover > img")!!.attr("src") + author = document.selectFirst("p.author > span.author-name")!!.text() artist = author genre = document.select("div.detail-tit > a.detail-categ").eachText().joinToString(", ") - description = document.selectFirst("p.detail-docu").text() - status = when (document.selectFirst("span.cata-info").text()) { + description = document.selectFirst("p.detail-docu")!!.text() + status = when (document.selectFirst("span.cata-info")!!.text()) { "连载中" -> SManga.ONGOING "完结" -> SManga.COMPLETED else -> SManga.UNKNOWN diff --git a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt index c5022ef82..f0567b25f 100644 --- a/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt +++ b/src/zh/jinmantiantang/src/eu/kanade/tachiyomi/extension/zh/jinmantiantang/Jinmantiantang.kt @@ -75,8 +75,8 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { val children = element.children() if (children[0].tagName() == "a") children.removeFirst() title = children[1].text() - setUrlWithoutDomain(children[0].selectFirst("a").attr("href")) - val img = children[0].selectFirst("img") + setUrlWithoutDomain(children[0].selectFirst("a")!!.attr("href")) + val img = children[0].selectFirst("img")!! thumbnail_url = img.attr("data-original").ifEmpty { img.attr("src") }.substringBeforeLast('?') author = children[2].select("a").joinToString(", ") { it.text() } genre = children[3].select("a").joinToString(", ") { it.text() } @@ -161,16 +161,16 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { // 漫画详情 override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("h1").text() + title = document.selectFirst("h1")!!.text() // keep thumbnail_url same as the one in popularMangaFromElement() - thumbnail_url = document.selectFirst(".thumb-overlay > img").attr("src").substringBeforeLast('.') + "_3x4.jpg" + thumbnail_url = document.selectFirst(".thumb-overlay > img")!!.attr("src").substringBeforeLast('.') + "_3x4.jpg" author = selectAuthor(document) genre = selectDetailsStatusAndGenre(document, 0).trim().split(" ").joinToString(", ") // When the index passed by the "selectDetailsStatusAndGenre(document: Document, index: Int)" index is 1, // it will definitely return a String type of 0, 1 or 2. This warning can be ignored status = selectDetailsStatusAndGenre(document, 1).trim().toInt() - description = document.selectFirst("#intro-block .p-t-5.p-b-5").text().substringAfter("敘述:").trim() + description = document.selectFirst("#intro-block .p-t-5.p-b-5")!!.text().substringAfter("敘述:").trim() } // 查询作者信息 @@ -190,7 +190,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { genre } } - val elements: Elements = document.select("span[itemprop=genre]").first().select("a") + val elements: Elements = document.select("span[itemprop=genre]").first()!!.select("a") for (value in elements) { when (val vote: String = value.select("a").text()) { "連載中" -> { @@ -218,7 +218,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { url = element.select("a").attr("href") - name = element.select("a li").first().ownText() + name = element.select("a li").first()!!.ownText() date_upload = sdf.parse(element.select("a li span.hidden-xs").text().trim())?.time ?: 0 } @@ -228,7 +228,7 @@ class Jinmantiantang : ParsedHttpSource(), ConfigurableSource { val singleChapter = SChapter.create().apply { name = "单章节" url = document.select("a[class=col btn btn-primary dropdown-toggle reading]").attr("href") - date_upload = sdf.parse(document.select("[itemprop=datePublished]").last().attr("content"))?.time + date_upload = sdf.parse(document.select("[itemprop=datePublished]").last()!!.attr("content"))?.time ?: 0 } return listOf(singleChapter) diff --git a/src/zh/kuaikanmanhua/src/eu/kanade/tachiyomi/extension/zh/kuaikanmanhua/Kuaikanmanhua.kt b/src/zh/kuaikanmanhua/src/eu/kanade/tachiyomi/extension/zh/kuaikanmanhua/Kuaikanmanhua.kt index 6610c6576..0b7ecd599 100644 --- a/src/zh/kuaikanmanhua/src/eu/kanade/tachiyomi/extension/zh/kuaikanmanhua/Kuaikanmanhua.kt +++ b/src/zh/kuaikanmanhua/src/eu/kanade/tachiyomi/extension/zh/kuaikanmanhua/Kuaikanmanhua.kt @@ -23,8 +23,6 @@ import okhttp3.Request import okhttp3.Response import rx.Observable import uy.kohesive.injekt.injectLazy -import java.text.SimpleDateFormat -import java.util.Locale class Kuaikanmanhua : HttpSource() { @@ -85,12 +83,12 @@ class Kuaikanmanhua : HttpSource() { override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { if (query.startsWith(TOPIC_ID_SEARCH_PREFIX)) { - val new_query = query.removePrefix(TOPIC_ID_SEARCH_PREFIX) - return client.newCall(GET("$apiUrl/v1/topics/$new_query")) + val newQuery = query.removePrefix(TOPIC_ID_SEARCH_PREFIX) + return client.newCall(GET("$apiUrl/v1/topics/$newQuery")) .asObservableSuccess() .map { response -> val details = mangaDetailsParse(response) - details.url = "/web/topic/$new_query" + details.url = "/web/topic/$newQuery" MangasPage(listOf(details), false) } } @@ -196,7 +194,7 @@ class Kuaikanmanhua : HttpSource() { return GET(baseUrl + chapter.url) } - val fixJson: (MatchResult) -> CharSequence = { + private val fixJson: (MatchResult) -> CharSequence = { match: MatchResult -> val str = match.value val out = str[0] + "\"" + str.subSequence(1, str.length - 1) + "\"" + str[str.length - 1] @@ -205,7 +203,7 @@ class Kuaikanmanhua : HttpSource() { override fun pageListParse(response: Response): List { val document = response.asJsoup() - val script = document.selectFirst("script:containsData(comicImages)").data() + val script = document.selectFirst("script:containsData(comicImages)")!!.data() val images = script.substringAfter("comicImages:") .substringBefore(",is_vip_exclusive") .replace("""(:([^\[\{\"]+?)[\},])""".toRegex(), fixJson) @@ -283,9 +281,5 @@ class Kuaikanmanhua : HttpSource() { companion object { const val TOPIC_ID_SEARCH_PREFIX = "topic:" - - private val DATE_FORMAT by lazy { - SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) - } } } diff --git a/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt b/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt index 1872fa0d1..2432b822e 100644 --- a/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt +++ b/src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt @@ -133,10 +133,10 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { if (params != "") { url += "/$params" } - if (sortOrder == "") { - url += "/index_p$page.html" + url += if (sortOrder == "") { + "/index_p$page.html" } else { - url += "/${sortOrder}_p$page.html" + "/${sortOrder}_p$page.html" } return GET(url, headers) } @@ -257,12 +257,12 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { override fun latestUpdatesFromElement(element: Element) = mangaFromElement(element) private fun mangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("a.bcover").first().let { + element.select("a.bcover").first()!!.let { manga.url = it.attr("href") manga.title = it.attr("title").trim() // Fix thumbnail lazy load - val thumbnailElement = it.select("img").first() + val thumbnailElement = it.select("img").first()!! manga.thumbnail_url = if (thumbnailElement.hasAttr("src")) { thumbnailElement.attr("abs:src") } else { @@ -275,10 +275,10 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga { val manga = SManga.create() - element.select("div.book-detail").first().let { - manga.url = it.select("dl > dt > a").first().attr("href") - manga.title = it.select("dl > dt > a").first().attr("title").trim() - manga.thumbnail_url = element.select("div.book-cover > a.bcover > img").first().attr("abs:src") + element.select("div.book-detail").first()!!.let { + manga.url = it.select("dl > dt > a").first()!!.attr("href") + manga.title = it.select("dl > dt > a").first()!!.attr("title").trim() + manga.thumbnail_url = element.select("div.book-cover > a.bcover > img").first()!!.attr("abs:src") } return manga @@ -303,9 +303,9 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { val hiddenChapterList = Jsoup.parse(decodedHiddenChapterList, response.request.url.toString()) if (hiddenChapterList != null) { // Replace R18 warning with actual chapter list - document.select("#erroraudit_show").first().replaceWith(hiddenChapterList) + document.select("#erroraudit_show").first()!!.replaceWith(hiddenChapterList) // Remove hidden chapter list element - document.select("#__VIEWSTATE").first().remove() + document.select("#__VIEWSTATE").first()!!.remove() } } else { // "You need to enable R18 switch and restart Tachiyomi to read this manga" @@ -318,12 +318,12 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { chapterList.forEach { val currentChapter = SChapter.create() currentChapter.url = it.attr("href") - currentChapter.name = it?.attr("title")?.trim() ?: it.select("span").first().ownText() + currentChapter.name = it?.attr("title")?.trim() ?: it.select("span").first()!!.ownText() currentChapter.chapter_number = chNumRegex.find(currentChapter.name)?.value?.toFloatOrNull() ?: -1F // Manhuagui only provide upload date for latest chapter if (currentChapter.url == latestChapterHref) { - currentChapter.date_upload = parseDate(document.select("div.book-detail > ul.detail-list > li.status > span > span.red").last()) + currentChapter.date_upload = parseDate(document.select("div.book-detail > ul.detail-list > li.status > span > span.red").last()!!) } chapters.add(currentChapter) } @@ -349,7 +349,7 @@ class Manhuagui : ConfigurableSource, ParsedHttpSource() { manga.thumbnail_url = document.select("p.hcover > img").attr("abs:src") manga.author = document.select("span:contains(漫画作者) > a , span:contains(漫畫作者) > a").text().trim().replace(" ", ", ") manga.genre = document.select("span:contains(漫画剧情) > a , span:contains(漫畫劇情) > a").text().trim().replace(" ", ", ") - manga.status = when (document.select("div.book-detail > ul.detail-list > li.status > span > span").first().text()) { + manga.status = when (document.select("div.book-detail > ul.detail-list > li.status > span > span").first()!!.text()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED "連載中" -> SManga.ONGOING diff --git a/src/zh/manwa/src/eu/kanade/tachiyomi/extension/zh/manwa/Manwa.kt b/src/zh/manwa/src/eu/kanade/tachiyomi/extension/zh/manwa/Manwa.kt index 6a81d5350..5ed681d56 100644 --- a/src/zh/manwa/src/eu/kanade/tachiyomi/extension/zh/manwa/Manwa.kt +++ b/src/zh/manwa/src/eu/kanade/tachiyomi/extension/zh/manwa/Manwa.kt @@ -83,7 +83,7 @@ class Manwa : ParsedHttpSource(), ConfigurableSource { // Get image host val resp = client.newCall(GET("$baseUrl/update?img_host=${preferences.getString(IMAGE_HOST_KEY, IMAGE_HOST_ENTRY_VALUES[0])}")).execute() val document = resp.asJsoup() - val imgHost = document.selectFirst(".manga-list-2-cover-img").attr(":src").drop(1).substringBefore("'") + val imgHost = document.selectFirst(".manga-list-2-cover-img")!!.attr(":src").drop(1).substringBefore("'") val jsonObject = json.parseToJsonElement(response.body.string()).jsonObject val mangas = jsonObject["books"]!!.jsonArray.map { @@ -115,20 +115,20 @@ class Manwa : ParsedHttpSource(), ConfigurableSource { override fun searchMangaNextPageSelector(): String? = null override fun searchMangaSelector(): String = "ul.book-list > li" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { - title = element.selectFirst("p.book-list-info-title").text() - setUrlWithoutDomain(element.selectFirst("a").attr("abs:href")) - thumbnail_url = element.selectFirst("img").attr("data-original") + title = element.selectFirst("p.book-list-info-title")!!.text() + setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href")) + thumbnail_url = element.selectFirst("img")!!.attr("data-original") } // Details override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { - title = document.selectFirst("p.detail-main-info-title").text() - thumbnail_url = document.selectFirst("div.detail-main-cover > img").attr("data-original") + title = document.selectFirst("p.detail-main-info-title")!!.text() + thumbnail_url = document.selectFirst("div.detail-main-cover > img")!!.attr("data-original") author = document.select("p.detail-main-info-author > span.detail-main-info-value > a").text() artist = author genre = document.select("div.detail-main-info-class > a.info-tag").eachText().joinToString(", ") - description = document.selectFirst("#detail > p.detail-desc").text() + description = document.selectFirst("#detail > p.detail-desc")!!.text() } // Chapters diff --git a/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt b/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt index 31393e5f6..a2369a2df 100644 --- a/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt +++ b/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt @@ -67,12 +67,12 @@ class SixMH : HttpSource(), ConfigurableSource { override fun popularMangaParse(response: Response): MangasPage { val document = response.asJsoup() val imgSelector = Evaluator.Tag("img") - val items = document.selectFirst(Evaluator.Class("cy_list_mh")).children().map { + val items = document.selectFirst(Evaluator.Class("cy_list_mh"))!!.children().map { SManga.create().apply { val link = it.child(1).child(0) url = link.attr("href") title = link.ownText() - thumbnail_url = it.selectFirst(imgSelector).attr("src") + thumbnail_url = it.selectFirst(imgSelector)!!.attr("src") } } val hasNextPage = document.selectFirst(Evaluator.Class("thisclass"))?.nextElementSibling() != null @@ -108,7 +108,7 @@ class SixMH : HttpSource(), ConfigurableSource { override fun mangaDetailsParse(response: Response): SManga { val document = response.asJsoup() val result = SManga.create().apply { - val box = document.selectFirst(Evaluator.Class("cy_info")) + val box = document.selectFirst(Evaluator.Class("cy_info"))!! val details = box.getElementsByTag("span") author = details[0].text().removePrefix("作者:") status = when (details[1].text().removePrefix("状态:").trimStart()) { @@ -121,8 +121,8 @@ class SixMH : HttpSource(), ConfigurableSource { details[3].ownText().removePrefix("标签:").split(Regex("[ -~]+")) .filterTo(this) { it.isNotEmpty() } }.joinToString() - description = box.selectFirst(Evaluator.Tag("p")).ownText() - thumbnail_url = box.selectFirst(Evaluator.Tag("img")).run { + description = box.selectFirst(Evaluator.Tag("p"))!!.ownText() + thumbnail_url = box.selectFirst(Evaluator.Tag("img"))!!.run { attr("data-src").ifEmpty { attr("src") } } } @@ -134,7 +134,7 @@ class SixMH : HttpSource(), ConfigurableSource { override fun chapterListParse(response: Response): List { val document = response.asJsoup() - val list = document.selectFirst(Evaluator.Class("cy_plist")) + val list = document.selectFirst(Evaluator.Class("cy_plist"))!! .child(0).children().map { val element = it.child(0) SChapter.create().apply { diff --git a/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/wnacg.kt b/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/wnacg.kt index c09cc5946..52f952853 100644 --- a/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/wnacg.kt +++ b/src/zh/wnacg/src/eu/kanade/tachiyomi/extension/zh/wnacg/wnacg.kt @@ -63,11 +63,11 @@ class wnacg : ParsedHttpSource() { override fun searchMangaFromElement(element: Element) = mangaFromElement(element) private fun mangaFromElement(element: Element): SManga { - val link = element.selectFirst(".title > a") + val link = element.selectFirst(".title > a")!! val manga = SManga.create() manga.url = link.attr("href") manga.title = link.text() - manga.thumbnail_url = element.selectFirst("img").absUrl("src") + manga.thumbnail_url = element.selectFirst("img")!!.absUrl("src") .replaceBefore(':', "http") // maybe the local cache cause the old source (url) can not be update. but the image can be update on detailpage. // ps. new machine can be load img normal. @@ -89,7 +89,7 @@ class wnacg : ParsedHttpSource() { manga.artist = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown" manga.author = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown" manga.thumbnail_url = - "http:" + document.selectFirst("div.uwthumb img").attr("src") + "http:" + document.selectFirst("div.uwthumb img")!!.attr("src") manga.description = document.selectFirst("div.asTBcell p")?.html()?.replace("
    ", "\n") diff --git a/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/Zerobyw.kt b/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/Zerobyw.kt index f175e33a0..cecb8b854 100644 --- a/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/Zerobyw.kt +++ b/src/zh/zerobyw/src/eu/kanade/tachiyomi/extension/zh/zerobyw/Zerobyw.kt @@ -78,7 +78,7 @@ class Zerobyw : ParsedHttpSource(), ConfigurableSource { return GET(uri.toString(), headers) } - override fun searchMangaNextPageSelector(): String? = "div.pg > a.nxt" + override fun searchMangaNextPageSelector(): String = "div.pg > a.nxt" override fun searchMangaSelector(): String = "a.uk-card, div.uk-card" override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { title = getTitle(element.select("p.mt5").text()) @@ -91,11 +91,11 @@ class Zerobyw : ParsedHttpSource(), ConfigurableSource { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { title = getTitle(document.select("li.uk-active > h3.uk-heading-line").text()) thumbnail_url = document.select("div.uk-width-medium > img").attr("abs:src") - author = document.selectFirst("div.cl > a.uk-label").text().substring(3) + author = document.selectFirst("div.cl > a.uk-label")!!.text().substring(3) artist = author genre = document.select("div.cl > a.uk-label, div.cl > span.uk-label").eachText().joinToString(", ") description = document.select("li > div.uk-alert").html().replace("
    ", "") - status = when (document.select("div.cl > span.uk-label").last().text()) { + status = when (document.select("div.cl > span.uk-label").last()!!.text()) { "连载中" -> SManga.ONGOING "已完结" -> SManga.COMPLETED else -> SManga.UNKNOWN