need to fix login_to_sdarot_tv
This commit is contained in:
53
test.py
53
test.py
@@ -1,4 +1,4 @@
|
||||
import requests
|
||||
import requests, time
|
||||
|
||||
|
||||
SDAROT_DOMAIN = "sdarot.buzz"
|
||||
@@ -9,9 +9,21 @@ def get_sdarot_cookies():
|
||||
|
||||
|
||||
|
||||
def login_to_sdarot_tv(username, password, cookies):
|
||||
DATA = f"location=%2Findex&username={username}&password={password}&submit_login="
|
||||
return requests.post(f'https://{SDAROT_DOMAIN}/login', data=DATA, cookies=cookies)
|
||||
def login_to_sdarot_tv(username, password, cookies): ## DOESN'T Work
|
||||
DATA = {
|
||||
'location': '/index',
|
||||
'username': 'idan92',
|
||||
'password': 'asdqwe123',
|
||||
'submit_login': ''
|
||||
}
|
||||
print(cookies)
|
||||
print(DATA)
|
||||
COOKIES = {"Sdarot": "OXuQa5b8BPSKUDB%2CNlj8aGhqJGm5gC%2CvHP7SHvhFriFybKNf4noTOUhSDmGyMjVQ0YmnR1KVsN%2CaueQ54me7glMc5MDNqcezg-jbe8VpO-PFWV-sB%2CNgCSDeLv6iX7bs"}
|
||||
headers = {
|
||||
'cookie': 'Sdarot=OXuQa5b8BPSKUDB%2CNlj8aGhqJGm5gC%2CvHP7SHvhFriFybKNf4noTOUhSDmGyMjVQ0YmnR1KVsN%2CaueQ54me7glMc5MDNqcezg-jbe8VpO-PFWV-sB%2CNgCSDeLv6iX7bs'
|
||||
}
|
||||
return requests.get('https://www.sdarot.buzz/login', data=DATA, headers=headers)
|
||||
# return requests.post(f'https://www.{SDAROT_DOMAIN}/login', data=DATA, cookies=cookies)
|
||||
|
||||
|
||||
def get_dictionary_series(cookies):
|
||||
@@ -22,23 +34,25 @@ def get_dictionary_series(cookies):
|
||||
def get_sid(dictionary, series_name):
|
||||
return list(filter(lambda obj: series_name in " ".join(list(obj.values())), dictionary))
|
||||
|
||||
|
||||
def create_new_token(cookies, sid, season, ep):
|
||||
DATA = f"preWatch=true&SID={sid}&season={season}&ep={ep}"
|
||||
return requests.get(f"https://{SDAROT_DOMAIN}/ajax/watch", data=DATA, cookies=cookies).content.decode()
|
||||
res = requests.post(f"https://www.{SDAROT_DOMAIN}/ajax/watch", data=DATA, cookies=cookies)
|
||||
print(res.status_code)
|
||||
print(res.content)
|
||||
return res.content.decode()
|
||||
|
||||
|
||||
def get_video_url(cookies, token, sid, season, episode):
|
||||
DATA = f"watch=true&token={token}&serie={sid}&season={season}&episode={episode}&type=episode"
|
||||
return requests.get(f"https://{SDAROT_DOMAIN}/ajax/watch", cookies=cookies, data=DATA).json()
|
||||
res = requests.get(f"https://{SDAROT_DOMAIN}/ajax/watch", cookies=cookies, data=DATA)
|
||||
print(res.content)
|
||||
print(res.json())
|
||||
return "https://" + res.json()["watch"]["480"]
|
||||
|
||||
|
||||
def download_video():
|
||||
COOKIES = {
|
||||
"Sdarot": "gcgwRxWduRJnj8TxmSNL%2CDWw-skr22IYHTezvqfjT6pLLkfo1E6zy8s1VyKq6Ec8PRfvQNs5Sz0b37S%2CJXwi4LMjzyB8Lj1hf4FfSyu9bgKvGOnIFpTa8WtJQCm3%2CPks"
|
||||
|
||||
}
|
||||
file_path = "example.mp4"
|
||||
response = requests.get("https://specter.sdarot.buzz/w/SD/480/3842/232888/232888.mp4?token=1Def_9N7EuYPezBVTs404w&time=1688228206&uid=640118", stream=True, cookies=COOKIES, timeout=5)
|
||||
def download_video(cookies, video_url, file_path):
|
||||
response = requests.get(video_url, stream=True, cookies=cookies, timeout=5)
|
||||
|
||||
with open(file_path, "wb") as file:
|
||||
for chunk in response.iter_content(chunk_size=8192):
|
||||
@@ -47,9 +61,18 @@ def download_video():
|
||||
|
||||
def main():
|
||||
sdarot_cookies = get_sdarot_cookies()
|
||||
print(login_to_sdarot_tv("idan92", "asdqwe123", sdarot_cookies))
|
||||
print(login_to_sdarot_tv("idan92", "asdqwe123", sdarot_cookies).status_code)
|
||||
series = get_dictionary_series(sdarot_cookies)
|
||||
print(get_sid(series, "אלי כהן"))
|
||||
sid = get_sid(series, "איש משפחה")[0]["id"]
|
||||
print(sid)
|
||||
token = create_new_token(sdarot_cookies, sid, 1, 1)
|
||||
# print("Start 30 seconds...")
|
||||
# print(sdarot_cookies)
|
||||
# print(token)
|
||||
# print(sid)
|
||||
# time.sleep(32) # import time
|
||||
# video_url = get_video_url(sdarot_cookies, token, sid, 1, 1)
|
||||
# download_video(sdarot_cookies, video_url, "example.mp4")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user