mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Extractor: ContentX add external subtitle (#869)
This commit is contained in:
parent
96aa56209b
commit
85a769a898
1 changed files with 15 additions and 0 deletions
|
@ -18,6 +18,21 @@ open class ContentX : ExtractorApi() {
|
|||
val i_source = app.get(url, referer=ext_ref).text
|
||||
val i_extract = Regex("""window\.openPlayer\('([^']+)'""").find(i_source)!!.groups[1]?.value ?: throw ErrorLoadingException("i_extract is null")
|
||||
|
||||
val sub_urls = mutableSetOf<String>()
|
||||
Regex("""\"file\":\"([^\"]+)\",\"label\":\"([^\"]+)\"""").findAll(i_source).forEach {
|
||||
val (sub_url, sub_lang) = it.destructured
|
||||
|
||||
if (sub_url in sub_urls) { return@forEach }
|
||||
sub_urls.add(sub_url)
|
||||
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
lang = sub_lang.replace("\\u0131", "ı").replace("\\u0130", "İ").replace("\\u00fc", "ü").replace("\\u00e7", "ç"),
|
||||
url = fixUrl(sub_url.replace("\\", ""))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val vid_source = app.get("${mainUrl}/source2.php?v=${i_extract}", referer=ext_ref).text
|
||||
val vid_extract = Regex("""file\":\"([^\"]+)""").find(vid_source)!!.groups[1]?.value ?: throw ErrorLoadingException("vid_extract is null")
|
||||
val m3u_link = vid_extract.replace("\\", "")
|
||||
|
|
Loading…
Reference in a new issue