Scrapping a dynamic (AJAX) page

Dear community,

I've read every post that contains "scrap" but couldn't find an answer to my problem (most likely because of my ignorance). Here is what I'd like to do:
The (Greek) webpage ΔΕΔΔΗΕ Α.Ε. - Προγραμματισμένες Διακοπές Ηλεκτροδότησης lists all planned power outages for a certain region. Functionality is pretty straightforward. You select a prefecture and optionally and municipality. The selection trigers the display of potential outages.

My question is: how to get the information for a certain selection?

Thanks a lot for your help!

Start by using the browser's dev tools network page and try changing the location dropdown.

You will see that the page does a POST to ΔΕΔΔΗΕ Α.Ε. - Προγραμματισμένες Διακοπές Ηλεκτροδότησης and you will see the data that posts and the request headers.

You will need to at least reproduce the form data, possibly some of the headers as well. The http-request node can help with all of that.

:pensive: Thanks, Julian, but I don't know what the next step would be. I already had checked the Network tab. When the drop down changes the debugger captures a jquery:
image.
What can I do with that?

In the dev Tools select the Payload and check what is transferred:

You find for example:

  • PrefectureID: 8
  • MunicipalityID: 71

The possible IDs are in the HTML of the site as well...
You can leave MunicipalityID empty to get all of PrefectureID.

Add the IDs to a json and send to the HTTP node:

[{"id":"461745baae18a16c","type":"inject","z":"107bc4516afa2130","name":"","props":[{"p":"prefectureID","v":"8","vt":"str"},{"p":"municipalityID","v":"71","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":180,"wires":[["5b9f9217abdde5a9"]]},{"id":"dec5f37c05641642","type":"debug","z":"107bc4516afa2130","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":180,"wires":[]},{"id":"398e6c1bd4d7c45a","type":"http request","z":"107bc4516afa2130","name":"","method":"POST","ret":"txt","paytoqs":"body","url":"https://siteapps.deddie.gr/Outages2Public/?Length=4","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":570,"y":180,"wires":[["489fa760b87a2beb"]]},{"id":"489fa760b87a2beb","type":"html","z":"107bc4516afa2130","name":"","property":"payload","outproperty":"payload","tag":"tr","ret":"text","as":"single","x":750,"y":180,"wires":[["dec5f37c05641642"]]},{"id":"5b9f9217abdde5a9","type":"change","z":"107bc4516afa2130","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"PrefectureID\":msg.prefectureID,\"MunicipalityID\":msg.municipalityID,\"X-Requested-With\":\"XMLHttpRequest\"}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":180,"wires":[["398e6c1bd4d7c45a"]]}]

Result:

Format result as you like.

2 Likes

Thanks a ton, @cameo69!!! :clap:
Now, I know how to handle that.

Thanks to both of you!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.