GithubHelp home page GithubHelp logo

esjzoneapi's Introduction

EsjzoneAPI

通过jsoup解析网页内容制作的esjzone api

(吐槽一句Esjzone前后端不分离)

开发计划

  • 优化 EsjzoneClient的结构
  • 将网页版Esjzone大部分功能实现
    • 列出评论
    • 发送评论
    • 回复评论
    • 添加/删除收藏
    • 内容相关的部分添加更多的支持(比如 加粗 斜体 删除线 等)

项目依赖

Okhttp3
Retrofit2
Jsoup
Xsoup
Gson

快速入门

// 登录方法 1 - Cookie 缓存
val client: EsjzoneClient = EsjzoneClientBuilder.of()
        .key("这里放置你的wsKey")
        .token("这里放置你的wsToken")
        .build()
// 登录方法 2 - 账户 + 密码
val client: EsjzoneClient = EsjzoneLoginer.of()
        .login("[email protected]", "password123")

获取用户信息

val uid: Int = 12345
val user: User = client.getUserInfo(uid)

// 获取我自己
val me: SelfUser = client.getMe();

获取所有的分类,并获取分类下所有的小说

val categories: List<Category> = client.listCategories()
for (category in categories) {
        val novels: List<Novel> = category.listNovels()
}

获取小说的介绍、章节

val novel: Novel = ...
val description: NovelDescription = novel.description
for (line in description.descriptionLine) {
    if (line is TextDescriptionLine) {
        println(line.text)
    } else if (line is ImageDescriptionLine) {
        println(line.src)
    }   
}
val chapters: List<Chapter> = novel.listChapters()

获取小说章节的内容

val chapter: Chapter = ...
for (content in chapter.contents) {
    if (content is TextChapterContent) {
        println(content.text)
    } else if (content is ImageChapterContent) {
        println(content.url)
    }
}

esjzoneapi's People

Contributors

deechael avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.