LoremPizza commited on
Commit
1b80d48
·
verified ·
1 Parent(s): eeef32f

Update mediaflow_proxy/main.py

Browse files
Files changed (1) hide show
  1. mediaflow_proxy/main.py +20 -1
mediaflow_proxy/main.py CHANGED
@@ -35,7 +35,26 @@ async def verify_api_key(api_key: str = Security(api_password_query), api_key_al
35
  @app.get("/health")
36
  async def health_check():
37
  return {"status": "healthy"}
38
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  @app.get("/favicon.ico")
41
  async def get_favicon():
 
35
  @app.get("/health")
36
  async def health_check():
37
  return {"status": "healthy"}
38
+ @app.get("/real-link")
39
+ async def real_link():
40
+ headers = {
41
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
42
+ 'Accept-Language': 'en-US,en;q=0.5'
43
+ }
44
+ async with httpx.AsyncClient() as client:
45
+ real_link = "https://mixdrop.ps/e/7ro4946lhee7l8"
46
+ response = await client.get(real_link, headers=headers, follow_redirects=True,timeout = 30)
47
+ [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2)
48
+ schema = s1.split(";")[2][5:-1]
49
+ terms = s2.split("|")
50
+ charset = string.digits + string.ascii_letters
51
+ d = dict()
52
+ for i in range(len(terms)):
53
+ d[charset[i]] = terms[i] or charset[i]
54
+ s = 'https:'
55
+ for c in schema:
56
+ s += d[c] if c in d else c
57
+ return s
58
 
59
  @app.get("/favicon.ico")
60
  async def get_favicon():