File "probe_final_cpp.py"
Full path: /home/algopkco/public_html/scraper/probe_final_cpp.py
File
size: 1.22 B
MIME-type: text/x-script.python
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
import re
import requests
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36"}
probes = [
("sanfoundry wp-json", "https://www.sanfoundry.com/wp-json/wp/v2/posts?per_page=5"),
("csestudy cpp mcq", "https://cselectricalandelectronics.com/c-plus-plus-mcq-questions/"),
("csestudy cpp list", "https://cselectricalandelectronics.com/category/cpp/"),
("easyengineering cpp", "https://www.easyengineering.net/c-plus-plus-mcq/"),
("gateoverflow cpp", "https://gateoverflow.in/tag/c++/mcq"),
("engineeringmcqs feed", "https://engineeringmcqs.blogspot.com/feeds/posts/default?max-results=50"),
("examrace cpp", "https://www.examrace.com/IAS-Mains/C-Plus-Plus/"),
]
for name, url in probes:
try:
r = requests.get(url, headers=headers, timeout=30)
txt = r.text[:400].lower()
ok = r.status_code == 200 and "just a moment" not in txt and "captcha" not in txt
t = re.search(r"<title>(.*?)</title>", r.text, re.S)
print(f"{name:28s} {r.status_code:4d} len={len(r.text):7d} ok={ok} | {(t.group(1).strip()[:60] if t else '')}")
except Exception as e:
print(f"{name:28s} ERR {type(e).__name__}")