@@ -8,6 +8,7 @@ import android.text.SpannableString
8
8
import android.text.Spanned
9
9
import androidx.preference.ListPreference
10
10
import androidx.preference.PreferenceScreen
11
+ import eu.kanade.tachiyomi.animeextension.all.pornhub.extractors.PhCdnExtractor
11
12
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
12
13
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
13
14
import eu.kanade.tachiyomi.animesource.model.SAnime
@@ -92,21 +93,7 @@ class Pornhub : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
92
93
@OptIn(ExperimentalSerializationApi ::class )
93
94
override fun videoListParse (response : Response ): List <Video > {
94
95
val url = response.request.url.toString()
95
- val videoList = mutableListOf<Video >()
96
- // credits to: https://github.com/Joel2B
97
- val document = client.newCall(GET (" https://appsdev.cyou/xv-ph-rt/api/?data=$url " )).execute().asJsoup().body().text()
98
- val jsonResponse = json.decodeFromString<PornApiResponse >(document)
99
-
100
- return listOf (
101
- Video (jsonResponse.hls!! .all!! , " HLS: ALL" , jsonResponse.hls!! .all),
102
- Video (jsonResponse.hls!! .low!! , " HLS: LOW" , jsonResponse.hls!! .low),
103
- Video (jsonResponse.hls!! .hd!! , " HLS: HD" , jsonResponse.hls!! .hd),
104
- Video (jsonResponse.hls!! .fhd!! , " HLS: FHD" , jsonResponse.hls!! .fhd),
105
- Video (jsonResponse.mp4!! .low!! , " MP4: LOW" , jsonResponse.mp4!! .low),
106
- Video (jsonResponse.mp4!! .sd!! , " MP4: SD" , jsonResponse.mp4!! .sd),
107
- Video (jsonResponse.mp4!! .hd!! , " MP4: HD" , jsonResponse.mp4!! .hd),
108
- Video (jsonResponse.mp4!! .fhd!! , " MP4: FHD" , jsonResponse.mp4!! .fhd)
109
- ).filter { it.url.isNotBlank() }
96
+ return PhCdnExtractor (client).videoFromUrl(url)
110
97
}
111
98
112
99
override fun videoListSelector () = throw Exception (" not used" )
@@ -116,7 +103,7 @@ class Pornhub : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
116
103
override fun videoFromElement (element : Element ) = throw Exception (" not used" )
117
104
118
105
override fun List<Video>.sort (): List <Video > {
119
- val quality = preferences.getString(" preferred_quality" , " 720p " )
106
+ val quality = preferences.getString(" preferred_quality" , " 480p " )
120
107
if (quality != null ) {
121
108
val newList = mutableListOf<Video >()
122
109
var preferred = 0
@@ -176,7 +163,7 @@ class Pornhub : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
176
163
title = " Preferred quality"
177
164
entries = arrayOf(" 1080p" , " 720p" , " 480p" , " 240p" )
178
165
entryValues = arrayOf(" 1080p" , " 720p" , " 480p" , " 240p" )
179
- setDefaultValue(" 1080p " )
166
+ setDefaultValue(" 480p " )
180
167
summary = " %s"
181
168
182
169
setOnPreferenceChangeListener { _, newValue ->
@@ -189,33 +176,6 @@ class Pornhub : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
189
176
screen.addPreference(videoQualityPref)
190
177
}
191
178
192
- @Serializable
193
- data class PornApiResponse (
194
- var hls : Hls ? = Hls (),
195
- var mp4 : Mp4 ? = Mp4 (),
196
- var thumb : String? = null ,
197
- var thumbnails : String? = null
198
-
199
- )
200
-
201
- @Serializable
202
- data class Hls (
203
- var all : String? = " " ,
204
- @SerialName(" 1080p" ) var fhd : String? = " " ,
205
- @SerialName(" 720p" ) var hd : String? = " " ,
206
- @SerialName(" 480p" ) var sd : String? = " " ,
207
- @SerialName(" 240p" ) var low : String? = " "
208
-
209
- )
210
-
211
- @Serializable
212
- data class Mp4 (
213
- @SerialName(" 1080p" ) var fhd : String? = " " ,
214
- @SerialName(" 720p" ) var hd : String? = " " ,
215
- @SerialName(" 480p" ) var sd : String? = " " ,
216
- @SerialName(" 240p" ) var low : String? = " "
217
- )
218
-
219
179
@Serializable
220
180
data class VideoDetail (
221
181
@SerialName(" @context" ) var context : String? = null ,
0 commit comments