fix(oba): update token parsing and defaults

This commit is contained in:
2026-06-25 08:46:51 +03:00
parent 40daa54167
commit c5f82527b9
Regular → Executable
+5 -4
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
@@ -16,7 +16,7 @@ import logging
def get_next_url(client: httpx.Client):
current_url = "https://www.oba.gov.tr/egitim/oynatma/basogretmenlik-uzaktan-egitim-semineri-meb-personeli-2024-1146/19527"
current_url = "https://oba.gov.tr/egitim/oynatma/yesil-vatan-seferberligi-aile-okul-ve-etkilesim-kooperatifcilik-bilinci-1530/35558"
soup = BeautifulSoup(client.get(current_url).text, "html.parser")
if "MEBBİS ile Giriş" in str(soup):
@@ -42,7 +42,7 @@ def simulate_video_watch(client: httpx.Client, url: str) -> None:
logging.info(f"video title: {video_title}")
# Find token and sector length
token_match = re.search(r"var token='(eyJ.+?)'", res.text)
token_match = re.search(r"tk:\s*'(eyJ.+?)'", res.text)
if not token_match:
logging.warning("could not find token or sector length")
@@ -72,6 +72,7 @@ def simulate_video_watch(client: httpx.Client, url: str) -> None:
token = res["token"]
logging.debug(f"checkpoint reached. new token: {token}")
logging.info("waiting before next checkpoint...")
time.sleep(20)
except json.JSONDecodeError:
@@ -84,7 +85,7 @@ def main():
logging.getLogger("httpx").setLevel(logging.WARNING)
arger = argparse.ArgumentParser()
arger.add_argument("--session", type=str, default="1n8gch3f7v231gvejcnbie480a", help="PHPSESSID cookie value", required=True)
arger.add_argument("--session", type=str, default="dm5afs9fpibp8ekjrkp55le2bl", help="PHPSESSID cookie value")
args = arger.parse_args()
client = httpx.Client(