1

On https://www.meinfluessiggas.de one has to click a tank size button (section “Behältergröße”) and fill in a postal code (section “PLZ Behälterstandort”) for the price to appear on the right. I want to automate this in a bash script but struggle on retrieving the correct information:

wget https://www.meinfluessiggas.de

loads the page source correctly, but it doesn't contain the price information. I found out that there are some javascript functions that load the price information, so following the approach in SU: Command line browser with js support I tried

phantomjs save_page.js https://www.meinfluessiggas.de > page.html

and it retrieves the source code including some price information, but unfortunately just for the smallest tank size, the button which is selected by default.

Assuming

tank=2700 # or 1.2, or 12, whatever is the simplest
postal=88448

how can I retrieve the price information from this website in a bash script?

1 Answer 1

1

By careful examining the source code I was able to determine the source where the javascript function gets the price information from:

<div class="options__field options__field--zip select-12">
  <label>PLZ <span class="small">Behälterstandort</span></label>
  <div class="input-box">
    <select name="options[4066]" id="select_4066"
      class=" product-custom-option" title="" data-placeholder="Ihre PLZ"
      data-url="https://www.meinfluessiggas.de/dfg/index/index/size/1.2/?v=1.1"
      data-size="12" data-chosentype="zip" onchange="opConfig.reloadPrice()">
      <option value="">Lädt...</option>
    </select>
  </div>
</div>

The interesting part here is:

data-url="https://www.meinfluessiggas.de/dfg/index/index/size/1.2/?v=1.1"

A list of prices can be obtained from this url simply with wget, incorporating the variables from the question:

$ tank=1.2
$ postal=88448
$ wget -qO- https://www.meinfluessiggas.de/dfg/index/index/size/$tank | sed 's/.*"\([^"]*\)" >'$postal'.*/\1/'
0.4049

In the URL I omitted /?v=1.1 because it doesn't seem to change anything (tested for 0.1 to 4.9).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .