Crawler umfangreicher (17 Quellen: +Hornbach De'Longhi, +toom Comfee Mobile/PAC, +OBI Suntec) + 5-Min-Takt + paralleles Crawling (Semaphore); 2 neue Geräte (Suntec Progress 12.000, Comfee PAC 12000)
This commit is contained in:
+12
-6
@@ -16,7 +16,8 @@ from sources import SOURCES
|
|||||||
logging.basicConfig(level=logging.INFO); log = logging.getLogger("kf-crawler")
|
logging.basicConfig(level=logging.INFO); log = logging.getLogger("kf-crawler")
|
||||||
DATA = os.getenv("DATA_DIR","/app/data"); os.makedirs(DATA, exist_ok=True)
|
DATA = os.getenv("DATA_DIR","/app/data"); os.makedirs(DATA, exist_ok=True)
|
||||||
LIVE = os.path.join(DATA,"live.json"); HIST = os.path.join(DATA,"history.json")
|
LIVE = os.path.join(DATA,"live.json"); HIST = os.path.join(DATA,"history.json")
|
||||||
INTERVAL_MIN = int(os.getenv("CRAWL_INTERVAL_MIN","30"))
|
INTERVAL_MIN = int(os.getenv("CRAWL_INTERVAL_MIN","5"))
|
||||||
|
CONCURRENCY = int(os.getenv("CRAWL_CONCURRENCY","6"))
|
||||||
UA = {
|
UA = {
|
||||||
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||||
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
@@ -114,11 +115,16 @@ def load(path,default):
|
|||||||
|
|
||||||
async def crawl():
|
async def crawl():
|
||||||
now=datetime.now(timezone.utc).isoformat()
|
now=datetime.now(timezone.utc).isoformat()
|
||||||
async with httpx.AsyncClient(proxies=PROXY, headers=UA, http2=False) as client:
|
sem=asyncio.Semaphore(CONCURRENCY)
|
||||||
results=[]
|
limits=httpx.Limits(max_connections=CONCURRENCY, max_keepalive_connections=CONCURRENCY)
|
||||||
for src in SOURCES:
|
async with httpx.AsyncClient(proxies=PROXY, headers=UA, http2=False, limits=limits) as client:
|
||||||
results.append(await fetch_one(client, src))
|
async def guarded(src):
|
||||||
await asyncio.sleep(1.2) # höflich: Jitter/Rate-Limit
|
async with sem:
|
||||||
|
await asyncio.sleep(0.2) # kleiner Jitter, trotzdem höflich
|
||||||
|
return await fetch_one(client, src)
|
||||||
|
# parallel (begrenzt) -> auch bei vielen Quellen schnell genug für 5-Min-Takt
|
||||||
|
results=await asyncio.gather(*[guarded(s) for s in SOURCES])
|
||||||
|
results=list(results)
|
||||||
# Restock-Events
|
# Restock-Events
|
||||||
prev={ (o["chain"],o["productId"]): o for o in load(LIVE,{}).get("offers",[]) }
|
prev={ (o["chain"],o["productId"]): o for o in load(LIVE,{}).get("offers",[]) }
|
||||||
hist=load(HIST,{"events":[]})
|
hist=load(HIST,{"events":[]})
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ SOURCES = [
|
|||||||
"url":"https://www.hornbach.de/p/klimasplitgeraet-midea-portasplit-12-000-btu-105-m-weiss/12356554/"},
|
"url":"https://www.hornbach.de/p/klimasplitgeraet-midea-portasplit-12-000-btu-105-m-weiss/12356554/"},
|
||||||
{"chain":"OBI","kind":"baumarkt","productId":DL,"name":"De'Longhi PAC EX105",
|
{"chain":"OBI","kind":"baumarkt","productId":DL,"name":"De'Longhi PAC EX105",
|
||||||
"url":"https://www.obi.de/p/2892115/delonghi-mobiles-klimageraet-dl-pac-ex105-r290-eek-a-"},
|
"url":"https://www.obi.de/p/2892115/delonghi-mobiles-klimageraet-dl-pac-ex105-r290-eek-a-"},
|
||||||
|
{"chain":"Hornbach","kind":"baumarkt","productId":DL,"name":"De'Longhi Pinguino PAC EX105",
|
||||||
|
"url":"https://www.hornbach.de/p/klimageraet-delonghi-pinguino-pac-ex105-100-m-350-m-h-weiss/12721730/"},
|
||||||
|
# --- breitere Modell-Abdeckung (verifizierte, server-gerenderte Produktseiten) ---
|
||||||
|
{"chain":"toom","kind":"baumarkt","productId":"comfee-mobile-12000","name":"Comfee Mobile 12000",
|
||||||
|
"url":"https://toom.de/p/mobiles-klimageraet-mobile-12000-12000-btuh/9350652"},
|
||||||
|
{"chain":"toom","kind":"baumarkt","productId":"comfee-pac-12000","name":"Comfee PAC 12000",
|
||||||
|
"url":"https://toom.de/p/mobiles-klimageraet-pac-12000-12000-btuh/9350584"},
|
||||||
|
{"chain":"OBI","kind":"baumarkt","productId":"suntec-progress-12000","name":"Suntec Progress 12.000",
|
||||||
|
"url":"https://www.obi.de/p/3625753/suntec-klimaanlage-progress-12-000-schwarz-eek-a"},
|
||||||
# --- Alternative (Prosatech empfiehlt diese ähnlich zur PortaSplit) ---
|
# --- Alternative (Prosatech empfiehlt diese ähnlich zur PortaSplit) ---
|
||||||
{"chain":"Prosatech","kind":"fachhandel","productId":CB,"name":"Fischer ClimaButler 2 3,5 kW","official":True,
|
{"chain":"Prosatech","kind":"fachhandel","productId":CB,"name":"Fischer ClimaButler 2 3,5 kW","official":True,
|
||||||
"url":"https://prosatech.de/Mobile-Klimaanlage-ClimaButler-2-35-kW"},
|
"url":"https://prosatech.de/Mobile-Klimaanlage-ClimaButler-2-35-kW"},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -462,5 +462,99 @@
|
|||||||
"url": "https://prosatech.de/Mobile-Klimaanlage-ClimaButler-2-35-kW"
|
"url": "https://prosatech.de/Mobile-Klimaanlage-ClimaButler-2-35-kW"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "suntec-progress-12000",
|
||||||
|
"slug": "suntec-progress-12000",
|
||||||
|
"name": "Suntec Progress 12.000",
|
||||||
|
"brand": "Suntec",
|
||||||
|
"type": "monoblock",
|
||||||
|
"tier": "B",
|
||||||
|
"badge": "Günstig & verbreitet",
|
||||||
|
"apartmentSuitable": true,
|
||||||
|
"shortVerdict": "Solides Monoblock-Gerät mit 12.000 BTU für Räume bis ~60 m² – oft im Baumarkt verfügbar, gutes Preis-Leistungs-Verhältnis.",
|
||||||
|
"coolingKw": 3.5,
|
||||||
|
"btuh": 12000,
|
||||||
|
"efficiencyCooling": "A",
|
||||||
|
"noiseNote": "ca. 65 dB(A)",
|
||||||
|
"roomSizeM2": [
|
||||||
|
25,
|
||||||
|
60
|
||||||
|
],
|
||||||
|
"uvp": 589,
|
||||||
|
"fairPriceMax": 620,
|
||||||
|
"bestFor": [
|
||||||
|
"kleines Budget",
|
||||||
|
"schnelle Verfügbarkeit im Markt",
|
||||||
|
"größere Räume bis 60 m²"
|
||||||
|
],
|
||||||
|
"notFor": [
|
||||||
|
"wer es besonders leise braucht",
|
||||||
|
"Dauerbetrieb im Schlafzimmer"
|
||||||
|
],
|
||||||
|
"pros": [
|
||||||
|
"günstig",
|
||||||
|
"oft sofort im Baumarkt",
|
||||||
|
"R290-Kältemittel",
|
||||||
|
"3in1 Kühlen/Entfeuchten/Ventilieren"
|
||||||
|
],
|
||||||
|
"cons": [
|
||||||
|
"mit 65 dB relativ laut",
|
||||||
|
"Monoblock (Abluftschlauch nötig)"
|
||||||
|
],
|
||||||
|
"score": 74,
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"label": "OBI Suntec Progress 12.000",
|
||||||
|
"url": "https://www.obi.de/p/3625753/suntec-klimaanlage-progress-12-000-schwarz-eek-a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "comfee-pac-12000",
|
||||||
|
"slug": "comfee-pac-12000",
|
||||||
|
"name": "Comfee PAC 12000",
|
||||||
|
"brand": "Comfee",
|
||||||
|
"type": "monoblock",
|
||||||
|
"tier": "B",
|
||||||
|
"badge": "Preis-Tipp",
|
||||||
|
"apartmentSuitable": true,
|
||||||
|
"shortVerdict": "Günstiges Monoblock-Klimagerät mit 12.000 BTU, Timer und Schlafmodus – guter Einstieg für mittelgroße Räume.",
|
||||||
|
"coolingKw": 3.5,
|
||||||
|
"btuh": 12000,
|
||||||
|
"efficiencyCooling": "A",
|
||||||
|
"noiseNote": "ca. 52 dB(A)",
|
||||||
|
"roomSizeM2": [
|
||||||
|
20,
|
||||||
|
43
|
||||||
|
],
|
||||||
|
"uvp": 399,
|
||||||
|
"fairPriceMax": 430,
|
||||||
|
"bestFor": [
|
||||||
|
"kleines Budget",
|
||||||
|
"mittelgroße Räume",
|
||||||
|
"Einsteiger"
|
||||||
|
],
|
||||||
|
"notFor": [
|
||||||
|
"sehr große Räume",
|
||||||
|
"wer Split-Komfort will"
|
||||||
|
],
|
||||||
|
"pros": [
|
||||||
|
"sehr günstig",
|
||||||
|
"Timer & Schlafmodus",
|
||||||
|
"R290",
|
||||||
|
"oft im Baumarkt verfügbar"
|
||||||
|
],
|
||||||
|
"cons": [
|
||||||
|
"Monoblock (Abluftschlauch)",
|
||||||
|
"Ausstattung einfach"
|
||||||
|
],
|
||||||
|
"score": 72,
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"label": "toom Comfee PAC 12000",
|
||||||
|
"url": "https://toom.de/p/mobiles-klimageraet-pac-12000-12000-btuh/9350584"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user