Created
October 16, 2022 15:54
-
-
Save AmarnathCJD/7503979fc982bc1370ab65500a6a2de9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from requests import get | |
BASE_URL = 'https://animepahe.com' | |
def get_anime_list(): | |
req = get(BASE_URL + '/api?m=airing&page=1', headers={'User-Agent': 'Mozilla/5.0'}).json() | |
animes = [] | |
for anime in req['data']: | |
animes.append({ | |
'title': anime['anime_title'], | |
'session': anime['session'], | |
'id': anime['anime_id'], | |
'snapshot': anime['snapshot'], | |
}) | |
return animes | |
def get_stream_links(session): | |
req = get(BASE_URL + '/api?m=links&id={}&p=kwik'.format(session), headers={'User-Agent': 'Mozilla/5.0'}).json() | |
links = [] | |
for link in req['data']: | |
for a, b in link.items(): | |
links.append({ | |
'quality': a, | |
'url': b["kwik"], | |
}) | |
return links | |
def get_m3u8(url): | |
headers = { | |
'User-Agent': 'Mozilla/5.0', | |
'Referer': 'https://animepahe.com/', | |
} | |
req = get(url, headers=headers) | |
video_id_re = re.compile(r'\|uwu\|([a-zA-Z0-9]+)\|') | |
video_id = video_id_re.search(req.text).group(1) | |
return "https://eu-991.files.nextcdn.org/stream/01/" + video_id + "uwu.m3u8" | |
#a = get_anime_list()[0]["session"] | |
#b = get_stream_links(a)[0]["url"] | |
#c = get_m3u8(b) | |
#print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment