-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathgplinks_bypass.py
33 lines (22 loc) · 903 Bytes
/
gplinks_bypass.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import time
import cloudscraper
from bs4 import BeautifulSoup
import requests
# eg: https://gplinks.co/XXXX
url = "https://gplinks.co/Z94r6"
# =======================================
def gplinks_bypass(url: str):
client = cloudscraper.create_scraper(allow_brotli=False)
domain ="https://gplinks.co/"
referer = "https://mynewsmedia.co/"
vid = client.get(url, allow_redirects= False).headers["Location"].split("=")[-1]
url = f"{url}/?{vid}"
response = client.get(url, allow_redirects=False)
soup = BeautifulSoup(response.content, "html.parser")
inputs = soup.find(id="go-link").find_all(name="input")
data = { input.get('name'): input.get('value') for input in inputs }
time.sleep(10)
headers={"x-requested-with": "XMLHttpRequest"}
bypassed_url = client.post(domain+"links/go", data=data, headers=headers).json()["url"]
return bypassed_url
print(gplinks_bypass(url))