From 03eb17149f3c9bd03b630dd25fe13d8cfcf94ef5 Mon Sep 17 00:00:00 2001 From: Jace <54625750+Jacekun@users.noreply.github.com> Date: Sat, 1 Oct 2022 21:06:39 +0800 Subject: [PATCH] [Extractor] AStreamHub (#129) --- .../cloudstream3/extractors/AStreamHub.kt | 39 +++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 1 + 2 files changed, 40 insertions(+) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/AStreamHub.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/AStreamHub.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/AStreamHub.kt new file mode 100644 index 00000000..18602664 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/AStreamHub.kt @@ -0,0 +1,39 @@ +package com.lagradost.cloudstream3.extractors + +import android.util.Log +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.base64Decode +import com.lagradost.cloudstream3.utils.* + +class AStreamHub : ExtractorApi() { + override val name = "AStreamHub" + override val mainUrl = "https://astreamhub.com" + override val requiresReferer = true + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + app.get(url).document.selectFirst("body > script").let { script -> + val text = script?.html() ?: "" + Log.i("Dev", "text => $text") + if (text.isNotBlank()) { + val m3link = "(?<=file:)(.*)(?=,)".toRegex().find(text) + ?.groupValues?.get(0)?.trim()?.trim('"') ?: "" + Log.i("Dev", "m3link => $m3link") + if (m3link.isNotBlank()) { + sources.add( + ExtractorLink( + name = name, + source = name, + url = m3link, + isM3u8 = true, + quality = Qualities.Unknown.value, + referer = referer ?: url + ) + ) + } + } + } + return sources + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index b5c2cd44..199f0398 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -344,6 +344,7 @@ val extractorApis: MutableList = arrayListOf( VidSrcExtractor(), VidSrcExtractor2(), PlayLtXyz(), + AStreamHub(), )