AnimeWorld: handle streamingaw.online server (#773)

* AnimeWorld: handle streamingaw.online server and throw a clear error message when video's are taken down due to copyright

* AnimeWorld: handle streamingaw.online server and throw a clear error message when video's are taken down due to copyright
This commit is contained in:
Samfun75
2022-08-15 17:48:58 +03:00
committed by GitHub
parent a2c2917c43
commit ed93e48f73
2 changed files with 11 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'ANIMEWORLD.tv'
pkgNameSuffix = 'it.animeworld'
extClass = '.ANIMEWORLD'
extVersionCode = 10
extVersionCode = 11
libVersion = '13'
}

View File

@ -85,10 +85,14 @@ class ANIMEWORLD : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return videosFromElement(document)
}
override fun videoListSelector() = "center a[href*=dood], center a[href*=streamtape], center a[href*=animeworld.biz]"
override fun videoListSelector() = "center a[href*=dood], center a[href*=streamtape], center a[href*=animeworld.biz], center a[href*=streamingaw.online][id=alternativeDownloadLink]"
private fun videosFromElement(document: Document): List<Video> {
val videoList = mutableListOf<Video>()
// afaik this element appears when videos are taken down, in this case instead of
// displaying Videolist empty show the element's text
val copyrightError = document.select("div.alert.alert-primary:contains(Copyright)")
if (copyrightError.hasText()) throw Exception(copyrightError.text())
val elements = document.select(videoListSelector())
for (element in elements) {
val url = element.attr("href")
@ -112,6 +116,11 @@ class ANIMEWORLD : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val videos = StreamSBExtractor(client).videosFromUrl(url.replace("/d/", "/e/"), headers)
videoList.addAll(videos)
}
url.contains("streamingaw") -> {
videoList.add(
Video(url, "AnimeWorld Server", url)
)
}
url.contains("dood") -> {
val video = DoodExtractor(client).videoFromUrl(url.replace("/d/", "/e/"))
if (video != null) {