-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrocklink.py
35 lines (24 loc) · 1.09 KB
/
rocklink.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
34
35
import time
import cloudscraper
from bs4 import BeautifulSoup
url = "https://rocklinks.net/XgQox/"
# ---------------------------------------------------------------------------------------------------------------------
def rocklinks_bypass(url):
client = cloudscraper.create_scraper(allow_brotli=False)
DOMAIN = "https://link.techyone.co"
url = url[:-1] if url[-1] == '/' else url
code = url.split("/")[-1]
final_url = f"{DOMAIN}/{code}?quelle="
resp = client.get(final_url)
soup = BeautifulSoup(resp.content, "html.parser")
try: inputs = soup.find(id="go-link").find_all(name="input")
except: return "Incorrect Link"
data = { input.get('name'): input.get('value') for input in inputs }
h = { "x-requested-with": "XMLHttpRequest" }
time.sleep(6)
r = client.post(f"{DOMAIN}/links/go", data=data, headers=h)
try:
return r.json()['url']
except: return "Something went wrong :("
# ---------------------------------------------------------------------------------------------------------------------
print(rocklinks_bypass(url))