ehiaborsuccess/OutreachAI
0
1import requests2import urllib.parse3from bs4 import BeautifulSoup4 5query = "Business Analyst recruitment agency London email"6headers = {7 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'8}9 10def test_ddg_lite():11 print("--- Testing DDG Lite ---")12 try:13 url = f"https://html.duckduckgo.com/html/?q={urllib.parse.quote(query)}"14 resp = requests.get(url, headers=headers, timeout=12)15 print(f"Status: {resp.status_code}")16 if resp.status_code == 200:17 soup = BeautifulSoup(resp.text, 'html.parser')18 urls = []19 for a in soup.find_all('a', class_='result__url', href=True):20 urls.append(a['href'].strip())21 print(f"Found {len(urls)} URLs")22 for u in urls[:5]: print(f" {u}")23 except Exception as e:24 print(f"Error: {e}")25 26test_ddg_lite()27 