Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,6 +86,11 @@ def scrape_with_requests(url: str) -> Dict[str, Any]:
|
|
| 86 |
for k, v in matches:
|
| 87 |
hidden_values.append(f"script {k}={v}")
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# Regex tokens (catch suspicious long strings)
|
| 90 |
tokens = re.findall(r"[A-Za-z0-9_\-]{8,}", html)
|
| 91 |
for t in tokens:
|
|
@@ -104,6 +109,7 @@ def scrape_with_requests(url: str) -> Dict[str, Any]:
|
|
| 104 |
|
| 105 |
|
| 106 |
|
|
|
|
| 107 |
def answer_question(question: str, content: Dict[str, Any]) -> str:
|
| 108 |
"""Simple rule-based extraction for Round 5 questions."""
|
| 109 |
ql = question.lower()
|
|
|
|
| 86 |
for k, v in matches:
|
| 87 |
hidden_values.append(f"script {k}={v}")
|
| 88 |
|
| 89 |
+
# ✅ Direct regex for challengeID inside HTML/JS blobs
|
| 90 |
+
challengeid_match = re.search(r'"?challengeID"?\s*[:=]\s*"([^"]+)"', html, re.I)
|
| 91 |
+
if challengeid_match:
|
| 92 |
+
hidden_values.append(f"challengeID={challengeid_match.group(1)}")
|
| 93 |
+
|
| 94 |
# Regex tokens (catch suspicious long strings)
|
| 95 |
tokens = re.findall(r"[A-Za-z0-9_\-]{8,}", html)
|
| 96 |
for t in tokens:
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
+
|
| 113 |
def answer_question(question: str, content: Dict[str, Any]) -> str:
|
| 114 |
"""Simple rule-based extraction for Round 5 questions."""
|
| 115 |
ql = question.lower()
|