#!/usr/bin/env python3
import re
import ssl
import urllib.request
ctx = ssl.create_default_context()
def fetch(url):
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
with urllib.request.urlopen(req, timeout=25, context=ctx) as r:
body = r.read().decode("utf-8", "replace")
title = re.search(r"
([^<]+)", body)
return r.status, r.geturl(), (title.group(1) if title else "?"), len(body), body
urls = [
"https://portal.otantik.cm/wifi/hap-ros6",
"https://portal.otantik.cm/wifi/hap-ros6/buy",
"https://portal.otantik.cm/wifi/hap-ros6/buy/3",
"https://portal.otantik.cm/?_route=plugin/wifi_otantik_pay&z=hap-ros6&wochk=1",
"https://portal.otantik.cm/?_route=plugin/wifi_otantik_pay&z=hap-ros6&pid=3&kind=Hotspot&wochk=1",
"https://portal.otantik.cm/?_route=wifi/hap-ros6/buy/3",
"https://portal.otantik.cm/z/hap-ros6",
"https://portal.otantik.cm/connectik/",
]
for u in urls:
print("===", u)
try:
status, final, title, n, body = fetch(u)
flags = []
if "Payer par Mobile" in body or "Mobile Money" in body:
flags.append("PAY_FORM")
if "Oups" in title or "n’êtes pas au bon endroit" in body:
flags.append("OUPS_404")
if "Speed Hour" in body:
flags.append("KIT_PLANS")
print("status", status, "len", n, "title", title, flags)
hrefs = re.findall(r'