├── .github └── workflows │ ├── Build.yml │ ├── clone.yml │ ├── genJar.sh │ └── test.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── catvod │ │ │ ├── api │ │ │ ├── AliYun.java │ │ │ ├── QuarkApi.java │ │ │ └── UCApi.java │ │ │ ├── bean │ │ │ ├── Class.java │ │ │ ├── Filter.java │ │ │ ├── Result.java │ │ │ ├── Sub.java │ │ │ ├── Vod.java │ │ │ ├── ali │ │ │ │ ├── Biz.java │ │ │ │ ├── Cache.java │ │ │ │ ├── Code.java │ │ │ │ ├── Data.java │ │ │ │ ├── Download.java │ │ │ │ ├── Drive.java │ │ │ │ ├── Item.java │ │ │ │ ├── OAuth.java │ │ │ │ ├── Preview.java │ │ │ │ ├── Resp.java │ │ │ │ ├── Share.java │ │ │ │ └── User.java │ │ │ ├── alist │ │ │ │ ├── Drive.java │ │ │ │ ├── Item.java │ │ │ │ ├── Login.java │ │ │ │ ├── Param.java │ │ │ │ └── Sorter.java │ │ │ ├── bili │ │ │ │ ├── Dash.java │ │ │ │ ├── Data.java │ │ │ │ ├── Media.java │ │ │ │ ├── Owner.java │ │ │ │ ├── Page.java │ │ │ │ ├── Resp.java │ │ │ │ ├── Segment.java │ │ │ │ └── Wbi.java │ │ │ ├── jianpian │ │ │ │ ├── Data.java │ │ │ │ ├── Detail.java │ │ │ │ └── Resp.java │ │ │ ├── market │ │ │ │ ├── Data.java │ │ │ │ └── Item.java │ │ │ ├── quark │ │ │ │ ├── Cache.java │ │ │ │ ├── Item.java │ │ │ │ ├── ShareData.java │ │ │ │ └── User.java │ │ │ ├── star │ │ │ │ ├── Card.java │ │ │ │ ├── Condition.java │ │ │ │ ├── Group.java │ │ │ │ ├── Info.java │ │ │ │ ├── Person.java │ │ │ │ ├── Query.java │ │ │ │ └── Video.java │ │ │ ├── uc │ │ │ │ ├── Cache.java │ │ │ │ ├── Item.java │ │ │ │ ├── ShareData.java │ │ │ │ └── User.java │ │ │ ├── upyun │ │ │ │ ├── Data.java │ │ │ │ └── Item.java │ │ │ ├── webdav │ │ │ │ ├── Drive.java │ │ │ │ └── Sorter.java │ │ │ └── xpath │ │ │ │ └── Rule.java │ │ │ ├── crawler │ │ │ ├── Spider.java │ │ │ └── SpiderDebug.java │ │ │ ├── debug │ │ │ └── MainActivity.java │ │ │ ├── js │ │ │ └── Method.java │ │ │ ├── net │ │ │ ├── OkHttp.java │ │ │ ├── OkRequest.java │ │ │ ├── OkResult.java │ │ │ └── SSLCompat.java │ │ │ ├── spider │ │ │ ├── AList.java │ │ │ ├── Ali.java │ │ │ ├── AppYsV2.java │ │ │ ├── Bili.java │ │ │ ├── ChangZhang.java │ │ │ ├── Cloud.java │ │ │ ├── DaGongRen.java │ │ │ ├── Ddrk.java │ │ │ ├── DianYingYunJi.java │ │ │ ├── Dm84.java │ │ │ ├── Doll.java │ │ │ ├── Douban.java │ │ │ ├── Eighteen.java │ │ │ ├── FirstAid.java │ │ │ ├── Glod.kt │ │ │ ├── Hanime.java │ │ │ ├── HkTv.java │ │ │ ├── Ikanbot.java │ │ │ ├── Init.java │ │ │ ├── Introduce.java │ │ │ ├── JSDemo.java │ │ │ ├── Jable.java │ │ │ ├── JavDb.java │ │ │ ├── Jianpian.java │ │ │ ├── JustLive.java │ │ │ ├── Kanqiu.java │ │ │ ├── KuaKeBa.java │ │ │ ├── KuaKeS.java │ │ │ ├── Kugou.java │ │ │ ├── Libvio.java │ │ │ ├── Local.java │ │ │ ├── Market.java │ │ │ ├── Miss.java │ │ │ ├── Mogg.java │ │ │ ├── NCat.java │ │ │ ├── NG.java │ │ │ ├── NGkt.kt │ │ │ ├── Notice.java │ │ │ ├── PTT.java │ │ │ ├── PanSearch.java │ │ │ ├── PanSou.java │ │ │ ├── Proxy.java │ │ │ ├── Push.java │ │ │ ├── QiLeSo.java │ │ │ ├── Quark.java │ │ │ ├── QxiTv.java │ │ │ ├── Star.java │ │ │ ├── Supjav.java │ │ │ ├── TvDy.java │ │ │ ├── UC.java │ │ │ ├── UpYun.java │ │ │ ├── W55Movie.java │ │ │ ├── WebDAV.java │ │ │ ├── Wogg.java │ │ │ ├── XPath.java │ │ │ ├── XPathFilter.java │ │ │ ├── XPathMac.java │ │ │ ├── XPathMacFilter.java │ │ │ ├── Xb6v.java │ │ │ ├── XiaoZhiTiao.java │ │ │ ├── XuanFeng.java │ │ │ ├── YiSo.java │ │ │ ├── Ysj.java │ │ │ ├── YunPanBa.java │ │ │ ├── Zhaozy.java │ │ │ └── Zxzj.java │ │ │ ├── ui │ │ │ └── ScrollTextView.java │ │ │ └── utils │ │ │ ├── AESEncryption.java │ │ │ ├── FileProvider.java │ │ │ ├── FileUtil.java │ │ │ ├── Image.java │ │ │ ├── Json.java │ │ │ ├── Notify.java │ │ │ ├── Path.java │ │ │ ├── Prefers.java │ │ │ ├── ProxyVideo.java │ │ │ ├── QRCode.java │ │ │ ├── ResUtil.java │ │ │ ├── Shell.java │ │ │ └── Util.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.webp │ │ ├── mipmap-mdpi │ │ └── ic_launcher.webp │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.webp │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.webp │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ ├── AppYsV2Test.java │ ├── ChangZhangTest.java │ ├── CompileJSTest.kt │ ├── DaGongRenTest.java │ ├── DdrkTest.java │ ├── DianYingYunJiTest.java │ ├── GoldTest.java │ ├── HKTvTest.java │ ├── IkanbotTest.java │ ├── JianpianTest.java │ ├── JustLiveTest.java │ ├── KuaKeBaTest.java │ ├── KuaKeSTest.java │ ├── LibvioTest.java │ ├── MoggTest.java │ ├── NCatTest.java │ ├── NGTest.java │ ├── PanSearchTest.java │ ├── ProxyTest.java │ ├── QiLeSoTest.java │ ├── QuarkTest.java │ ├── QxiTvTest.java │ ├── SupjavTest.java │ ├── TvDyTest.java │ ├── W55MovieTest.java │ ├── WoggTest.java │ ├── Xb6vTest.java │ ├── XuanFengTest.java │ ├── YsjTest.java │ ├── YunPanBaTest.java │ ├── ZxzjTest.java │ └── com │ └── github │ └── catvod │ ├── api │ └── QuarkApiTest.java │ └── server │ ├── Nano.java │ ├── Process.java │ ├── Proxy.java │ └── Server.java ├── build.bat ├── build.gradle ├── build.sh ├── compile.bat ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jar ├── 3rd │ ├── apktool_2.4.1.jar │ ├── baksmali-2.5.2.jar │ └── oss.jar ├── custom_spider.jar ├── custom_spider.jar.md5 ├── genJar.bat ├── genJar.sh └── spider.jar │ ├── apktool.yml │ └── original │ └── META-INF │ └── MANIFEST.MF ├── json ├── alist.json ├── bili.json ├── demo.json ├── douban.json ├── index.json ├── index1.json ├── index2.json ├── jianpian.json ├── js │ ├── aiyingshi.js │ ├── alipansou.js │ ├── aliyunpanshare.js │ ├── bilibili.js │ ├── changzhang.js │ ├── cilixiong.js │ ├── cntv.js │ ├── douban.js │ ├── dubo.js │ ├── dygangs.js │ ├── gitcafe.js │ ├── haiwaikan.js │ ├── huya.js │ ├── jianpian.js │ ├── jpyy.js │ ├── jpyy2.js │ ├── kankan70.js │ ├── kuaikan.js │ ├── lovemovie.js │ ├── mp4movie.js │ ├── mxanime.js │ ├── nangua.js │ ├── newvision.js │ ├── nivod.js │ ├── pan_search.js │ ├── sp360.js │ ├── star.js │ ├── tiantian.js │ ├── wogg.js │ └── xb6v.js ├── market.json ├── notice.json ├── test.json └── webdav.json ├── settings.gradle └── tools ├── .gitignore ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── src └── main ├── java └── com │ └── fongmi │ └── tools │ ├── Live.java │ ├── Utils.java │ └── bean │ ├── Channel.java │ ├── Data.java │ └── Group.java └── resources ├── data.json └── test.txt /.github/workflows/clone.yml: -------------------------------------------------------------------------------- 1 | name: Clone 2 | # 触发器 3 | on: 4 | schedule: 5 | - cron: 0 19 1 * * #每天在国际标准时间19点(北京时间+8,即 03:00) 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: Ubuntu-22.04 11 | steps: 12 | # 检出代码 13 | - uses: actions/checkout@v3 14 | # 删除旧的工作流 15 | - name: Delete action workflows 16 | uses: Mattraks/delete-workflow-runs@v2 17 | with: 18 | repository: ${{ github.repository }} 19 | retain_days: 0 # 20 | keep_minimum_runs: 1 # 21 | 22 | - name: Clone project 23 | run: | 24 | rm -rf ./* 25 | git clone --recurse-submodules https://github.com/lushunming/AndroidCatVodSpider Project 26 | cp -r Project/* ${{ github.workspace }} 27 | #cp -r Project/.github/workflows/* ${{ github.workspace }}/.github/ 28 | rm -rf Project 29 | 30 | - name: Update files 31 | uses: EndBug/add-and-commit@main 32 | with: 33 | default_author: github_actor 34 | message: 'update files' 35 | add: ${{ github.workspace }}/* 36 | github_token: ${{ secrets.GITHUB_TOKEN }} 37 | -------------------------------------------------------------------------------- /.github/workflows/genJar.sh: -------------------------------------------------------------------------------- 1 | rm -f custom_spider.jar 2 | rm -rf Smali_classes 3 | 4 | java -jar 3rd/baksmali-2.5.2.jar d ../app/build/intermediates/dex/release/minifyReleaseWithR8/classes.dex -o Smali_classes 5 | 6 | rm -rf spider.jar/smali/com/github/catvod/spider 7 | rm -rf spider.jar/smali/com/github/catvod/parser 8 | 9 | [ -f spider.jar/smali/com/github/catvod ] || mkdir -p spider.jar/smali/com/github/catvod 10 | 11 | if [ "$1" == "ec" ]; then 12 | java -Dfile.encoding=utf-8 -jar 3rd/oss.jar Smali_classes 13 | fi 14 | 15 | mv Smali_classes/com/github/catvod/spider spider.jar/smali/com/github/catvod 16 | mv Smali_classes/com/github/catvod/parser spider.jar/smali/com/github/catvod 17 | 18 | rm -rf Smali_classes 19 | 20 | java -jar 3rd/apktool_2.4.1.jar b spider.jar -c 21 | 22 | mv spider.jar/dist/dex.jar custom_spider.jar 23 | 24 | md5sum custom_spider.jar | cut -d ' ' -f 1 > custom_spider.jar.md5 25 | 26 | rm -rf spider.jar/smali/com/github/catvod/spider 27 | rm -rf spider.jar/smali/com/github/catvod/parser 28 | 29 | rm -rf spider.jar/build 30 | rm -rf spider.jar/dist 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v3 13 | - name: set up JDK 14 | uses: actions/setup-java@v3.11.0 15 | with: 16 | java-version: '18' 17 | distribution: 'temurin' 18 | 19 | - name: Clone project 20 | run: | 21 | rm -rf project 22 | rm -rf jar/custom_spider.jar 23 | git clone --recurse-submodules https://github.com/zhixc/CatVodTVSpider project 24 | 25 | - name: diy the app 26 | working-directory: ./project 27 | run: | 28 | #禁止混淆 29 | #sed -i '/minifyEnabled/g' app/build.gradle 30 | rm -rf app/src/main/java/com/github/catvod/spider/* 31 | curl -L https://github.com/zhixc/CatVodTVSpider/raw/main/app/src/main/java/com/github/catvod/spider/Init.java > app/src/main/java/com/github/catvod/spider/Init.java 32 | #添加AppYsV2 33 | curl -L https://github.com/zhixc/CatVodTVSpider/raw/main/app/src/main/java/com/github/catvod/spider/AppYsV2.java > app/src/main/java/com/github/catvod/spider/AppYsV2.java 34 | #curl -L https://raw.githubusercontent.com/CatVodTVOfficial/CatVodTVSpider/master/app/src/main/java/com/github/catvod/spider/AppYsV2.java > app/src/main/java/com/github/catvod/spider/AppYsV2.java 35 | #sed -i 's/com.github.catvod.utils.okhttp.OkHttpUtil/com.github.catvod.net.OkHttp/g;s/OkHttpUtil/OkHttp/g' app/src/main/java/com/github/catvod/spider/AppYsV2.java 36 | #curl -L https://github.com/xxxyyy888/CatVodSpider/raw/main/app/src/main/java/com/github/catvod/spider/AppYsV2.java > app/src/main/java/com/github/catvod/spider/AppYsV2.java 37 | 38 | - name: Build the app 39 | working-directory: ./project 40 | run: | 41 | chmod +x gradlew 42 | ./gradlew assemblerelease --build-cache --parallel --daemon --warning-mode all 43 | 44 | - name: Customize Spider Jar 45 | working-directory: ./project 46 | run: | 47 | rm -rf jar/custom_spider.jar 48 | rm -rf jar/spider.jar/original/META-INF 49 | curl -L https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar > jar/3rd/apktool_2.7.0.jar 50 | #未混淆classes.dex目录:app/build/intermediates/dex/release/mergeDexRelease/ 51 | java -jar jar/3rd/baksmali-2.5.2.jar d app/build/intermediates/dex/release/minifyReleaseWithR8/classes.dex -o jar/Smali_classes 52 | mkdir -p jar/spider.jar/smali/com/github/catvod/ 53 | mv jar/Smali_classes/com/github/catvod/spider jar/spider.jar/smali/com/github/catvod/ 54 | java -jar jar/3rd/apktool_2.7.0.jar b jar/spider.jar -c 55 | mv jar/spider.jar/dist/dex.jar ../jar/custom_spider.jar 56 | md5=($(md5sum ../jar/custom_spider.jar)) 57 | echo $md5 > ../jar/custom_spider.jar.md5 58 | - name: Upload APK 59 | uses: actions/upload-artifact@v3.1.2 60 | with: 61 | name: Spider 62 | path: ./jar/custom_spider.jar 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 lushunming 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CatVodSpider for TVBOX android 2 | 3 | ## Based on CatVod 4 | 5 | fork from https://github.com/FongMi/CatVodSpider 6 | 7 | spider 参考 https://github.com/bizhangjie/CatVodSpider 8 | 9 | jsSpider 参考 https://github.com/jadehh/TVSpider 10 | 11 | 源链接:https://mirror.ghproxy.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/mine/json/index.json 12 | 或者 https://androidcatvodspider.pages.dev/json/index.json 13 | 14 | 15 | ## 贡献 16 | 请参考 [CONTRIBUTING.md](/CONTRIBUTING.md) 17 | 18 | ## ✨ Star 数 19 | 20 | [![Star History Chart](https://api.star-history.com/svg?repos=lushunming/AndroidCatVodSpider&type=Date)](https://star-history.com/#lushunming/AndroidCatVodSpider&Date) 21 | --- 22 | 23 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'ru.cleverpumpkin.proguard-dictionaries-generator' 4 | id 'org.jetbrains.kotlin.android' 5 | } 6 | java { 7 | toolchain { 8 | languageVersion = JavaLanguageVersion.of(17) 9 | } 10 | } 11 | android { 12 | namespace 'com.github.catvod' 13 | 14 | compileSdk 34 15 | 16 | defaultConfig { 17 | applicationId "com.github.catvod.demo" 18 | minSdk 16 19 | targetSdk 34 20 | ndk { abiFilters "arm64-v8a" } 21 | 22 | 23 | } 24 | 25 | buildTypes { 26 | release { 27 | minifyEnabled true 28 | proguardFiles 'proguard-rules.pro' 29 | proguardDictionaries { 30 | dictionaryNames = ["build/class-dictionary", "build/package-dictionary", "build/obfuscation-dictionary"] 31 | minLineLength 1 32 | maxLineLength 3 33 | linesCountInDictionary 100000 34 | } 35 | } 36 | } 37 | 38 | compileOptions { 39 | sourceCompatibility JavaVersion.VERSION_11 40 | targetCompatibility JavaVersion.VERSION_11 41 | } 42 | testOptions { 43 | unitTests.returnDefaultValues = true 44 | unitTests.includeAndroidResources = true 45 | } 46 | kotlinOptions { 47 | jvmTarget = "11" 48 | 49 | } 50 | 51 | configurations.configureEach { 52 | resolutionStrategy { 53 | force 'com.squareup.okhttp3:okhttp:3.12.13' 54 | } 55 | } 56 | } 57 | 58 | dependencies { 59 | implementation 'com.github.thegrizzlylabs:sardine-android:0.9' 60 | implementation 'wang.harlon.quickjs:wrapper-android:2.0.0' 61 | implementation 'com.squareup.okhttp3:okhttp:3.12.13' 62 | implementation 'com.google.code.gson:gson:2.11.0' 63 | implementation 'cn.wanghaomiao:JsoupXpath:2.5.1' 64 | implementation 'com.google.zxing:core:3.3.0' 65 | implementation 'com.orhanobut:logger:2.2.0' 66 | implementation 'org.jsoup:jsoup:1.15.3' 67 | implementation 'androidx.core:core-ktx:1.10.1' 68 | testImplementation "io.github.dokar3:quickjs-kt-jvm:1.0.0-alpha13" 69 | testImplementation 'org.nanohttpd:nanohttpd:2.3.1' 70 | implementation 'commons-codec:commons-codec:1.17.1' 71 | 72 | // Required -- JUnit 4 framework 73 | testImplementation 'junit:junit:4.12' 74 | // Optional -- Mockito framework(可选,用于模拟一些依赖对象,以达到隔离依赖的效果) 75 | testImplementation 'org.mockito:mockito-core:5.12.0' 76 | testImplementation "org.robolectric:robolectric:4.13" 77 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1" 78 | //implementation 'wang.harlon.quickjs:wrapper-java:1.0.0' 79 | // implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release') 80 | // api 'wang.harlon.quickjs:wrapper-android:2.0.0' 81 | 82 | 83 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Merge 2 | -flattenpackagehierarchy com.github.catvod.spider.merge 3 | -dontwarn org.slf4j.impl.StaticLoggerBinder 4 | 5 | # Spider 6 | -keep class com.github.catvod.js.* { *; } 7 | -keep class com.github.catvod.crawler.* { *; } 8 | -keep class com.github.catvod.spider.* { public ; } 9 | -keep class com.github.catvod.parser.* { public ; } 10 | 11 | # AndroidX 12 | -keep class androidx.core.** { *; } 13 | 14 | # Gson 15 | -keep class com.google.gson.** { *; } 16 | 17 | # OkHttp 18 | -dontwarn okhttp3.** 19 | -keep class okio.** { *; } 20 | -keep class okhttp3.** { *; } 21 | 22 | # Logger 23 | -keep class com.orhanobut.logger.** { *; } 24 | 25 | # QuickJS 26 | -keep class com.whl.quickjs.** { *; } 27 | 28 | # Sardine 29 | -keep class com.thegrizzlylabs.sardineandroid.** { *; } 30 | 31 | # Smbj 32 | -dontwarn org.xmlpull.v1.** 33 | -dontwarn android.content.res.** 34 | -keep class com.hierynomus.** { *; } 35 | -keep class net.engio.mbassy.** { *; } 36 | 37 | # Zxing 38 | -keep class com.google.zxing.** { *; } 39 | -keepclassmembers enum * { 40 | public static **[] values(); 41 | public static ** valueOf(java.lang.String); 42 | } 43 | 44 | # Please add these rules to your existing keep rules in order to suppress warnings. 45 | # This is generated automatically by the Android Gradle plugin. 46 | -dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/Class.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.annotations.SerializedName; 5 | import com.google.gson.reflect.TypeToken; 6 | 7 | import java.lang.reflect.Type; 8 | import java.util.List; 9 | 10 | public class Class { 11 | 12 | @SerializedName("type_id") 13 | private String typeId; 14 | @SerializedName("type_name") 15 | private String typeName; 16 | @SerializedName("type_flag") 17 | private String typeFlag; 18 | 19 | public static List arrayFrom(String str) { 20 | Type listType = new TypeToken>() {}.getType(); 21 | return new Gson().fromJson(str, listType); 22 | } 23 | 24 | public Class(String typeId) { 25 | this(typeId, typeId); 26 | } 27 | 28 | public Class(String typeId, String typeName) { 29 | this(typeId, typeName, null); 30 | } 31 | 32 | public Class(String typeId, String typeName, String typeFlag) { 33 | this.typeId = typeId; 34 | this.typeName = typeName; 35 | this.typeFlag = typeFlag; 36 | } 37 | 38 | public String getTypeId() { 39 | return typeId; 40 | } 41 | 42 | @Override 43 | public boolean equals(Object obj) { 44 | if (this == obj) return true; 45 | if (!(obj instanceof Class)) return false; 46 | Class it = (Class) obj; 47 | return getTypeId().equals(it.getTypeId()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/Filter.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.List; 6 | 7 | public class Filter { 8 | 9 | @SerializedName("key") 10 | private String key; 11 | @SerializedName("name") 12 | private String name; 13 | @SerializedName("init") 14 | private String init; 15 | @SerializedName("value") 16 | private List value; 17 | 18 | public Filter(String key, String name, List value) { 19 | this.key = key; 20 | this.name = name; 21 | this.value = value; 22 | } 23 | 24 | public static class Value { 25 | 26 | @SerializedName("n") 27 | private String n; 28 | @SerializedName("v") 29 | private String v; 30 | 31 | public Value(String value) { 32 | this.n = value; 33 | this.v = value; 34 | } 35 | 36 | public Value(String n, String v) { 37 | this.n = n; 38 | this.v = v; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/Sub.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class Sub { 6 | 7 | @SerializedName("url") 8 | private String url; 9 | @SerializedName("name") 10 | private String name; 11 | @SerializedName("lang") 12 | private String lang; 13 | @SerializedName("format") 14 | private String format; 15 | 16 | public static Sub create() { 17 | return new Sub(); 18 | } 19 | 20 | public Sub name(String name) { 21 | this.name = name; 22 | return this; 23 | } 24 | 25 | public Sub url(String url) { 26 | this.url = url; 27 | return this; 28 | } 29 | 30 | public Sub lang(String lang) { 31 | this.lang = lang; 32 | return this; 33 | } 34 | 35 | public Sub format(String format) { 36 | this.format = format; 37 | return this; 38 | } 39 | 40 | public Sub ext(String ext) { 41 | switch (ext) { 42 | case "vtt": 43 | return format("text/vtt"); 44 | case "ass": 45 | case "ssa": 46 | return format("text/x-ssa"); 47 | default: 48 | return format("application/x-subrip"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Biz.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.List; 7 | 8 | public class Biz { 9 | 10 | @SerializedName("pds_login_result") 11 | private Biz pdsLoginResult; 12 | @SerializedName("role") 13 | private String role; 14 | @SerializedName("isFirstLogin") 15 | private Boolean isFirstLogin; 16 | @SerializedName("needLink") 17 | private Boolean needLink; 18 | @SerializedName("loginType") 19 | private String loginType; 20 | @SerializedName("nickName") 21 | private String nickName; 22 | @SerializedName("needRpVerify") 23 | private Boolean needRpVerify; 24 | @SerializedName("avatar") 25 | private String avatar; 26 | @SerializedName("accessToken") 27 | private String accessToken; 28 | @SerializedName("userName") 29 | private String userName; 30 | @SerializedName("userId") 31 | private String userId; 32 | @SerializedName("defaultDriveId") 33 | private String defaultDriveId; 34 | @SerializedName("existLink") 35 | private List existLink; 36 | @SerializedName("expiresIn") 37 | private Integer expiresIn; 38 | @SerializedName("expireTime") 39 | private String expireTime; 40 | @SerializedName("requestId") 41 | private String requestId; 42 | @SerializedName("dataPinSetup") 43 | private Boolean dataPinSetup; 44 | @SerializedName("state") 45 | private String state; 46 | @SerializedName("tokenType") 47 | private String tokenType; 48 | @SerializedName("dataPinSaved") 49 | private Boolean dataPinSaved; 50 | @SerializedName("refreshToken") 51 | private String refreshToken; 52 | @SerializedName("status") 53 | private String status; 54 | 55 | public static Biz objectFrom(String str) { 56 | return new Gson().fromJson(str, Biz.class); 57 | } 58 | 59 | public Biz getPdsLoginResult() { 60 | return pdsLoginResult; 61 | } 62 | 63 | public String getRefreshToken() { 64 | return refreshToken; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Cache.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import com.github.catvod.api.AliYun; 4 | import com.github.catvod.spider.Init; 5 | import com.github.catvod.utils.Path; 6 | import com.google.gson.Gson; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | public class Cache { 10 | 11 | @SerializedName("user") 12 | private User user; 13 | @SerializedName("oauth") 14 | private OAuth oauth; 15 | @SerializedName("drive") 16 | private Drive drive; 17 | 18 | public static Cache objectFrom(String str) { 19 | Cache item = new Gson().fromJson(str, Cache.class); 20 | return item == null ? new Cache() : item; 21 | } 22 | 23 | public User getUser() { 24 | return user == null ? new User() : user; 25 | } 26 | 27 | public void setUser(User user) { 28 | this.user = user; 29 | this.save(); 30 | } 31 | 32 | public OAuth getOAuth() { 33 | return oauth == null ? new OAuth() : oauth; 34 | } 35 | 36 | public void setOAuth(OAuth oauth) { 37 | this.oauth = oauth; 38 | this.save(); 39 | } 40 | 41 | public Drive getDrive() { 42 | return drive == null ? new Drive() : drive; 43 | } 44 | 45 | public void setDrive(Drive drive) { 46 | this.drive = drive; 47 | this.save(); 48 | } 49 | 50 | public void save() { 51 | Init.execute(() -> Path.write(AliYun.get().getCache(), toString())); 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return new Gson().toJson(this); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Code.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Code { 9 | 10 | @SerializedName("redirectUri") 11 | private String redirectUri; 12 | 13 | public static Code objectFrom(String str) { 14 | return new Gson().fromJson(str, Code.class); 15 | } 16 | 17 | public String getRedirectUri() { 18 | return TextUtils.isEmpty(redirectUri) ? "" : redirectUri; 19 | } 20 | 21 | public String getCode() { 22 | return getRedirectUri().split("code=")[1]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Data.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.util.Base64; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class Data { 12 | 13 | @SerializedName("data") 14 | private Data data; 15 | @SerializedName("content") 16 | private Data content; 17 | @SerializedName("t") 18 | private String t; 19 | @SerializedName("ck") 20 | private String ck; 21 | @SerializedName("codeContent") 22 | private String codeContent; 23 | @SerializedName("qrCodeStatus") 24 | private String qrCodeStatus; 25 | @SerializedName("bizExt") 26 | private String bizExt; 27 | 28 | public static Data objectFrom(String str) { 29 | try { 30 | Data data = new Gson().fromJson(str, Data.class); 31 | return data == null ? new Data() : data; 32 | } catch (Exception e) { 33 | return new Data(); 34 | } 35 | } 36 | 37 | public Data getData() { 38 | return data == null ? new Data() : data; 39 | } 40 | 41 | public Data getContent() { 42 | return content == null ? new Data() : content; 43 | } 44 | 45 | public String getT() { 46 | return t == null ? "" : t; 47 | } 48 | 49 | public String getCk() { 50 | return ck == null ? "" : ck; 51 | } 52 | 53 | public String getCodeContent() { 54 | return codeContent == null ? "" : codeContent; 55 | } 56 | 57 | public String getQrCodeStatus() { 58 | return qrCodeStatus == null ? "" : qrCodeStatus; 59 | } 60 | 61 | public String getBizExt() { 62 | return bizExt == null ? "" : bizExt; 63 | } 64 | 65 | public String getToken() { 66 | return Biz.objectFrom(new String(Base64.decode(getBizExt(), Base64.DEFAULT))).getPdsLoginResult().getRefreshToken(); 67 | } 68 | 69 | public boolean hasToken() { 70 | return getQrCodeStatus().equals("CONFIRMED") && getBizExt().length() > 0; 71 | } 72 | 73 | public Map getParams() { 74 | Map params = new HashMap<>(); 75 | params.put("t", getT()); 76 | params.put("ck", getCk()); 77 | params.put("appName", "aliyun_drive"); 78 | params.put("appEntrance", "web"); 79 | params.put("isMobile", "false"); 80 | params.put("lang", "zh_CN"); 81 | params.put("returnUrl", ""); 82 | params.put("fromSite", "52"); 83 | params.put("bizParams", ""); 84 | params.put("navlanguage", "zh-CN"); 85 | params.put("navPlatform", "MacIntel"); 86 | return params; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Download.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Download { 9 | 10 | @SerializedName("url") 11 | private String url; 12 | @SerializedName("file_id") 13 | private String fileId; 14 | @SerializedName("expiration") 15 | private String expiration; 16 | 17 | public static Download objectFrom(String str) { 18 | return new Gson().fromJson(str, Download.class); 19 | } 20 | 21 | public String getUrl() { 22 | return TextUtils.isEmpty(url) ? "" : url; 23 | } 24 | 25 | public String getFileId() { 26 | return TextUtils.isEmpty(fileId) ? "" : fileId; 27 | } 28 | 29 | public String getExpiration() { 30 | return TextUtils.isEmpty(expiration) ? "" : expiration; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Drive.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Drive { 9 | 10 | @SerializedName("default_drive_id") 11 | private String defaultDriveId; 12 | @SerializedName("resource_drive_id") 13 | private String resourceDriveId; 14 | 15 | public static Drive objectFrom(String str) { 16 | Drive item = new Gson().fromJson(str, Drive.class); 17 | return item == null ? new Drive() : item; 18 | } 19 | 20 | private String getDefaultDriveId() { 21 | return TextUtils.isEmpty(defaultDriveId) ? "" : defaultDriveId; 22 | } 23 | 24 | private String getResourceDriveId() { 25 | return TextUtils.isEmpty(resourceDriveId) ? "" : resourceDriveId; 26 | } 27 | 28 | public String getDriveId() { 29 | return getResourceDriveId().isEmpty() ? getDefaultDriveId() : getResourceDriveId(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Item.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.utils.Util; 6 | import com.google.gson.Gson; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | import java.util.Arrays; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class Item implements Comparable { 14 | 15 | @SerializedName("items") 16 | private List items; 17 | @SerializedName("next_marker") 18 | private String nextMarker; 19 | @SerializedName("file_id") 20 | private String fileId; 21 | @SerializedName("share_id") 22 | private String shareId; 23 | @SerializedName("name") 24 | private String name; 25 | @SerializedName("type") 26 | private String type; 27 | @SerializedName("file_extension") 28 | private String fileExtension; 29 | @SerializedName("category") 30 | private String category; 31 | @SerializedName("size") 32 | private double size; 33 | @SerializedName("parent") 34 | private String parent; 35 | 36 | public static Item objectFrom(String str) { 37 | return new Gson().fromJson(str, Item.class); 38 | } 39 | 40 | public Item(String fileId) { 41 | this.fileId = fileId; 42 | } 43 | 44 | public List getItems() { 45 | return items == null ? Collections.emptyList() : items; 46 | } 47 | 48 | public String getNextMarker() { 49 | return TextUtils.isEmpty(nextMarker) ? "" : nextMarker; 50 | } 51 | 52 | public String getFileId() { 53 | return TextUtils.isEmpty(fileId) ? "" : fileId; 54 | } 55 | 56 | public String getName() { 57 | return TextUtils.isEmpty(name) ? "" : name; 58 | } 59 | 60 | public String getType() { 61 | return TextUtils.isEmpty(type) ? "" : type; 62 | } 63 | 64 | public String getExt() { 65 | return TextUtils.isEmpty(fileExtension) ? "" : fileExtension; 66 | } 67 | 68 | public String getCategory() { 69 | return TextUtils.isEmpty(category) ? "" : category; 70 | } 71 | 72 | public String getSize() { 73 | return size == 0 ? "" : "[" + Util.getSize(size) + "]"; 74 | } 75 | 76 | public String getParent() { 77 | return TextUtils.isEmpty(parent) ? "" : "[" + parent + "]"; 78 | } 79 | 80 | public Item parent(String parent) { 81 | this.parent = parent; 82 | return this; 83 | } 84 | 85 | public String getDisplayName() { 86 | return TextUtils.join(" ", Arrays.asList(getParent(), getName(), getSize())).trim(); 87 | } 88 | 89 | public String getSortName() { 90 | return TextUtils.join(" ", Arrays.asList(getParent(), Util.getDigit(getName()))).trim(); 91 | } 92 | 93 | @Override 94 | public int compareTo(Item item) { 95 | return getSortName().compareTo(item.getSortName()); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/OAuth.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class OAuth { 9 | 10 | @SerializedName("token_type") 11 | private String tokenType; 12 | @SerializedName("access_token") 13 | private String accessToken; 14 | @SerializedName("refresh_token") 15 | private String refreshToken; 16 | 17 | public static OAuth objectFrom(String str) { 18 | OAuth item = new Gson().fromJson(str, OAuth.class); 19 | return item == null ? new OAuth() : item; 20 | } 21 | 22 | public String getTokenType() { 23 | return TextUtils.isEmpty(tokenType) ? "" : tokenType; 24 | } 25 | 26 | public String getAccessToken() { 27 | return TextUtils.isEmpty(accessToken) ? "" : accessToken; 28 | } 29 | 30 | public String getRefreshToken() { 31 | return TextUtils.isEmpty(refreshToken) ? "" : refreshToken; 32 | } 33 | 34 | public String getAuthorization() { 35 | return getTokenType() + " " + getAccessToken(); 36 | } 37 | 38 | public void clean() { 39 | this.refreshToken = ""; 40 | this.accessToken = ""; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Preview.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.bean.Sub; 6 | import com.google.gson.Gson; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | public class Preview { 13 | 14 | @SerializedName("video_preview_play_info") 15 | private Info videoPreviewPlayInfo; 16 | @SerializedName("drive_id") 17 | private String driveId; 18 | @SerializedName("file_id") 19 | private String fileId; 20 | 21 | public static Preview objectFrom(String str) { 22 | return new Gson().fromJson(str, Preview.class); 23 | } 24 | 25 | public Info getVideoPreviewPlayInfo() { 26 | return videoPreviewPlayInfo == null ? new Info() : videoPreviewPlayInfo; 27 | } 28 | 29 | public String getDriveId() { 30 | return TextUtils.isEmpty(driveId) ? "" : driveId; 31 | } 32 | 33 | public String getFileId() { 34 | return TextUtils.isEmpty(fileId) ? "" : fileId; 35 | } 36 | 37 | public static class Info { 38 | 39 | @SerializedName("live_transcoding_task_list") 40 | private List liveTranscodingTaskList; 41 | @SerializedName("live_transcoding_subtitle_task_list") 42 | private List liveTranscodingSubtitleTaskList; 43 | 44 | public List getLiveTranscodingTaskList() { 45 | return liveTranscodingTaskList == null ? Collections.emptyList() : liveTranscodingTaskList; 46 | } 47 | 48 | public List getLiveTranscodingSubtitleTaskList() { 49 | return liveTranscodingSubtitleTaskList == null ? Collections.emptyList() : liveTranscodingSubtitleTaskList; 50 | } 51 | } 52 | 53 | public static class LiveTranscodingTask { 54 | 55 | @SerializedName("template_id") 56 | private String templateId; 57 | @SerializedName("language") 58 | private String language; 59 | @SerializedName("status") 60 | private String status; 61 | @SerializedName("url") 62 | private String url; 63 | 64 | public String getTemplateId() { 65 | return TextUtils.isEmpty(templateId) ? "" : templateId; 66 | } 67 | 68 | public String getLanguage() { 69 | return TextUtils.isEmpty(language) ? "" : language; 70 | } 71 | 72 | public String getStatus() { 73 | return TextUtils.isEmpty(status) ? "" : status; 74 | } 75 | 76 | public String getUrl() { 77 | return TextUtils.isEmpty(url) ? "" : url; 78 | } 79 | 80 | public Sub getSub() { 81 | return Sub.create().url(getUrl()).name(getLanguage()).lang(getLanguage()).ext("vtt"); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/Resp.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | public class Resp { 12 | 13 | @SerializedName("responses") 14 | private List responses; 15 | @SerializedName("body") 16 | private Body body; 17 | @SerializedName("id") 18 | private String id; 19 | @SerializedName("status") 20 | private int status; 21 | 22 | public static Resp objectFrom(String str) { 23 | return new Gson().fromJson(str, Resp.class); 24 | } 25 | 26 | public List getResponses() { 27 | return responses == null ? Collections.emptyList() : responses; 28 | } 29 | 30 | public Resp getResponse() { 31 | return getResponses().isEmpty() ? new Resp() : getResponses().get(0); 32 | } 33 | 34 | public Body getBody() { 35 | return body == null ? new Body() : body; 36 | } 37 | 38 | public String getId() { 39 | return TextUtils.isEmpty(id) ? "" : id; 40 | } 41 | 42 | public int getStatus() { 43 | return status; 44 | } 45 | 46 | public static class Body { 47 | 48 | @SerializedName("domain_id") 49 | private String domainId; 50 | @SerializedName("drive_id") 51 | private String driveId; 52 | @SerializedName("file_id") 53 | private String fileId; 54 | @SerializedName("code") 55 | private String code; 56 | @SerializedName("message") 57 | private String message; 58 | 59 | public String getDomainId() { 60 | return TextUtils.isEmpty(domainId) ? "" : domainId; 61 | } 62 | 63 | public String getDriveId() { 64 | return TextUtils.isEmpty(driveId) ? "" : driveId; 65 | } 66 | 67 | public String getFileId() { 68 | return TextUtils.isEmpty(fileId) ? "" : fileId; 69 | } 70 | 71 | public String getCode() { 72 | return TextUtils.isEmpty(code) ? "" : code; 73 | } 74 | 75 | public String getMessage() { 76 | return TextUtils.isEmpty(message) ? "" : message; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/ali/User.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.ali; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class User { 9 | 10 | @SerializedName("token_type") 11 | private String tokenType; 12 | @SerializedName("access_token") 13 | private String accessToken; 14 | @SerializedName("refresh_token") 15 | private String refreshToken; 16 | 17 | public static User objectFrom(String str) { 18 | User item = new Gson().fromJson(str, User.class); 19 | return item == null ? new User() : item; 20 | } 21 | 22 | public String getTokenType() { 23 | return TextUtils.isEmpty(tokenType) ? "" : tokenType; 24 | } 25 | 26 | public String getAccessToken() { 27 | return TextUtils.isEmpty(accessToken) ? "" : accessToken; 28 | } 29 | 30 | public String getRefreshToken() { 31 | return TextUtils.isEmpty(refreshToken) ? "" : refreshToken; 32 | } 33 | 34 | public void setRefreshToken(String refreshToken) { 35 | this.refreshToken = refreshToken; 36 | } 37 | 38 | public String getAuthorization() { 39 | return getTokenType() + " " + getAccessToken(); 40 | } 41 | 42 | public boolean isAuthed() { 43 | return getTokenType().length() > 0 && getAccessToken().length() > 0; 44 | } 45 | 46 | public void clean() { 47 | this.refreshToken = ""; 48 | this.accessToken = ""; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/alist/Login.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.alist; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Login { 8 | 9 | @SerializedName("username") 10 | private String username; 11 | @SerializedName("password") 12 | private String password; 13 | 14 | public String getUsername() { 15 | return TextUtils.isEmpty(username) ? "" : username; 16 | } 17 | 18 | public String getPassword() { 19 | return TextUtils.isEmpty(password) ? "" : password; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/alist/Param.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.alist; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Param { 8 | 9 | @SerializedName("path") 10 | private String path; 11 | @SerializedName("pass") 12 | private String pass; 13 | 14 | public String getPath() { 15 | return TextUtils.isEmpty(path) ? "" : path; 16 | } 17 | 18 | public String getPass() { 19 | return TextUtils.isEmpty(pass) ? "" : pass; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/alist/Sorter.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.alist; 2 | 3 | import java.util.Collections; 4 | import java.util.Comparator; 5 | import java.util.List; 6 | 7 | public class Sorter implements Comparator { 8 | 9 | private final String type; 10 | private final String order; 11 | 12 | public static void sort(String type, String order, List items) { 13 | Collections.sort(items, new Sorter(type, order)); 14 | } 15 | 16 | public Sorter(String type, String order) { 17 | this.type = type; 18 | this.order = order; 19 | } 20 | 21 | @Override 22 | public int compare(Item o1, Item o2) { 23 | boolean asc = order.equals("asc"); 24 | switch (type) { 25 | case "name": 26 | return asc ? o1.getName().compareTo(o2.getName()) : o2.getName().compareTo(o1.getName()); 27 | case "size": 28 | return asc ? Long.compare(o1.getSize(), o2.getSize()) : Long.compare(o2.getSize(), o1.getSize()); 29 | case "date": 30 | return asc ? o1.getDate().compareTo(o2.getDate()) : o2.getDate().compareTo(o1.getDate()); 31 | default: 32 | return -1; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Dash.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.Collections; 7 | import java.util.List; 8 | 9 | public class Dash { 10 | 11 | @SerializedName("duration") 12 | private String duration; 13 | @SerializedName("minBufferTime") 14 | private String minBufferTime; 15 | @SerializedName("video") 16 | private List video; 17 | @SerializedName("audio") 18 | private List audio; 19 | 20 | public static Dash objectFrom(String str) { 21 | return new Gson().fromJson(str, Dash.class); 22 | } 23 | 24 | public String getDuration() { 25 | return duration == null ? "0" : duration; 26 | } 27 | 28 | public String getMinBufferTime() { 29 | return minBufferTime == null ? "0" : minBufferTime; 30 | } 31 | 32 | public List getVideo() { 33 | return video == null ? Collections.emptyList() : video; 34 | } 35 | 36 | public List getAudio() { 37 | return audio == null ? Collections.emptyList() : audio; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Data.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.JsonElement; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | public class Data { 12 | 13 | @SerializedName("result") 14 | private JsonElement result; 15 | @SerializedName("list") 16 | private JsonElement list; 17 | @SerializedName("isLogin") 18 | private Boolean isLogin; 19 | @SerializedName("vipStatus") 20 | private Integer vipStatus; 21 | @SerializedName("qrcode_key") 22 | private String qrcodeKey; 23 | @SerializedName("url") 24 | private String url; 25 | @SerializedName("aid") 26 | private String aid; 27 | @SerializedName("cid") 28 | private String cid; 29 | @SerializedName("title") 30 | private String title; 31 | @SerializedName("tname") 32 | private String tname; 33 | @SerializedName("pic") 34 | private String pic; 35 | @SerializedName("duration") 36 | private Long duration; 37 | @SerializedName("desc") 38 | private String desc; 39 | @SerializedName("accept_description") 40 | private List acceptDescription; 41 | @SerializedName("accept_quality") 42 | private List acceptQuality; 43 | @SerializedName("pages") 44 | private List pages; 45 | @SerializedName("dash") 46 | private Dash dash; 47 | @SerializedName("owner") 48 | private Owner owner; 49 | @SerializedName("wbi_img") 50 | private Wbi wbi; 51 | 52 | public JsonElement getResult() { 53 | return result; 54 | } 55 | 56 | public JsonElement getList() { 57 | return list; 58 | } 59 | 60 | public boolean isLogin() { 61 | return isLogin != null && isLogin; 62 | } 63 | 64 | public Integer getVipStatus() { 65 | return vipStatus; 66 | } 67 | 68 | public boolean isVip() { 69 | return vipStatus != null && vipStatus != 0; 70 | } 71 | 72 | public String getQrcodeKey() { 73 | return TextUtils.isEmpty(qrcodeKey) ? "" : qrcodeKey; 74 | } 75 | 76 | public String getUrl() { 77 | return TextUtils.isEmpty(url) ? "" : url; 78 | } 79 | 80 | public String getAid() { 81 | return TextUtils.isEmpty(aid) ? "" : aid; 82 | } 83 | 84 | public String getCid() { 85 | return TextUtils.isEmpty(cid) ? "" : cid; 86 | } 87 | 88 | public String getTitle() { 89 | return TextUtils.isEmpty(title) ? "" : title; 90 | } 91 | 92 | public String getType() { 93 | return TextUtils.isEmpty(tname) ? "" : tname; 94 | } 95 | 96 | public String getPic() { 97 | return TextUtils.isEmpty(pic) ? "" : pic; 98 | } 99 | 100 | public Long getDuration() { 101 | return duration == null ? 0 : duration; 102 | } 103 | 104 | public String getDesc() { 105 | return TextUtils.isEmpty(desc) ? "" : desc; 106 | } 107 | 108 | public List getAcceptDescription() { 109 | return acceptDescription == null ? Collections.emptyList() : acceptDescription; 110 | } 111 | 112 | public List getAcceptQuality() { 113 | return acceptQuality == null ? Collections.emptyList() : acceptQuality; 114 | } 115 | 116 | public List getPages() { 117 | return pages == null ? Collections.emptyList() : pages; 118 | } 119 | 120 | public Dash getDash() { 121 | return dash == null ? new Dash() : dash; 122 | } 123 | 124 | public Owner getOwner() { 125 | return owner == null ? new Owner() : owner; 126 | } 127 | 128 | public Wbi getWbi() { 129 | return wbi == null ? new Wbi() : wbi; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Media.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class Media { 6 | 7 | @SerializedName("id") 8 | private String id; 9 | @SerializedName("baseUrl") 10 | private String baseUrl; 11 | @SerializedName("bandwidth") 12 | private String bandwidth; 13 | @SerializedName("mimeType") 14 | private String mimeType; 15 | @SerializedName("codecs") 16 | private String codecs; 17 | @SerializedName("width") 18 | private String width; 19 | @SerializedName("height") 20 | private String height; 21 | @SerializedName("frameRate") 22 | private String frameRate; 23 | @SerializedName("sar") 24 | private String sar; 25 | @SerializedName("startWithSap") 26 | private String startWithSap; 27 | @SerializedName("SegmentBase") 28 | private Segment segmentBase; 29 | @SerializedName("codecid") 30 | private String codecid; 31 | 32 | public String getId() { 33 | return id; 34 | } 35 | 36 | public String getBaseUrl() { 37 | return baseUrl; 38 | } 39 | 40 | public String getBandWidth() { 41 | return bandwidth; 42 | } 43 | 44 | public String getMimeType() { 45 | return mimeType; 46 | } 47 | 48 | public String getCodecs() { 49 | return codecs; 50 | } 51 | 52 | public String getWidth() { 53 | return width; 54 | } 55 | 56 | public String getHeight() { 57 | return height; 58 | } 59 | 60 | public String getFrameRate() { 61 | return frameRate; 62 | } 63 | 64 | public String getSar() { 65 | return sar; 66 | } 67 | 68 | public String getStartWithSap() { 69 | return startWithSap; 70 | } 71 | 72 | public Segment getSegmentBase() { 73 | return segmentBase; 74 | } 75 | 76 | public String getCodecId() { 77 | return codecid; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Owner.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Owner { 8 | 9 | @SerializedName("mid") 10 | private String mid; 11 | @SerializedName("name") 12 | private String name; 13 | 14 | public String getMid() { 15 | return TextUtils.isEmpty(mid) ? "" : mid; 16 | } 17 | 18 | public String getName() { 19 | return TextUtils.isEmpty(name) ? "" : name; 20 | } 21 | 22 | public String getFormat() { 23 | return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", getMid() + "/{pg}", getName(), getName()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Page.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Page { 8 | 9 | @SerializedName("cid") 10 | private String cid; 11 | @SerializedName("part") 12 | private String part; 13 | 14 | public String getCid() { 15 | return TextUtils.isEmpty(cid) ? "" : cid; 16 | } 17 | 18 | public String getPart() { 19 | return TextUtils.isEmpty(part) ? "" : part.replace("#", ""); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Resp.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.bean.Vod; 6 | import com.google.gson.Gson; 7 | import com.google.gson.JsonElement; 8 | import com.google.gson.annotations.SerializedName; 9 | import com.google.gson.reflect.TypeToken; 10 | 11 | import org.jsoup.Jsoup; 12 | 13 | import java.lang.reflect.Type; 14 | import java.util.List; 15 | 16 | public class Resp { 17 | 18 | @SerializedName("code") 19 | private Integer code; 20 | @SerializedName("message") 21 | private String message; 22 | @SerializedName("data") 23 | private Data data; 24 | 25 | public static Resp objectFrom(String str) { 26 | return new Gson().fromJson(str, Resp.class); 27 | } 28 | 29 | public Data getData() { 30 | return data == null ? new Data() : data; 31 | } 32 | 33 | public static class Result { 34 | 35 | @SerializedName("bvid") 36 | private String bvid; 37 | @SerializedName("aid") 38 | private String aid; 39 | @SerializedName("title") 40 | private String title; 41 | @SerializedName("pic") 42 | private String pic; 43 | @SerializedName("duration") 44 | private String duration; 45 | @SerializedName("length") 46 | private String length; 47 | 48 | public static List arrayFrom(JsonElement str) { 49 | Type listType = new TypeToken>() {}.getType(); 50 | return new Gson().fromJson(str, listType); 51 | } 52 | 53 | public String getBvId() { 54 | return TextUtils.isEmpty(bvid) ? "" : bvid; 55 | } 56 | 57 | public String getAid() { 58 | return TextUtils.isEmpty(aid) ? "" : aid; 59 | } 60 | 61 | public String getTitle() { 62 | return TextUtils.isEmpty(title) ? "" : title; 63 | } 64 | 65 | public String getDuration() { 66 | if (TextUtils.isEmpty(duration)) return getLength(); 67 | if (duration.contains(":")) return duration.split(":")[0] + "分鐘"; 68 | if (Integer.parseInt(duration) < 60) return duration + "秒"; 69 | return Integer.parseInt(duration) / 60 + "分鐘"; 70 | } 71 | 72 | public String getLength() { 73 | return TextUtils.isEmpty(length) ? "" : length; 74 | } 75 | 76 | public String getPic() { 77 | return TextUtils.isEmpty(pic) ? "" : pic; 78 | } 79 | 80 | public Vod getVod() { 81 | Vod vod = new Vod(); 82 | vod.setVodId(getBvId() + "@" + getAid()); 83 | vod.setVodName(Jsoup.parse(getTitle()).text()); 84 | vod.setVodPic(getPic().startsWith("//") ? "https:" + getPic() : getPic()); 85 | vod.setVodRemarks(getDuration()); 86 | return vod; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Segment.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class Segment { 6 | 7 | @SerializedName("Initialization") 8 | private String initialization; 9 | @SerializedName("indexRange") 10 | private String indexRange; 11 | 12 | public String getInitialization() { 13 | return initialization; 14 | } 15 | 16 | public String getIndexRange() { 17 | return indexRange; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/bili/Wbi.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.bili; 2 | 3 | import android.net.Uri; 4 | import android.text.TextUtils; 5 | 6 | import com.github.catvod.utils.Util; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | import java.net.URLEncoder; 10 | import java.util.LinkedHashMap; 11 | 12 | public class Wbi { 13 | 14 | private final int[] mixinKeyEncTab = new int[]{46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52}; 15 | 16 | @SerializedName("img_url") 17 | private String imgUrl; 18 | @SerializedName("sub_url") 19 | private String subUrl; 20 | 21 | public String getImgUrl() { 22 | return TextUtils.isEmpty(imgUrl) ? "" : imgUrl; 23 | } 24 | 25 | public String getSubUrl() { 26 | return TextUtils.isEmpty(subUrl) ? "" : subUrl; 27 | } 28 | 29 | private String getMixinKey(String imgKey, String subKey) { 30 | String s = imgKey + subKey; 31 | StringBuilder key = new StringBuilder(); 32 | for (int i = 0; i < 32; i++) key.append(s.charAt(mixinKeyEncTab[i])); 33 | return key.toString(); 34 | } 35 | 36 | public String getQuery(LinkedHashMap params) { 37 | String imgKey = Uri.parse(getImgUrl()).getLastPathSegment().split("\\.")[0]; 38 | String subKey = Uri.parse(getSubUrl()).getLastPathSegment().split("\\.")[0]; 39 | String mixinKey = getMixinKey(imgKey, subKey); 40 | StringBuilder sb = new StringBuilder(); 41 | params.put("wts", System.currentTimeMillis() / 1000); 42 | for (String key : params.keySet()) sb.append(key).append("=").append(URLEncoder.encode(params.get(key).toString())).append("&"); 43 | String query = Util.substring(sb.toString()); 44 | String w_rid = Util.MD5(query + mixinKey); 45 | return query + "&w_rid=" + w_rid; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/jianpian/Detail.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.jianpian; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class Detail { 7 | 8 | @SerializedName("data") 9 | private Data data; 10 | 11 | public static Detail objectFrom(String str) { 12 | return new Gson().fromJson(str, Detail.class); 13 | } 14 | 15 | public Data getData() { 16 | return data == null ? new Data() : data; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/jianpian/Resp.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.jianpian; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.Collections; 7 | import java.util.List; 8 | 9 | public class Resp { 10 | 11 | @SerializedName("data") 12 | private List data; 13 | 14 | public static Resp objectFrom(String str) { 15 | return new Gson().fromJson(str, Resp.class); 16 | } 17 | 18 | public List getData() { 19 | return data == null ? Collections.emptyList() : data; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/market/Data.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.market; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.bean.Class; 6 | import com.github.catvod.bean.Vod; 7 | import com.google.gson.Gson; 8 | import com.google.gson.annotations.SerializedName; 9 | import com.google.gson.reflect.TypeToken; 10 | 11 | import java.lang.reflect.Type; 12 | import java.util.ArrayList; 13 | import java.util.Collections; 14 | import java.util.List; 15 | 16 | public class Data { 17 | 18 | @SerializedName("name") 19 | private String name; 20 | @SerializedName("list") 21 | private List list; 22 | 23 | public static List arrayFrom(String str) { 24 | Type listType = new TypeToken>() {}.getType(); 25 | return new Gson().fromJson(str, listType); 26 | } 27 | 28 | public String getName() { 29 | return TextUtils.isEmpty(name) ? "" : name; 30 | } 31 | 32 | public List getList() { 33 | return list == null ? Collections.emptyList() : list; 34 | } 35 | 36 | public List getVod() { 37 | List vodList = new ArrayList<>(); 38 | for (Item item : getList()) vodList.add(item.vod()); 39 | return vodList; 40 | } 41 | 42 | public Class type() { 43 | return new Class(getName(), getName()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/market/Item.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.market; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.bean.Vod; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Item { 9 | 10 | @SerializedName("name") 11 | private String name; 12 | @SerializedName("url") 13 | private String url; 14 | @SerializedName("icon") 15 | private String icon; 16 | @SerializedName("copy") 17 | private String copy; 18 | @SerializedName("version") 19 | private String version; 20 | 21 | public Item(String url) { 22 | this.url = url; 23 | } 24 | 25 | public String getName() { 26 | return TextUtils.isEmpty(name) ? "" : name; 27 | } 28 | 29 | public String getUrl() { 30 | return TextUtils.isEmpty(url) ? "" : url; 31 | } 32 | 33 | public String getIcon() { 34 | return TextUtils.isEmpty(icon) ? "" : icon; 35 | } 36 | 37 | public String getCopy() { 38 | return TextUtils.isEmpty(copy) ? "" : copy; 39 | } 40 | 41 | public String getVersion() { 42 | return TextUtils.isEmpty(version) ? "" : version; 43 | } 44 | 45 | public Vod vod() { 46 | return new Vod("", getName(), getIcon(), getVersion(), Vod.Style.rect(1.0f), getUrl()); 47 | } 48 | 49 | @Override 50 | public boolean equals(Object obj) { 51 | if (this == obj) return true; 52 | if (!(obj instanceof Item)) return false; 53 | Item it = (Item) obj; 54 | return getUrl().equals(it.getUrl()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/quark/Cache.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.quark; 2 | 3 | import com.github.catvod.api.QuarkApi; 4 | import com.github.catvod.spider.Init; 5 | import com.github.catvod.utils.Path; 6 | import com.google.gson.Gson; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | public class Cache { 10 | 11 | @SerializedName("user") 12 | private User user; 13 | 14 | 15 | public static Cache objectFrom(String str) { 16 | Cache item = new Gson().fromJson(str, Cache.class); 17 | return item == null ? new Cache() : item; 18 | } 19 | 20 | public User getUser() { 21 | return user == null ? new User("") : user; 22 | } 23 | 24 | public void setUser(User user) { 25 | this.user = user; 26 | this.save(); 27 | } 28 | 29 | 30 | public void save() { 31 | Init.execute(() -> Path.write(QuarkApi.get().getCache(), toString())); 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return new Gson().toJson(this); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/quark/ShareData.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.quark; 2 | 3 | public class ShareData { 4 | private String shareId; 5 | private String folderId; 6 | private String sharePwd ; 7 | 8 | public ShareData(String shareId, String folderId) { 9 | this.shareId = shareId; 10 | this.folderId = folderId; 11 | } 12 | 13 | public String getSharePwd() { 14 | return sharePwd; 15 | } 16 | 17 | public void setSharePwd(String sharePwd) { 18 | this.sharePwd = sharePwd; 19 | } 20 | 21 | public String getShareId() { 22 | return shareId; 23 | } 24 | 25 | public void setShareId(String shareId) { 26 | this.shareId = shareId; 27 | } 28 | 29 | public String getFolderId() { 30 | return folderId; 31 | } 32 | 33 | public void setFolderId(String folderId) { 34 | this.folderId = folderId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/quark/User.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.quark; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class User { 6 | public User(String cookie) { 7 | this.cookie = cookie; 8 | } 9 | 10 | @SerializedName("cookie") 11 | private String cookie; 12 | 13 | public String getCookie() { 14 | return cookie; 15 | } 16 | 17 | public void setCookie(String cookie) { 18 | this.cookie = cookie; 19 | } 20 | 21 | public static User objectFrom(String cookie) { 22 | return new User(cookie); 23 | } 24 | 25 | 26 | public void clean() { 27 | this.cookie = ""; 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/star/Card.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.star; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.github.catvod.bean.Vod; 6 | import com.google.gson.Gson; 7 | import com.google.gson.annotations.SerializedName; 8 | import com.google.gson.reflect.TypeToken; 9 | 10 | import java.lang.reflect.Type; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class Card { 15 | 16 | @SerializedName("name") 17 | private String name; 18 | @SerializedName(value = "img", alternate = "picurl") 19 | private String img; 20 | @SerializedName("id") 21 | private String id; 22 | @SerializedName("countStr") 23 | private String countStr; 24 | @SerializedName("url") 25 | private String url; 26 | @SerializedName("cards") 27 | private List cards; 28 | 29 | public static List arrayFrom(String str) { 30 | Type listType = new TypeToken>() {}.getType(); 31 | return new Gson().fromJson(str, listType); 32 | } 33 | 34 | public String getName() { 35 | return TextUtils.isEmpty(name) ? "" : name; 36 | } 37 | 38 | public String getImg() { 39 | return TextUtils.isEmpty(img) ? "" : img; 40 | } 41 | 42 | public String getId() { 43 | return TextUtils.isEmpty(id) ? "" : id; 44 | } 45 | 46 | public String getCountStr() { 47 | return TextUtils.isEmpty(countStr) ? "" : countStr; 48 | } 49 | 50 | public String getUrl() { 51 | return TextUtils.isEmpty(url) ? "" : url; 52 | } 53 | 54 | public List getCards() { 55 | return cards == null ? Collections.emptyList() : cards; 56 | } 57 | 58 | public Vod vod() { 59 | return new Vod(getId(), getName(), getImg(), getCountStr()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/star/Condition.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.star; 2 | 3 | import com.github.catvod.bean.Filter; 4 | import com.google.gson.Gson; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | public class Condition { 12 | 13 | @SerializedName("label") 14 | private List> label; 15 | @SerializedName("country") 16 | private List country; 17 | @SerializedName("time") 18 | private List time; 19 | 20 | public static Condition objectFrom(String str) { 21 | return new Gson().fromJson(str, Condition.class); 22 | } 23 | 24 | public List> getLabel() { 25 | return label == null ? Collections.emptyList() : label; 26 | } 27 | 28 | public List getCountry() { 29 | return country == null ? Collections.emptyList() : country; 30 | } 31 | 32 | public List getTime() { 33 | return time == null ? Collections.emptyList() : time; 34 | } 35 | 36 | public List getFilter() { 37 | List filters = new ArrayList<>(); 38 | filters.add(new Filter("type", "類型", getTypeValues())); 39 | filters.add(new Filter("area", "地區", getAreaValues())); 40 | filters.add(new Filter("year", "年份", getYearValues())); 41 | return filters; 42 | } 43 | 44 | private List getTypeValues() { 45 | List values = new ArrayList<>(); 46 | values.add(new Filter.Value("全部", "")); 47 | for (List list : getLabel()) values.add(new Filter.Value(list.get(0))); 48 | return values; 49 | } 50 | 51 | private List getAreaValues() { 52 | List values = new ArrayList<>(); 53 | values.add(new Filter.Value("全部", "")); 54 | for (String text : getCountry()) values.add(new Filter.Value(text)); 55 | return values; 56 | } 57 | 58 | private List getYearValues() { 59 | List values = new ArrayList<>(); 60 | values.add(new Filter.Value("全部", "")); 61 | Collections.sort(getTime(), Collections.reverseOrder()); 62 | for (Integer year : getTime()) if (year >= 2010) values.add(new Filter.Value(String.valueOf(year))); 63 | return values; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/catvod/bean/star/Group.java: -------------------------------------------------------------------------------- 1 | package com.github.catvod.bean.star; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | public class Group { 11 | 12 | @SerializedName("name") 13 | private String name; 14 | @SerializedName("videos") 15 | private List