latest update
This commit is contained in:
18
scratch/inspect_table_cells.py
Normal file
18
scratch/inspect_table_cells.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import re
|
||||
|
||||
with open('real_timetable.html', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Find rows in the timetable table
|
||||
rows = re.findall(r'<tr[^>]*>(.*?)</tr>', content, re.DOTALL)
|
||||
print(f"Total tr rows: {len(rows)}")
|
||||
|
||||
for idx, r in enumerate(rows):
|
||||
if 'tuesday' in r.lower() or 'tue' in r.lower():
|
||||
print(f"\n--- ROW {idx} (TUESDAY) ---")
|
||||
tds = re.findall(r'<td[^>]*>(.*?)</td>', r, re.DOTALL)
|
||||
print(f"Total td cells in Tuesday row: {len(tds)}")
|
||||
for col_i, td in enumerate(tds):
|
||||
clean_td = ' '.join(re.sub(r'<[^>]+>', ' ', td).split())
|
||||
forms_in_td = re.findall(r'<form[^>]*>(.*?)</form>', td, re.DOTALL)
|
||||
print(f" Col {col_i}: forms_count={len(forms_in_td)} | text={clean_td[:80]}")
|
||||
24
scratch/inspect_tt_periods.py
Normal file
24
scratch/inspect_tt_periods.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import re
|
||||
|
||||
with open('real_timetable.html', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
forms = re.findall(r'<form[^>]*class="[^"]*period_form[^"]*"[^>]*>(.*?)</form>', content, re.DOTALL)
|
||||
print(f"Total forms found: {len(forms)}")
|
||||
|
||||
by_day = {}
|
||||
for form in forms:
|
||||
day_m = re.search(r'name="day"\s+value="([^"]+)"', form)
|
||||
per_m = re.search(r'name="period"\s+value="([^"]+)"', form)
|
||||
day = day_m.group(1).lower() if day_m else 'unknown'
|
||||
per = per_m.group(1) if per_m else '0'
|
||||
by_day.setdefault(day, []).append((per, form))
|
||||
|
||||
for day in sorted(by_day.keys()):
|
||||
print(f"\n=== DAY: {day.upper()} (Count: {len(by_day[day])}) ===")
|
||||
for per, form in by_day[day]:
|
||||
primaries = re.findall(r'class="[^"]*text-primary[^"]*"[^>]*>(.*?)</span>', form, re.DOTALL)
|
||||
clean_p = [re.sub(r'<[^>]+>', '', p).strip() for p in primaries]
|
||||
full_txt = re.sub(r'<[^>]+>', ' ', form).strip()
|
||||
full_txt = ' '.join(full_txt.split())
|
||||
print(f" Period {per}: primaries={clean_p} | full_txt={full_txt[:100]}")
|
||||
13
scratch/inspect_tue_context.py
Normal file
13
scratch/inspect_tue_context.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import re
|
||||
|
||||
with open('real_timetable.html', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
print("File length:", len(content))
|
||||
# Search for Tuesday in content
|
||||
tue_matches = [m.start() for m in re.finditer(r'tuesday', content, re.IGNORECASE)]
|
||||
print("Tuesday matches at indices:", tue_matches)
|
||||
|
||||
for pos in tue_matches[:3]:
|
||||
print("\n--- Context around Tuesday ---")
|
||||
print(content[max(0, pos-200):min(len(content), pos+400)])
|
||||
53
scratch/test_lab_assignment_marks.py
Normal file
53
scratch/test_lab_assignment_marks.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import http.cookiejar
|
||||
import re
|
||||
|
||||
cj = http.cookiejar.CookieJar()
|
||||
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
|
||||
|
||||
login_url = "https://ims.rajalakshmi.edu.in/ims/login"
|
||||
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
}
|
||||
|
||||
# Step 1: GET login page
|
||||
req = urllib.request.Request(login_url, headers=headers)
|
||||
with opener.open(req) as resp:
|
||||
html = resp.read().decode('utf-8')
|
||||
|
||||
csrf_m = re.search(r'name="_token"\s+value="([^"]+)"', html)
|
||||
csrf_token = csrf_m.group(1) if csrf_m else ''
|
||||
print(f"CSRF Token: {csrf_token}")
|
||||
|
||||
# Step 2: POST login
|
||||
post_data = urllib.parse.urlencode({
|
||||
'_token': csrf_token,
|
||||
'username': '2117240070293',
|
||||
'password': '7010406809'
|
||||
}).encode('utf-8')
|
||||
|
||||
req_post = urllib.request.Request(login_url, data=post_data, headers=headers)
|
||||
with opener.open(req_post) as resp_post:
|
||||
dash_html = resp_post.read().decode('utf-8')
|
||||
|
||||
print(f"Login success! Dash HTML length: {len(dash_html)}")
|
||||
|
||||
# Step 3: Find all <a> hrefs containing lab or assignment or mark or report
|
||||
all_links = re.findall(r'<a[^>]+href="([^"]+)"[^>]*>(.*?)</a>', dash_html, re.DOTALL)
|
||||
print(f"Total links found: {len(all_links)}")
|
||||
|
||||
for href, label in all_links:
|
||||
clean_label = re.sub(r'<[^>]+>', '', label).strip()
|
||||
clean_label_lower = clean_label.lower()
|
||||
if 'lab' in clean_label_lower or 'assignment' in clean_label_lower or 'mark' in clean_label_lower or 'grade' in clean_label_lower or 'cat' in clean_label_lower:
|
||||
print(f"Link: '{clean_label}' -> Href: '{href}'")
|
||||
|
||||
# Also search for all hrefs in the full HTML to be sure
|
||||
all_hrefs = re.findall(r'href="([^"]+)"', dash_html)
|
||||
print("\n--- ALL UNIQUE HREFS IN DASHBOARD ---")
|
||||
for h in set(all_hrefs):
|
||||
if 'admin' in h or 'student' in h or 'mark' in h or 'report' in h:
|
||||
print(" ", h)
|
||||
Reference in New Issue
Block a user