changed IndexSubtitle domain (#125)

This commit is contained in:
Hexated 2022-09-30 17:58:49 +07:00 committed by GitHub
parent fd0fb969b2
commit 365d470f82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View file

@ -37,7 +37,7 @@ abstract class AccountManager(private val defIndex: Int) : AuthAPI {
val subtitleProviders val subtitleProviders
get() = listOf( get() = listOf(
openSubtitlesApi, openSubtitlesApi,
// indexSubtitlesApi // they got anti scraping measures in place :( indexSubtitlesApi // they got anti scraping measures in place :(
) )
const val appString = "cloudstreamapp" const val appString = "cloudstreamapp"

View file

@ -20,10 +20,9 @@ class IndexSubtitleApi : AbstractSubApi {
override fun logOut() {} override fun logOut() {}
private val interceptor = CloudflareKiller()
companion object { companion object {
const val host = "https://indexsubtitle.com" const val host = "https://subscene.cyou"
const val TAG = "INDEXSUBS" const val TAG = "INDEXSUBS"
} }
@ -126,16 +125,15 @@ class IndexSubtitleApi : AbstractSubApi {
epNumber = epNum, epNumber = epNum,
seasonNumber = seasonNum, seasonNumber = seasonNum,
year = yearNum, year = yearNum,
headers = interceptor.getCookieHeaders(link).toMap()
) )
) )
} }
val document = app.get("$host/?search=$queryText", interceptor = interceptor).document val document = app.get("$host/?search=$queryText").document
document.select("div.my-3.p-3 div.media").map { block -> document.select("div.my-3.p-3 div.media").map { block ->
if (seasonNum > 0) { if (seasonNum > 0) {
val name = block.select("strong.text-primary").text().trim() val name = block.select("strong.text-primary, strong.text-info").text().trim()
val season = getOrdinal(seasonNum) val season = getOrdinal(seasonNum)
if ((block.selectFirst("a")?.attr("href") if ((block.selectFirst("a")?.attr("href")
?.contains( ?.contains(
@ -163,7 +161,7 @@ class IndexSubtitleApi : AbstractSubApi {
val urlItem = fixUrl( val urlItem = fixUrl(
it.selectFirst("a")!!.attr("href") it.selectFirst("a")!!.attr("href")
) )
val itemDoc = app.get(urlItem, interceptor = interceptor).document val itemDoc = app.get(urlItem).document
val id = imdbUrlToIdNullable( val id = imdbUrlToIdNullable(
itemDoc.selectFirst("div.d-flex span.badge.badge-primary")?.parent() itemDoc.selectFirst("div.d-flex span.badge.badge-primary")?.parent()
?.attr("href") ?.attr("href")
@ -202,14 +200,14 @@ class IndexSubtitleApi : AbstractSubApi {
val results = mutableListOf<AbstractSubtitleEntities.SubtitleEntity>() val results = mutableListOf<AbstractSubtitleEntities.SubtitleEntity>()
urlItems.forEach { url -> urlItems.forEach { url ->
val request = app.get(url, interceptor = interceptor) val request = app.get(url)
if (request.isSuccessful) { if (request.isSuccessful) {
request.document.select("div.my-3.p-3 div.media").map { block -> request.document.select("div.my-3.p-3 div.media").map { block ->
if (block.select("span.d-block span[data-original-title=Language]").text() if (block.select("span.d-block span[data-original-title=Language]").text()
.trim() .trim()
.contains("$queryLang") .contains("$queryLang")
) { ) {
var name = block.select("strong.text-primary").text().trim() var name = block.select("strong.text-primary, strong.text-info").text().trim()
val link = fixUrl(block.selectFirst("a")!!.attr("href")) val link = fixUrl(block.selectFirst("a")!!.attr("href"))
if (seasonNum > 0) { if (seasonNum > 0) {
when { when {
@ -235,7 +233,7 @@ class IndexSubtitleApi : AbstractSubApi {
val seasonNum = data.seasonNumber val seasonNum = data.seasonNumber
val epNum = data.epNumber val epNum = data.epNumber
val req = app.get(data.data, interceptor = interceptor) val req = app.get(data.data)
if (req.isSuccessful) { if (req.isSuccessful) {
val document = req.document val document = req.document