forked from h9zdev/GeoSentinel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_search.py
More file actions
33 lines (31 loc) · 1.24 KB
/
verify_search.py
File metadata and controls
33 lines (31 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from duckduckgo_search import DDGS
print("Verifying Image Search (SafeSearch OFF)...")
try:
ddgs = DDGS()
# "porn" query to test safe search is off
results = ddgs.images("porn", max_results=5, safesearch='off')
if results:
print(f"✅ Image search returned {len(results)} results.")
print(f"First result title: {results[0].get('title')}")
else:
print("❌ Image search returned NO results.")
except Exception as e:
print(f"❌ Image search failed: {e}")
print("\nVerifying Video Search (SafeSearch OFF + Thumbnails)...")
try:
results = ddgs.videos("test video", max_results=5, safesearch='off')
if results:
print(f"✅ Video search returned {len(results)} results.")
first = results[0]
# Check for images/thumbnail structure
thumb = first.get('images', {}).get('large')
if thumb:
print(f"✅ Video thumbnail found: {thumb}")
print(f"First result title: {first.get('title')}")
else:
print("❌ Video thumbnail NOT found in first result.")
print(f"Result keys: {first.keys()}")
else:
print("❌ Video search returned NO results.")
except Exception as e:
print(f"❌ Video search failed: {e}")