Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
- Fixed GoDaddy auctions with $0 price (set TLD-based minimum prices) - Added SnapNames HTML scraper for additional auction data - Improved Park.io scraper with HTML fallback (API is private) - Enhanced HiddenApiScraperService with new sources - Cleaned up 100+ invalid $0 entries Current data: - 581 total auctions with valid prices - ExpiredDomains: 473 (avg $13) - Dynadot: 108 (avg $332)
86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test Namecheap GraphQL API to find the query hash.
|
|
"""
|
|
|
|
import asyncio
|
|
import httpx
|
|
import json
|
|
import re
|
|
|
|
async def test_namecheap():
|
|
"""
|
|
Test Namecheap GraphQL API.
|
|
The API requires a query hash that must be extracted from the website.
|
|
"""
|
|
|
|
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
# First, load the Marketplace page to find the hash
|
|
print("🔍 Fetching Namecheap Marketplace page...")
|
|
response = await client.get(
|
|
"https://www.namecheap.com/market/",
|
|
headers={
|
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
|
|
"Accept": "text/html,application/xhtml+xml",
|
|
}
|
|
)
|
|
|
|
if response.status_code == 200:
|
|
html = response.text
|
|
|
|
# Look for query hash patterns
|
|
hash_patterns = [
|
|
r'"queryHash":"([a-f0-9]+)"',
|
|
r'"hash":"([a-f0-9]{32,})"',
|
|
r'aftermarketapi.*?([a-f0-9]{32,})',
|
|
r'"persistedQueryHash":"([a-f0-9]+)"',
|
|
]
|
|
|
|
found_hashes = set()
|
|
for pattern in hash_patterns:
|
|
matches = re.findall(pattern, html, re.IGNORECASE)
|
|
for m in matches:
|
|
if len(m) >= 32:
|
|
found_hashes.add(m)
|
|
|
|
if found_hashes:
|
|
print(f"✅ Found {len(found_hashes)} potential hashes:")
|
|
for h in list(found_hashes)[:5]:
|
|
print(f" {h[:50]}...")
|
|
else:
|
|
print("❌ No hashes found in HTML")
|
|
|
|
# Check for NEXT_DATA
|
|
if "__NEXT_DATA__" in html:
|
|
print("📦 Found __NEXT_DATA__ - Next.js app")
|
|
match = re.search(r'<script id="__NEXT_DATA__"[^>]*>(.*?)</script>', html, re.DOTALL)
|
|
if match:
|
|
try:
|
|
data = json.loads(match.group(1))
|
|
print(f" Keys: {list(data.keys())[:5]}")
|
|
except:
|
|
pass
|
|
|
|
print(f"📄 Page status: {response.status_code}")
|
|
print(f"📄 Page size: {len(html)} bytes")
|
|
|
|
# Try a different approach - use their search API
|
|
print("\n🔍 Trying Namecheap search endpoint...")
|
|
search_response = await client.get(
|
|
"https://www.namecheap.com/market/search/",
|
|
params={"q": "tech"},
|
|
headers={
|
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
|
|
"Accept": "application/json, text/html",
|
|
"X-Requested-With": "XMLHttpRequest",
|
|
}
|
|
)
|
|
print(f" Search status: {search_response.status_code}")
|
|
|
|
else:
|
|
print(f"❌ Failed: {response.status_code}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_namecheap())
|
|
|