Récupération de contenu web avec selenium et chromedriver Le sujet est résolu

Tout ce qui concerne la programmation.
Répondre
Avatar de l’utilisateur
lol
Site Admin
Site Admin
Messages : 4974
Inscription : 04 avr. 2016, 12:11
Localisation : Madagascar
Status : Hors-ligne

Salut,

Est-ce que quelqu'un ici fait ce genre de chose dans un environnement Debian:

Récupération du contenu d'une page Web générée avec du JavaScript en utilisant selenium et chromedriver ?
J'ai fait quelques essais et je galère un peu...
Règles d'usage du forum. Signalez si vous avez posté votre question sur un autre forum. Explications ici
Debian Unstable. Mate/LXQT. Dieu, en créant l'homme, a quelque peu surestimé ses capacités.
Avatar de l’utilisateur
lol
Site Admin
Site Admin
Messages : 4974
Inscription : 04 avr. 2016, 12:11
Localisation : Madagascar
Status : Hors-ligne

Je suis parvenu à mes fins avec un script php.
C'est résolu...

Code : Tout sélectionner

<?php

$url = "https://www.xxxxxxxxxxx.xxx/dat/pricea.json?nocache=".md5('rts' . time());
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$json = json_decode($response);
$count = count($json->itemdesc);

echo "<table>";
echo "<thead>";
    echo "<tr>";
        echo "<th>xxx</th>";
        echo "<th>xxx</th>";
        echo "<th>xxx</th>";
        echo "<th>xxx</th>";
    echo "</tr>";
echo "</thead>";
echo "<tbody>";

for($i = 0; $i < $count; $i++) {
    $price = round($json->itemprice[$i] * $json->usdeur * 100) * 0.01;
    echo "<tr>";
        echo "<td>{$json->itempart[$i]}</td>";
        echo "<td>{$json->itemdesc[$i]}</td>";
        echo "<td>&euro; $price</td>";
        echo "<td>{$json->iteminv[$i]}</td>";
    echo "<tr>";
}
echo "</tbody>";
echo "</table>";
Règles d'usage du forum. Signalez si vous avez posté votre question sur un autre forum. Explications ici
Debian Unstable. Mate/LXQT. Dieu, en créant l'homme, a quelque peu surestimé ses capacités.
Répondre