metalfrom.eu/infra/bootstrap_ma.py
Nicolas Fryder d4e1bf2e15 chore: initial commit — snapshot VPS 2026-06-27
- apps/api      : API REST Node.js/Fastify + PostgreSQL/PostGIS
- apps/geocoder : Worker Python géocodage Nominatim
- apps/worker   : Scraper Python Metal-Archives
- apps/web      : Frontend statique Leaflet/clustering/heatmap
- infra/        : docker-compose + init.sql

Déployé via Coolify + Traefik sur VPS OVH.
2026-06-27 08:53:39 +00:00

27 lines
971 B
Python

from playwright.sync_api import sync_playwright
URL = "https://www.metal-archives.com/lists/FR"
def main():
with sync_playwright() as p:
browser = p.chromium.launch(headless=False) # IMPORTANT: visible
context = browser.new_context()
page = context.new_page()
print("Ouvre la page. Si Cloudflare challenge apparaît, résous-le dans la fenêtre.")
page.goto(URL, wait_until="domcontentloaded")
print("J'attends qu'un appel /browse/ajax-country/ passe en 200 (preuve que l'accès est OK)...")
def ok_ajax(resp):
return ("/browse/ajax-country/" in resp.url) and resp.status == 200
# Attends que DataTables charge réellement (XHR 200)
page.wait_for_response(ok_ajax, timeout=180_000)
context.storage_state(path="ma_state.json")
print("✅ ma_state.json sauvegardé. Tu peux fermer le navigateur.")
browser.close()
if __name__ == "__main__":
main()