feat: Agente-Marketing initial commit
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import requests, json, re
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124 Safari/537.36",
|
||||
"Accept": "text/html,application/xhtml+xml,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
}
|
||||
|
||||
# 1. Test Brevard County Property Appraiser (government API - no anti-bot)
|
||||
print("=== Brevard County Property API ===")
|
||||
try:
|
||||
r = requests.get(
|
||||
"https://www.bcpao.us/api/search?activeOnly=true&saleAmountMax=230000"
|
||||
"&saleAmountMin=50000&town=MELBOURNE&count=10&page=1",
|
||||
headers=headers, timeout=15
|
||||
)
|
||||
print(f"Status: {r.status_code}, size: {len(r.text)}")
|
||||
print(r.text[:500])
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
|
||||
# 2. Test Indian River County (Vero Beach) Property Appraiser
|
||||
print("\n=== Indian River County Property API ===")
|
||||
try:
|
||||
r = requests.get(
|
||||
"https://www.ircpa.net/propertysearch.aspx",
|
||||
headers=headers, timeout=15
|
||||
)
|
||||
print(f"Status: {r.status_code}, size: {len(r.text)}")
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
|
||||
# 3. Test Point2Homes (no JS required usually)
|
||||
print("\n=== Point2Homes ===")
|
||||
try:
|
||||
r = requests.get(
|
||||
"https://www.point2homes.com/US/Real-Estate-Listings/FL/Indian-River-County.html"
|
||||
"?PriceMin=50000&PriceMax=230000",
|
||||
headers=headers, timeout=15
|
||||
)
|
||||
print(f"Status: {r.status_code}, size: {len(r.text)}")
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
listings = soup.select(".item-listing, .listing, [class*='listing-card']")
|
||||
print(f"Listings found: {len(listings)}")
|
||||
for l in listings[:2]:
|
||||
print(f" {l.get_text()[:100].strip()}")
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
|
||||
# 4. Test Homes.com
|
||||
print("\n=== Homes.com ===")
|
||||
try:
|
||||
r = requests.get(
|
||||
"https://www.homes.com/homes-for-sale/fl/vero-beach/?min_price=50000&max_price=230000",
|
||||
headers=headers, timeout=15
|
||||
)
|
||||
print(f"Status: {r.status_code}, size: {len(r.text)}")
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
# Try to find embedded JSON data
|
||||
scripts = soup.find_all("script", type="application/json")
|
||||
print(f" JSON scripts found: {len(scripts)}")
|
||||
scripts2 = [s for s in soup.find_all("script") if s.string and "listPrice" in (s.string or "")]
|
||||
print(f" Scripts with listPrice: {len(scripts2)}")
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
|
||||
# 5. Test HUD proper endpoint
|
||||
print("\n=== HUD Homes (correct endpoint) ===")
|
||||
try:
|
||||
# Try different HUD endpoints
|
||||
urls = [
|
||||
"https://www.hudhomestore.gov/HudHomes/SearchProperties.aspx?state=FL&county=Indian+River&maxprice=230000",
|
||||
"https://www.hudhomestore.gov/HudHomes/SearchProperties.aspx?state=FL&county=Brevard&maxprice=230000",
|
||||
]
|
||||
for url in urls:
|
||||
r = requests.get(url, headers=headers, timeout=15)
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
listings = soup.select("tr.datarow, .propRow, [class*='prop-row']")
|
||||
prices = re.findall(r'\$[\d,]+', r.text)
|
||||
print(f" {url.split('county=')[1].split('&')[0]}: status={r.status_code}, listings={len(listings)}, prices found={len(prices)}")
|
||||
if prices:
|
||||
print(f" First prices: {prices[:5]}")
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}")
|
||||
Reference in New Issue
Block a user