Update _4anime.py

master
Arjix 2021-03-11 15:37:15 +02:00 committed by GitHub
parent cbaf97e837
commit 20a57117ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,5 @@
import logging
import re
from anime_downloader.util import eval_in_node
from anime_downloader.sites.anime import Anime, AnimeEpisode, SearchResult
from anime_downloader.sites import helpers
from anime_downloader.const import HEADERS
@ -50,7 +49,11 @@ class Anime4Episode(AnimeEpisode, sitename='4anime'):
'user-agent': HEADERS[self.hash_url(self.url, len(HEADERS))]}
resp = helpers.get(self.url, headers=self.headers)
text = eval_in_node(re.search(r"(eval\(function\(p,a,c,k,e,d\).*source.*\))", resp.text).group(1).replace('eval', 'console.log'))
text = re.search(r"(eval\(function\(p,a,c,k,e,d\).*source.*\))", resp.text).group(1)
if helpers.detect_packed_js(text):
text = helpers.unpack_packed_js(text)
else:
return []
# E.g. document.write( '<a class=\"mirror_dl\" href=\"https://v3.4animu.me/One-Piece/One-Piece-Episode-957-1080p.mp4\"><i class=\"fa fa-download\"></i> Download</a>' );
stream_url = re.search(r"<source src=\\\"(.*?)\\", str(helpers.soupify(f"<script>{text}</script>"))).group(1)