Merge pull request #33 from tom5079/Pupil-29

Pupil-29
This commit is contained in:
Pupil
2019-12-13 19:42:44 +09:00
committed by GitHub
8 changed files with 114 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.11.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
implementation 'org.jsoup:jsoup:1.11.3'
testImplementation 'junit:junit:4.12'
}

View File

@@ -32,7 +32,13 @@ data class GalleryInfo(
)
@Serializable
open class Reader(val title: String, val galleryInfo: List<GalleryInfo>)
data class Reader(val code: Code, val title: String, val galleryInfo: List<GalleryInfo>) {
enum class Code {
HITOMI,
HIYOBI,
SORALA
}
}
//Set header `Referer` to reader url to avoid 403 error
fun getReader(galleryID: Int) : Reader {
@@ -40,5 +46,5 @@ fun getReader(galleryID: Int) : Reader {
val doc = Jsoup.connect(readerUrl).get()
return Reader(doc.title(), getGalleryInfo(galleryID))
return Reader(Reader.Code.HITOMI, doc.title(), getGalleryInfo(galleryID))
}

View File

@@ -76,7 +76,7 @@ fun getReader(galleryID: Int) : Reader {
}
)
return Reader(title, galleryInfo)
return Reader(Reader.Code.HIYOBI, title, galleryInfo)
}
fun createImgList(galleryID: Int, reader: Reader) =