This commit is contained in:
LagradOst 2021-07-23 18:41:37 +02:00
parent be714a9a26
commit 3551cb1c67
17 changed files with 203 additions and 314 deletions

3
.idea/.gitignore vendored
View file

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View file

@ -24,12 +24,12 @@
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
<option name="url" value="https://github.com/psiegman/mvn-repo/raw/master/releases" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://github.com/psiegman/mvn-repo/raw/master/releases" />
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component>
</project>

View file

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -1,31 +1,24 @@
package com.lagradost.cloudstream3.animeproviders
import android.annotation.SuppressLint
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.extractors.Vidstream
import com.lagradost.cloudstream3.utils.getQualityFromName
import khttp.structures.cookie.CookieJar
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import java.util.*
import kotlin.collections.ArrayList
import khttp.structures.cookie.CookieJar
import java.text.SimpleDateFormat
import java.util.*
class TenshiProvider : MainAPI() {
companion object {
var token: String? = null
var cookie: CookieJar? = null
fun getType(t: String): TvType {
if (t.contains("OVA") || t.contains("Special")) return TvType.ONA
else if (t.contains("Movie")) return TvType.Movie
else return TvType.Anime
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
else if (t.contains("Movie")) TvType.Movie
else TvType.Anime
}
}
@ -43,9 +36,7 @@ class TenshiProvider : MainAPI() {
private fun loadToken(): Boolean {
return try {
val response = khttp.get(
"https://tenshi.moe/",
)
val response = khttp.get(mainUrl)
cookie = response.cookies
val document = Jsoup.parse(response.text)
token = document.selectFirst("""meta[name="csrf-token"]""").attr("content")
@ -179,7 +170,7 @@ class TenshiProvider : MainAPI() {
return returnValue
}
override fun load(slug: String): LoadResponse? {
override fun load(slug: String): LoadResponse {
val url = "$mainUrl/anime/${slug}"
val response = khttp.get(url, timeout = 120.0, cookies=mapOf("loop-view" to "thumb"))
@ -189,7 +180,6 @@ class TenshiProvider : MainAPI() {
val japaneseTitle = document.selectFirst("span.value > span[title=\"Japanese\"]")?.parent()?.text()?.trim()
val canonicalTitle = document.selectFirst("header.entry-header > h1.mb-3").text().trim()
val isDubbed = false
val episodeNodes = document.select("li[class*=\"episode\"] > a")
val episodes = ArrayList<AnimeEpisode>(episodeNodes?.map {
@ -212,7 +202,7 @@ class TenshiProvider : MainAPI() {
val (year) = pattern.find(yearText)!!.destructured
val poster = document.selectFirst("img.cover-image")?.attr("src")
val type = document.selectFirst("a[href*=\"https://tenshi.moe/type/\"]")?.text()?.trim()
val type = document.selectFirst("a[href*=\"$mainUrl/type/\"]")?.text()?.trim()
val synopsis = document.selectFirst(".entry-description > .card-body")?.text()?.trim()
val genre = document.select("li.genre.meta-data > span.value").map { it?.text()?.trim().toString() }
@ -232,7 +222,7 @@ class TenshiProvider : MainAPI() {
episodes,
status,
synopsis,
ArrayList(genre) ?: ArrayList(),
ArrayList(genre),
ArrayList(synonyms),
null,
null,

View file

@ -10,7 +10,6 @@ import kotlin.collections.ArrayList
class WcoProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
@ -137,7 +136,7 @@ class WcoProvider : MainAPI() {
return returnValue
}
override fun load(slug: String): LoadResponse? {
override fun load(slug: String): LoadResponse {
val url = "$mainUrl/anime/${slug}"
val response = khttp.get(url, timeout = 120.0)
@ -177,11 +176,11 @@ class WcoProvider : MainAPI() {
canonicalTitle,
"$mainUrl/anime/${slug}",
this.name,
WcoProvider.getType(type ?: ""),
getType(type ?: ""),
poster,
year,
null,
episodes,
if(isDubbed) episodes else null,
if(!isDubbed) episodes else null,
status,
synopsis,
ArrayList(genre),
@ -204,7 +203,7 @@ class WcoProvider : MainAPI() {
}
for (server in servers) {
WcoStream().getUrl(server["link"].toString(), "").forEach {
WcoStream().getSafeUrl(server["link"].toString(), "")?.forEach {
callback.invoke(it)
}
}

View file

@ -1,11 +1,7 @@
package com.lagradost.cloudstream3.utils
import com.lagradost.cloudstream3.utils.extractors.MixDrop
import com.lagradost.cloudstream3.utils.extractors.Mp4Upload
import com.lagradost.cloudstream3.utils.extractors.Shiro
import com.lagradost.cloudstream3.utils.extractors.WcoStream
import com.lagradost.cloudstream3.utils.extractors.StreamTape
import com.lagradost.cloudstream3.utils.extractors.XStreamCdn
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.utils.extractors.*
data class ExtractorLink(
val source: String,
@ -59,7 +55,8 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
Mp4Upload(),
StreamTape(),
MixDrop(),
XStreamCdn()
XStreamCdn(),
StreamSB(),
)
fun getExtractorApiFromName(name: String): ExtractorApi {
@ -82,6 +79,13 @@ abstract class ExtractorApi {
abstract val mainUrl: String
abstract val requiresReferer: Boolean
fun getSafeUrl(url: String, referer: String? = null): List<ExtractorLink>? {
return normalSafeApiCall { getUrl(url, referer) }
}
/**
* Will throw errors, use getSafeUrl if you don't want to handle the exception yourself
*/
abstract fun getUrl(url: String, referer: String? = null): List<ExtractorLink>?
open fun getExtractorUrl(id: String): String {

View file

@ -13,7 +13,6 @@ class MixDrop : ExtractorApi() {
}
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
try {
with(khttp.get(url)) {
getAndUnpack(this.text)?.let { unpackedText ->
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
@ -30,8 +29,5 @@ class MixDrop : ExtractorApi() {
}
}
return null
} catch (e: Exception) {
return null
}
}
}

View file

@ -9,7 +9,6 @@ class Mp4Upload : ExtractorApi() {
override val requiresReferer = true
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
try {
with(khttp.get(url)) {
getAndUnpack(this.text)?.let { unpackedText ->
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
@ -26,8 +25,5 @@ class Mp4Upload : ExtractorApi() {
}
}
return null
} catch (e: Exception) {
return null
}
}
}

View file

@ -27,7 +27,6 @@ class MultiQuality : ExtractorApi() {
}
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
try {
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
with(khttp.get(url)) {
sourceRegex.findAll(this.text).forEach { sourceMatch ->
@ -63,9 +62,6 @@ class MultiQuality : ExtractorApi() {
}
return extractedLinksList
}
} catch (e: Exception) {
}
return null
}
}

View file

@ -0,0 +1,51 @@
package com.lagradost.cloudstream3.utils.extractors
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getAndUnpack
import com.lagradost.cloudstream3.utils.getQualityFromName
class StreamSB : ExtractorApi() {
override val name: String = "StreamSB"
override val mainUrl: String = "https://sbplay.org"
private val sourceRegex = Regex("""sources:[\W\w]*?file:\s*"(.*?)"""")
//private val m3u8Regex = Regex(""".*?(\d*).m3u8""")
//private val urlRegex = Regex("""(.*?)([^/]+$)""")
// 1: Resolution 2: url
private val m3u8UrlRegex = Regex("""RESOLUTION=\d*x(\d*).*\n(http.*.m3u8)""")
override val requiresReferer = false
// https://sbembed.com/embed-ns50b0cukf9j.html -> https://sbvideo.net/play/ns50b0cukf9j
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
val newUrl = url.replace("sbplay.org/embed-", "sbplay.org/play/").removeSuffix(".html")
with(khttp.get(newUrl, timeout = 10.0)) {
getAndUnpack(this.text)?.let {
sourceRegex.findAll(it).forEach { sourceMatch ->
val extractedUrl = sourceMatch.groupValues[1]
if (extractedUrl.contains(".m3u8")) {
with(khttp.get(extractedUrl)) {
m3u8UrlRegex.findAll(this.text).forEach { match ->
val extractedUrlM3u8 = match.groupValues[2]
val extractedRes = match.groupValues[1]
extractedLinksList.add(
ExtractorLink(
name,
"$name ${extractedRes}p",
extractedUrlM3u8,
extractedUrl,
getQualityFromName(extractedRes),
true
)
)
}
}
}
}
}
}
return extractedLinksList
}
}

View file

@ -14,7 +14,6 @@ class StreamTape : ExtractorApi() {
Regex("""(i(|" \+ ')d(|" \+ ')=.*?&(|" \+ ')e(|" \+ ')x(|" \+ ')p(|" \+ ')i(|" \+ ')r(|" \+ ')e(|" \+ ')s(|" \+ ')=.*?&(|" \+ ')i(|" \+ ')p(|" \+ ')=.*?&(|" \+ ')t(|" \+ ')o(|" \+ ')k(|" \+ ')e(|" \+ ')n(|" \+ ')=.*)'""")
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
try {
with(khttp.get(url)) {
linkRegex.find(this.text)?.let {
val extractedUrl = "https://streamtape.com/get_video?${it.groupValues[1]}".replace("""" + '""", "")
@ -29,8 +28,6 @@ class StreamTape : ExtractorApi() {
)
}
}
} catch (e: Exception) {
}
return null
}
}

View file

@ -20,7 +20,7 @@ class Vidstream {
try {
normalApis.pmap { api ->
val url = api.getExtractorUrl(id)
val source = api.getUrl(url)
val source = api.getSafeUrl(url)
source?.forEach { callback.invoke(it) }
}
@ -38,7 +38,7 @@ class Vidstream {
// Matches vidstream links with extractors
extractorApis.filter { !it.requiresReferer || !isCasting }.pmap { api ->
if (link.startsWith(api.mainUrl)) {
val extractedLinks = api.getUrl(link, url)
val extractedLinks = api.getSafeUrl(link, url)
if (extractedLinks?.isNotEmpty() == true) {
extractedLinks.forEach {
callback.invoke(it)

View file

@ -11,7 +11,6 @@ class WcoStream : ExtractorApi() {
override val requiresReferer = false
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
try {
val baseUrl = url.split("/e/")[0]
val html = khttp.get(url, headers = mapOf("Referer" to "https://wcostream.cc/")).text
@ -25,7 +24,7 @@ class WcoStream : ExtractorApi() {
data class Sources(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label : String
@JsonProperty("label") val label: String?
)
data class Media(
@ -44,8 +43,8 @@ class WcoStream : ExtractorApi() {
mapped.media.sources.forEach {
sources.add(
ExtractorLink(
"WcoStream",
"WcoStream" + "- ${it.label}",
name,
name + if (it.label != null) "- ${it.label}" else "",
it.file,
"",
Qualities.HD.value,
@ -55,8 +54,5 @@ class WcoStream : ExtractorApi() {
}
}
return sources
} catch (e: Exception) {
return listOf()
}
}
}

View file

@ -38,7 +38,6 @@ class XStreamCdn : ExtractorApi() {
}
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
try {
val headers = mapOf(
"Referer" to url,
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0",
@ -63,9 +62,5 @@ class XStreamCdn : ExtractorApi() {
}
}
return extractedLinksList
} catch (e: Exception) {
}
return null
}
}