Leider wurde das Seitendesign von heizpellets24.de geändert und das Programm funktioniert nicht mehr. Gibt es jemand der sich die mühe machen würde das anzupassen, ich kenne mich leider nicht gut genug aus und steig da nicht durch. Ich versuche mal unten alles zusammen zu fassen. Liebe Grüße
Die Seite die ich meine:
Hier ein Bild der Gewünschten werte:
Und hier das Programm das seit ein par Tagen nicht mehr funktioniert:
//Author Olivero aus Forumsbeitrag
//https://forum.iobroker.net/topic/56432/preis-von-propellets-at-mittels-parser-auslesen/22?_=1670064893887&lang=de
// Angepasst: 03.12.22 Looxer01
//..........................................
// Einstellungen
//..........................................
const dpPrice1 = "javascript.0.Heizung.Pelletspreise.dpPrice1";
const dpDealer1 = "javascript.0.Heizung.Pelletspreise.dpDealer1";
const dpPrice2 = "javascript.0.Heizung.Pelletspreise.dpPrice2";
const dpDealer2 = "javascript.0.Heizung.Pelletspreise.dpDealer2";
const dpPrice3 = "javascript.0.Heizung.Pelletspreise.dpPrice3";
const dpDealer3 = "javascript.0.Heizung.Pelletspreise.dpDealer3";
const Abfragemenge = "6000";
const AbfragePLZ = "65760";
const Abfrageplan = '0 */2 * * *' ; // Cron - alle 2 Stunden
//..........................................
// Programm Vorbereitung
//..........................................
const fetch = require("node-fetch");
const cheerio = require("cheerio");
CreateStates();
//--------------------------------------------------------------------------------------------------------------------
// Schedule
//--------------------------------------------------------------------------------------------------------------------
schedule (Abfrageplan,function () {
log("Pelletspeise schedule gestarted","info")
analyze();
}) // End Schedule
//..........................................
// Programmablauf Ende
//..........................................
//--------------------------------------------------------------------------------------------------------------------
// Function Analyze
//--------------------------------------------------------------------------------------------------------------------
async function analyze() {
let text = await getData();
let $ = cheerio.load(text);
let price1 = $($(".price-middle:not(.total)")[0]).text().trim();
//var price1Total = $($(".price-middle total <span> ")[0]).text().trim();
//log ("price total " + price1Total
let dealer1 = $($(".dealer-name")[0]).text().trim()
let price2 = $($(".price-middle:not(.total)")[1]).text().trim();
let dealer2 = $($(".dealer-name")[1]).text().trim()
let price3 = $($(".price-middle:not(.total)")[2]).text().trim();
let dealer3 = $($(".dealer-name")[2]).text().trim()
setState(dpPrice1,price1);
setState(dpDealer1,dealer1);
setState(dpPrice2,price2);
setState(dpDealer2,dealer2);
setState(dpPrice3,price3);
setState(dpDealer3,dealer3);
} // End Function
//--------------------------------------------------------------------------------------------------------------------
// Function getData
//--------------------------------------------------------------------------------------------------------------------
async function getData() {
var fetchstring = "https://www.heizpellets24.de/pelletpreis-direkt/"+AbfragePLZ+"/"+Abfragemenge+"/1/dt5"
var bodystring = "ctl00%24ScriptManager1=ctl00%24MainContent%24OrderProcess_Step_1%24PriceOrderUpdatePanel%7Cctl00_MainContent_OrderProcess_Step_1_PriceOrderUpdatePanel&__EVENTTARGET=ctl00_MainContent_OrderProcess_Step_1_PriceOrderUpdatePanel&__EVENTARGUMENT=LoadPrices&__LASTFOCUS=&__VIEWSTATE=ZOqYdG%2BFwZ%2BPrH15aLaMOhCzmA140AC7FRQT3yJlHciVxQ48WlVoIAneqpP531uNShrNE4s8pYwrxCbi2Al%2FD78egos7NN8N26Wwp3FQY0QU2BUEUQiUvMfvrw6k4579ZlpA%2BjWBFS2L9gdEqrq%2BNy%2F2FfulD2BLGcSw3dxN2BoDBJ6ZlKMEYhpcwsnrciH0JzSBmCppft1AUYcTCh4bnwEkEqrmCNNc6JWx0jm9kdJIHMlHNVXJg3HujRyj8g75ZwMJVzQQGVljGNVsx6EeMrHhu%2BVgrjM3dMPwV5p485kdwKlPvkhPliUDI3ES2l%2FLcTGvyQIdMULrFFG5TanRnKkRKf40BvCE8Wu233%2Bb5b7dl8vhb8PCOilHtpSvMESCcyrxMvctN2ALlFrLPfV15ydI6aghBWm1dULmXOMINUXu%2BTdc0irIq4qxw3BDYvjCVADCXio9a5syz5qcdori2HzaaTpFD1X5V2h8L3jG%2FRSnU9fGxl38FEHQ5CejNn%2FBqIpurm6uDvsfLznni1EwbO52WsrlqWVyIrKaT2594wPUVV9IKfg%2FJ9CjjlYASS2zQmXp2UNpZIJCWg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7%2FsFH7DFClrkEPVNeXjCeZtTN9M7Ez%2FxdTXiqh0%2BhkYTSp5C7PqdTc%2Bo%2FlN1TCBi%2FzkHFrGk%2FXnTXe2G8Fxsko15utYt%2FSFV7rm3btB3BSCOoV5HesXb1PLtxjM4XWGSXVILpnqIHj6h6jRalSeaebJyRUe7LmSiO9aZMc870gs4xgvWCmE5Uiej%2F3TWzFYQhHiYqNVJFexIbVoCyZvPOAnmoDO9ttVYaMSFCE76YxQdb%2BzyI2bBQ9Pzf4jCIo1okIsdtWVYnmJLIdJ%2BcJfonim8hFsiQqx4Vch8kubvPjZfWVUSwEUd%2FimFH7bLrDIV0aapcfk57uR%2BlPp%2BBlN60gGckho3Y9dpjxdqEWrLwzl8%2B711Nhai3JmkUle6i8fZtKTQT73CtEgPfET4IisojCnv6GR%2B1SxeBkXMSykq%2F1mI0rxTp4vMUoYFHkTRn7cx4cYj9ghjsaYyMXwAWu3%2FCwlHeD4xCVmU8HnpxKogz7YmW6IiYRRupt8xvLYtY6RB1o63N0Dgxns0psqy%2BcBhyXuqpxUyAoFKMwLBzxaRvw%3D%3D&__VIEWSTATEGENERATOR=5DCC3F26&ctl00%24LoginView%24UserName=&ctl00%24LoginView%24Password=&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24ZIP=" + AbfragePLZ + "&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24Quantity=" + Abfragemenge + "&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24QualityCheckBoxRepeater%24ctl01%24TypeId=1&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24QualityCheckBoxRepeater%24ctl01%24TypeCheckBox=on&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24QualityCheckBoxRepeater%24ctl02%24TypeId=2&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24PaymentGroup%24OptionGroupDropDown=6&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24Stations=1&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24DeliveryGroup%24OptionGroupDropDown=5&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24DeliveryTimeGroup%24OptionGroupDropDown=24&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24TruckSizeGroup%24OptionGroupDropDown=19&ctl00%24MainContent%24OrderProcess_Step_1%24CalculatorView%24TubeLengthGroup%24OptionGroupDropDown=9&ctl00%24MainContent%24OrderProcess_Step_1%24IsLoggedIn=0&ctl00%24MainContent%24OrderProcess_Step_1%24SortingType=-1&ctl00%24MainContent%24OrderProcess_Step_1%24ProductTypeSelector=1&ctl00%24MainContent%24OrderProcess_Step_1%24SortDropDown=-1&__ASYNCPOST=true&"
log("Pelletspeise werden ermittelt "+ fetchstring,"info")
let response = await fetch(fetchstring, {
"headers": {
"accept": "*/*",
"accept-language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"pragma": "no-cache",
"sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-microsoftajax": "Delta=true",
"x-requested-with": "XMLHttpRequest",
"Referer": fetchstring,
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": bodystring,
"method": "POST"
});
let text = await response.text();
return text;
} // EndFunction
//--------------------------------------------------------------------------------------------------------------------
// Function CreateStates
//--------------------------------------------------------------------------------------------------------------------
function CreateStates() {
if ( !existsState(dpPrice1 )) { createState(dpPrice1,0,{name: "guenstigster Preis", type: 'string', role: 'value'}, function () {}); }
if ( !existsState(dpPrice2 )) { createState(dpPrice2,0,{name: "Zweit guenstigster Preis", type: 'string', role: 'value'}, function () {}); }
if ( !existsState(dpPrice3 )) { createState(dpPrice3,0,{name: "Dritt guenstigster Preis", type: 'string', role: 'value'}, function () {}); }
if ( !existsState(dpDealer1)) { createState(dpDealer1,0,{name: "guenstigster Haendler", type: 'string', role: 'value'}, function () {}); }
if ( !existsState(dpDealer2)) { createState(dpDealer2,0,{name: "Zweit guenstigster Haendler", type: 'string', role: 'value'}, function () {}); }
if ( !existsState(dpDealer3)) { createState(dpDealer3,0,{name: "Dritt guenstigster Haendler", type: 'string', role: 'value'}, function () {}); }
} // End Function