small fix to test and m3u8

This commit is contained in:
LagradOst 2022-05-15 20:49:26 +02:00
parent 88e1719085
commit 670c613f71
2 changed files with 7 additions and 6 deletions

View file

@ -24,9 +24,7 @@ class ExampleInstrumentedTest {
//} //}
private fun getAllProviders(): List<MainAPI> { private fun getAllProviders(): List<MainAPI> {
val allApis = APIHolder.apis return APIHolder.allProviders //.filter { !it.usesWebView }
allApis.addAll(APIHolder.restrictedApis)
return allApis //.filter { !it.usesWebView }
} }
private suspend fun loadLinks(api: MainAPI, url: String?): Boolean { private suspend fun loadLinks(api: MainAPI, url: String?): Boolean {
@ -113,7 +111,7 @@ class ExampleInstrumentedTest {
continue continue
} }
val url = (load.episodes[load.episodes.keys.first()])?.first()?.url val url = (load.episodes[load.episodes.keys.first()])?.first()?.data
validResults = loadLinks(api, url) validResults = loadLinks(api, url)
if (!validResults) continue if (!validResults) continue
} }

View file

@ -124,7 +124,10 @@ class M3u8Helper {
app.get(m3u8.streamUrl, headers = m3u8.headers).text app.get(m3u8.streamUrl, headers = m3u8.headers).text
} }
var hasAnyContent = false
for (match in QUALITY_REGEX.findAll(response)) { for (match in QUALITY_REGEX.findAll(response)) {
hasAnyContent = true
var (quality, m3u8Link, m3u8Link2) = match.destructured var (quality, m3u8Link, m3u8Link2) = match.destructured
if (m3u8Link.isEmpty()) m3u8Link = m3u8Link2 if (m3u8Link.isEmpty()) m3u8Link = m3u8Link2
if (absoluteExtensionDetermination(m3u8Link) == "m3u8") { if (absoluteExtensionDetermination(m3u8Link) == "m3u8") {
@ -152,11 +155,11 @@ class M3u8Helper {
) )
) )
} }
if (returnThis) { if (returnThis || !hasAnyContent) {
yield( yield(
M3u8Stream( M3u8Stream(
m3u8.streamUrl, m3u8.streamUrl,
0, Qualities.Unknown.value,
m3u8.headers m3u8.headers
) )
) )