From 57b24e9c5a6fc992b958f424238716c8d666815e Mon Sep 17 00:00:00 2001 From: red Date: Sun, 23 Sep 2018 22:40:16 +0300 Subject: [PATCH] Added yaoilib (#513) Added yaoilib source --- src/ru/yaoilib/build.gradle | 13 + .../yaoilib/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 1370 bytes .../yaoilib/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 970 bytes .../yaoilib/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 1859 bytes .../yaoilib/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 3007 bytes .../res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 4179 bytes .../tachiyomi/extension/ru/yaoilib/Yaoilib.kt | 241 ++++++++++++++++++ 7 files changed, 254 insertions(+) create mode 100644 src/ru/yaoilib/build.gradle create mode 100644 src/ru/yaoilib/res/mipmap-hdpi/ic_launcher.png create mode 100644 src/ru/yaoilib/res/mipmap-mdpi/ic_launcher.png create mode 100644 src/ru/yaoilib/res/mipmap-xhdpi/ic_launcher.png create mode 100644 src/ru/yaoilib/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 src/ru/yaoilib/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 src/ru/yaoilib/src/eu/kanade/tachiyomi/extension/ru/yaoilib/Yaoilib.kt diff --git a/src/ru/yaoilib/build.gradle b/src/ru/yaoilib/build.gradle new file mode 100644 index 000000000..fa7844172 --- /dev/null +++ b/src/ru/yaoilib/build.gradle @@ -0,0 +1,13 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + appName = 'Tachiyomi: Yaoilib' + pkgNameSuffix = 'ru.yaoilib' + extClass = '.Yaoilib' + extVersionCode = 1 + extVersionSuffix = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/ru/yaoilib/res/mipmap-hdpi/ic_launcher.png b/src/ru/yaoilib/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..15c0ba903f5623661cae405b3e2232a12c864d50 GIT binary patch literal 1370 zcmV-g1*Q6lP)tO7bK zjEQ!E4Nw9rY_hJ5FpHLL?QOdbI@)!#-B#LetF>#_wY4PzZKVQEBb zGhR$gJZbf$$oPzfLjst)Azc@(#(-wT#+)pm+z22N;b3XQfV5ie%Gj7w0VE(95RR)$ zvOa`;8@bpC z=A!Q&Y(VZaN|>0KNK5ve^;3NLdaNn?aQ@QvU;{F~u_x3+E_A^7h&ORS!63LA+M&Pn z2$+`d1KpxhPH*gevl49Ob>O!;%r6B!wabYr(U8klDD`xIGa!&KM9VdBvk!7PKxgqv=DFodAuxTqGuQqG)_=H+$ydBwDd7VLSaZo1;T?_`Hhjne?5XS~!4$ z{s7#_|1xeH$M?;l&w0nd@Zx7=1JW(n$UCR;Ts44ZHut-_U-%S)K7VLhQ2Bdyti{Z$ z#7Up_@e(7Ns~-6z{01)QUxe`@mVgx6-lz<3DWrkdK(Al}IR{=ny-2 zk!SH*Ljg^$+7%o?*77<$n6&IY(yu!DR+ zky=kW3OGi{2V~tQ1+Ur+o;E#OVjZfIvHOSm)*b@WJA2uk9+ve#uvcU8B_F&;2=5>A zThR1{CXz#9K12 ziHblfm6qXHRVtM*)th=}VlYbNL>+d>5F%|j|1=9%;G24%#IdIQpn>}O`kB~KhiEm( zg)8At(JJUfT~Zw$yO}C>SfL-iNw^&T7QKf7&9A7a$jwQ|3JVKoqr+mPWmQ#G+hsDD zRH0CuZfR+0Xl-ph6)U-1KIQe@@00z^{qPw+HsJpq$ADwOG2z$>3JT^-=iv*2{QUg6 z=(q^!d88#sOEX+c!m%vO%gdXGW1RLgE)XOk>P_>}@loV-K_&~w5ROHdb017Vh^SGc cMlB=kKkhPDzaL>q4gdfE07*qoM6N<$f=acLA^-pY literal 0 HcmV?d00001 diff --git a/src/ru/yaoilib/res/mipmap-mdpi/ic_launcher.png b/src/ru/yaoilib/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..2b5d3ce50122faeab390a70220988a29818addec GIT binary patch literal 970 zcmV;*12z1KP)@`m>+(X@b{Nc`x9r$uD_nyP~e$G9=bI-lMkdR;@ zxBx&XQdoc$x)S4Su?QN-rTg)$h|Z&t;*eqkB;0rOLf-tEmr^Xik`N^9XHf`G0Nkj9 zN+m|E)CCN%#wWmRu$WAyEu@*peneCX)Ya8(_w+g!APgU6GT9yy0b0-#;BYwmJ-sdn zz~k}uk_y0Pvkx#DproYaU=ZNH02q0|21}y?OtliwR|sI@(;v`t1YmCHhAG7eSjY7A zQE?=jt}ok}1;$@uur&98;hPY&MYS+qP=nglfuX7uECMBHURAFiz}Vvo)M*bmrmf&~ zI_JswQw*9HKcIWxy%~VmOuCJ+x@}(F=>ZLB3u|HUQo-s^q3-y*Fx5NeWoY6v&u^R2 zoHAG4zb(Dcxg#U6F`zj15FA#U+f-{GbcFkE-*@`S%*YRFKo)bGj38E{>Eihm23c=> z);06Gz-hOG^28%@Rw3!8beQf}yXW=LI7l~Nn?L%AdGvkF>uU0r(f%{fyq<#kd8Kz9 zG_5S6Ua*epK)UrhnePGJ*9I2=jtj-nY}dVkgUM)sR{=;~XqsWhDR9#k2{^m+f;do4-T8%>q+1sXVhj+`+@7VtgdwQ0|qdB=cD`WEFNIqc6#WFJDBmdfq4LE zcR34S(-@cspt@1$UWxP;<^kZ39@i>lcYtKWWrnRn#kF3`sPcFYa{y#k_~{TjlQfAY&!FTpPKkO{wD5Ad`c#OzM>hXN|RJw1`dVg*FF?^CE?FN==;T!^HkBnq8IA#Dt> sqOg}0CEjtch(w}wft1gH4HiPmKZ7YiZ;A&cRsaA107*qoM6N<$g1Q9HWB>pF literal 0 HcmV?d00001 diff --git a/src/ru/yaoilib/res/mipmap-xhdpi/ic_launcher.png b/src/ru/yaoilib/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..046a4aef6280766cf92d1d2b6977205c3911db51 GIT binary patch literal 1859 zcmV-J2fX-+P)kRjO`j3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w9{Z|Q*KDFQ5GcjGfHI;-|IPaItdG_D!m(@{iVicem-hQIa+R-2Bn z7O#|I0M)Y00uy`ZVXSHdPRIb0NrHNITiI$?J9HhB8Ki_qv0-%q_%QhM^ELuEBeJRZXhFhNddd6vC;%Mj`Rj7o zkp%jH)ZNGg0Z<0;1-?7ScL;375daI;M!3p}Wr)o32aXlEI@|y7Q3pV9d4EoxxXWa! zkfZ4FSy5}ds_{~(!#8!^j};D7`{{O* zc)Kp5*Dx}w0I7Jt>1tPkaAnY+QjKzBrBbK5@;B%)g>7w~`(3m^QT<}S+cEo-`t3=d zg@=XS$9&ZKmcG3R_t-suW_16d1Q7ZotLAXg(k=EfhB*Xdun>3GENdhRK&=^@98Ytp zZNr8713Nr)RA_H->>IW6_3i_u-F$GxJPGKD2j=L?Ry1=b_Xwy<7g|Y863TAL2my0ff?Tk3YDwW8Q|d z9&kLCq?&ST;-H0*=1YNk(cb3!W)2n&1AvOa38noSUmq5K>iP2;r}4< zOmb3l@4#G~oMI=jEntW0ffS*$9y@aM5ZWr47-CC*<{WYf*s>xi|~*mzF+(LHhz#yoG-tVXW#2Yq<^_(2J5mMFXw zP2DEt`R_{=po?a1r@uECW$lU)D zH%e;`tVNfjAeJin( zCySbAF(B#CSVR8ejdrW*;!ai^xn_+kclJ= zBxaMHZbq|JBfDLAu;_`4kZq`)Y?CqpbMEpjtJF%DRn$dIuefW+c=tXp(WI=iZ5C)n)Ea@>zbiAdQ?#x52*J>_#H9=S^xF-CG;`C X3(ti5ZA*br;CNj$w=-)nxpwbAQp1gk literal 0 HcmV?d00001 diff --git a/src/ru/yaoilib/res/mipmap-xxxhdpi/ic_launcher.png b/src/ru/yaoilib/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..f2358585f49b015a2c3d18a64c5de49f114ab1e8 GIT binary patch literal 4179 zcmb_fc|6qL*S|BvSVK`rmSkT-)~_Y|-egxPp=j(QWXU#`5|Vw1?E5Y|WhctMe2s0a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M^$p2D0RmBwTGVix`Z?3qB5DigiZYH~(T zjN{pFLIJl3vqCppT=QzFByg8ku=%Qgi~N{`q&;ZCrBTgnf>GyjQo)P{dtsIxx9?_Eb?l5p4?CO#0 zZ3_+2EXE)RS?*dVbJ0mPlc$ZV!usc{?^}1rGEmVsCwVL_U(SDcaNy<7=z8xnnTJ-o zmkz=1hP2ero6KN9;dG;w)ay+-YzRY%-CSRv?(6H@c)D}kESt7YxfP@Hoanw9># zxh1Ng02y%eZD#9bIC*R{hj(!IQ>&qIu>j2}quXXut(U>tYdSA-ET4PHaGHu|7|YiJ zx3$4j1$p_cKNDp$Fcn%Anj*4ESO?WX74IZVm8Nro!m`28$)Fio=3SDLA4?{3>0kC^ z=|8?E$MVn*O3zTa+G6>A7Nw?Gur?L$G0n^Nx~mnm$}HZ46Ns(OS20DaESo$=bF4%) zKA(17yawZxpmUYy^km8rqWRL^-;#cFo>U8`PfD1^4^2umSxxiayi-)aZBR7{%}dYv zz7eso(m@gO33*8tsPexE)epSO2Ng*Qi-v!~P`j(rq(N@192|w^yqklE1A$Oi$D9A# dD_kh*9A+$0Z87h a").text() + manga.artist = body.select(".info-list__row:nth-child(3) > a").text() + manga.status = when (body.select(".info-list__row:nth-child(4) > span").text()) { + "продолжается" -> SManga.ONGOING + "завершен" -> SManga.COMPLETED + else -> SManga.UNKNOWN + } + manga.genre = body.select(".info-list__row:has(strong:contains(Жанры)) > a").joinToString { it.text() } + manga.description = body.select(".info-desc__content").text() + return manga + } + + override fun chapterListSelector() = "div.chapter-item" + + override fun chapterFromElement(element: Element): SChapter { + val chapterLink = element.select("div.chapter-item__name > a").first() + val chapter = SChapter.create() + chapter.setUrlWithoutDomain(chapterLink.attr("href")) + chapter.name = chapterLink.text() + chapter.date_upload = SimpleDateFormat("dd.MM.yyyy", Locale.US) + .parse(element.select("div.chapter-item__date").text()).time + return chapter + } + + override fun prepareNewChapter(chapter: SChapter, manga: SManga) { + """Глава\s(\d+)""".toRegex().find(chapter.name)?.let { + val number = it.groups[1]?.value!! + chapter.chapter_number = number.toFloat() + } + } + + override fun pageListParse(document: Document): List { + val pages = mutableListOf() + // Parse script + val script = document.select("script:not([src])").first().html() + val json: String = script.replace("window.__info = ", "") + val chapterInfo = JSONObject(json) + val pagesJson = chapterInfo.getJSONArray("pages") + for (i in 0..(pagesJson.length() - 1)) { + val page = pagesJson.getJSONObject(i) + pages.add(Page(page.getInt("page_slug"), "", "https://img1.yaoilib.me" + chapterInfo.getString("imgUrl") + page.getString("page_image"))) + } + return pages + } + + override fun imageUrlParse(document: Document) = "" + + override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers) + + override fun latestUpdatesSelector() = "div.updates__left" + + override fun latestUpdatesFromElement(element: Element): SManga { + val link = element.select("a").first() + val img = link.select("img").first() + val manga = SManga.create() + manga.thumbnail_url = img.attr("data-src") + manga.setUrlWithoutDomain(link.attr("href")) + manga.title = img.attr("alt") + return manga + } + + override fun latestUpdatesNextPageSelector(): String? = null + + override fun searchMangaSelector() = popularMangaSelector() + + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + val url = HttpUrl.parse("$baseUrl/manga-list?page=$page")!!.newBuilder() + if (query.isNotEmpty()) { + url.addQueryParameter("name", query) + } + (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> + when (filter) { + is CategoryList -> filter.state.forEach { category -> + if (category.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter("types[]", category.id) + } + } + is StatusList -> filter.state.forEach { status -> + if (status.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter("status[]", status.id) + } + } + is GenreList -> filter.state.forEach { genre -> + if (genre.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(if (genre.isIncluded()) "includeGenres[]" else "excludeGenres[]", genre.id) + } + } + is OrderBy -> { + url.addQueryParameter("dir", if (filter.state!!.ascending) "asc" else "desc") + url.addQueryParameter("sort", arrayOf("rate", "name", "views", "created_at")[filter.state!!.index]) + } + } + } + return GET(url.toString(), headers) + } + + override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() + + private class SearchFilter(name: String, val id: String) : Filter.TriState(name) + + private class CategoryList(categories: List) : Filter.Group("Категории", categories) + private class StatusList(statuses: List) : Filter.Group("Статус", statuses) + private class GenreList(genres: List) : Filter.Group("Жанры", genres) + + override fun getFilterList() = FilterList( + CategoryList(getCategoryList()), + StatusList(getStatusList()), + GenreList(getGenreList()), + OrderBy() + ) + + private class OrderBy : Filter.Sort("Сортировка", + arrayOf("Рейтинг", "Имя", "Просмотры", "Дата"), + Filter.Sort.Selection(1, false)) + + /* + * Use console + * Object.entries(__FILTER_ITEMS__.types).map(([k, v]) => `SearchFilter("${v.label}", "${v.id}")`).join(',\n') + * on https:/yaoilib.me/manga-list + */ + private fun getCategoryList() = listOf( + SearchFilter("Манга", "1"), + SearchFilter("OEL-манга", "4"), + SearchFilter("Манхва", "5"), + SearchFilter("Маньхуа", "6"), + SearchFilter("Сингл", "7"), + SearchFilter("Руманга", "8"), + SearchFilter("Комикс западный", "9") + ) + + /* + * Use console + * Object.entries(__FILTER_ITEMS__.status).map(([k, v]) => `SearchFilter("${v.label}", "${v.id}")`).join(',\n') + * on https://yaoilib.me/manga-list + */ + private fun getStatusList() = listOf( + SearchFilter("продолжается", "1"), + SearchFilter("завершен", "2"), + SearchFilter("заморожен", "3") + ) + + /* + * Use console + * __FILTER_ITEMS__.genres.map(it => `SearchFilter("${it.name}", "${it.id}")`).join(',\n') + * on https://yaoilib.me/manga-list + */ + private fun getGenreList() = listOf( + SearchFilter("арт", "32"), + SearchFilter("бара", "33"), + SearchFilter("боевик", "34"), + SearchFilter("боевые искусства", "35"), + SearchFilter("вампиры", "36"), + SearchFilter("гарем", "37"), + SearchFilter("гендерная интрига", "38"), + SearchFilter("героическое фэнтези", "39"), + SearchFilter("детектив", "40"), + SearchFilter("дзёсэй", "41"), + SearchFilter("додзинси", "42"), + SearchFilter("драма", "43"), + SearchFilter("игра", "44"), + SearchFilter("история", "45"), + SearchFilter("киберпанк", "46"), + SearchFilter("комедия", "47"), + SearchFilter("махо-сёдзё", "48"), + SearchFilter("меха", "49"), + SearchFilter("мистика", "50"), + SearchFilter("научная фантастика", "51"), + SearchFilter("повседневность", "52"), + SearchFilter("постапокалиптика", "53"), + SearchFilter("приключения", "54"), + SearchFilter("психология", "55"), + SearchFilter("романтика", "56"), + SearchFilter("самурайский боевик", "57"), + SearchFilter("сверхъестественное", "58"), + SearchFilter("сёдзё", "59"), + SearchFilter("сёдзё-ай", "60"), + SearchFilter("сёнэн", "61"), + SearchFilter("сёнэн-ай", "62"), + SearchFilter("спорт", "63"), + SearchFilter("сэйнэн", "64"), + SearchFilter("трагедия", "65"), + SearchFilter("триллер", "66"), + SearchFilter("ужасы", "67"), + SearchFilter("фантастика", "68"), + SearchFilter("фэнтези", "69"), + SearchFilter("школа", "70"), + SearchFilter("эротика", "71"), + SearchFilter("этти", "72"), + SearchFilter("юри", "73"), + SearchFilter("яой", "74"), + SearchFilter("ёнкома", "75"), + SearchFilter("кодомо", "76"), + SearchFilter("омегаверс", "77") + ) +} \ No newline at end of file