IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

récuperer des données d'un site n'apparaissant pas dans la source


Sujet :

Windows Forms

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2012
    Messages : 40
    Points : 17
    Points
    17
    Par défaut récuperer des données d'un site n'apparaissant pas dans la source
    Bonjour ,
    Voila je cherche a récupérer des donner sur ce site
    le souci c'est qu'il y a une parti des données que j'ai besoin qui sont dans un calendrier mais celles ci ne s'affiche pas dans le code source et du coup impossible de les récupérer avec htmlagilitypack(enfin je m y connait pas bien pour dire impossible)

    voici la page que je cherche à récupérer c'est dans l'onglet calendrier:
    https://www.airbnb.fr/rooms/656180

    je ne cherche pas une solution toute faite(sauf si vous me la proposez) mais au moins savoir vers quoi chercher car la je buche un peu :'(
    Merci d'avance

  2. #2
    Membre émérite Avatar de meziantou
    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Avril 2010
    Messages
    1 223
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2010
    Messages : 1 223
    Points : 2 439
    Points
    2 439
    Par défaut
    Le calendrier est chargé dynamiquement avec une requête à
    https://www.airbnb.fr/rooms/calendar...&cal_year=2013

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    <table cellspacing="0" id="calendar_table" style="width: 100%;">
      <tbody>
      	<tr>
        		<th>lun</th>
        		<th>mar</th>
        		<th>mer</th>
        		<th>jeu</th>
        		<th>ven</th>
        		<th>sam</th>
        		<th>dim</th>
      	</tr>
          <tr>
              <td id="day_0" class="realday in_the_past">
                  <span class="dom">25</span>
              </td>
     
              <td id="day_1" class="realday in_the_past">
                  <span class="dom">26</span>
              </td>
     
              <td id="day_2" class="realday in_the_past">
                  <span class="dom">27</span>
              </td>
     
              <td id="day_3" class="realday in_the_past">
                  <span class="dom">28</span>
              </td>
     
              <td id="day_4" class="realday in_the_past">
                  <span class="dom">1</span>
              </td>
     
              <td id="day_5" class="weekend in_the_past">
                  <span class="dom">2</span>
              </td>
     
              <td id="day_6" class="weekend in_the_past">
                  <span class="dom">3</span>
              </td>
     
          </tr>
          <tr>
              <td id="day_7" class="realday in_the_past">
                  <span class="dom">4</span>
              </td>
     
              <td id="day_8" class="realday in_the_past">
                  <span class="dom">5</span>
              </td>
     
              <td id="day_9" class="realday in_the_past">
                  <span class="dom">6</span>
              </td>
     
              <td id="day_10" class="realday in_the_past">
                  <span class="dom">7</span>
              </td>
     
              <td id="day_11" class="realday in_the_past">
                  <span class="dom">8</span>
              </td>
     
              <td id="day_12" class="weekend in_the_past">
                  <span class="dom">9</span>
              </td>
     
              <td id="day_13" class="weekend in_the_past">
                  <span class="dom">10</span>
              </td>
     
          </tr>
          <tr>
              <td id="day_14" class="realday in_the_past">
                  <span class="dom">11</span>
              </td>
     
              <td id="day_15" class="realday in_the_past">
                  <span class="dom">12</span>
              </td>
     
              <td id="day_16" class="realday in_the_past">
                  <span class="dom">13</span>
              </td>
     
              <td id="day_17" class="realday in_the_past">
                  <span class="dom">14</span>
              </td>
     
              <td id="day_18" class="realday in_the_past">
                  <span class="dom">15</span>
              </td>
     
              <td id="day_19" class="weekend in_the_past">
                  <span class="dom">16</span>
              </td>
     
              <td id="day_20" class="weekend in_the_past">
                  <span class="dom">17</span>
              </td>
     
          </tr>
          <tr>
              <td id="day_21" class="realday in_the_past">
                  <span class="dom">18</span>
              </td>
     
              <td id="day_22" class="realday in_the_past">
                  <span class="dom">19</span>
              </td>
     
              <td id="day_23" class="realday in_the_past">
                  <span class="dom">20</span>
              </td>
     
              <td id="day_24" class="realday in_the_past">
                  <span class="dom">21</span>
              </td>
     
              <td id="day_25" class="realday unavailable">
                  <span class="dom">22</span>
              </td>
     
              <td id="day_26" class="weekend unavailable">
                  <span class="dom">23</span>
              </td>
     
              <td id="day_27" class="weekend unavailable">
                  <span class="dom">24</span>
              </td>
     
          </tr>
          <tr>
              <td id="day_28" class="realday unavailable">
                  <span class="dom">25</span>
              </td>
     
              <td id="day_29" class="realday unavailable">
                  <span class="dom">26</span>
              </td>
     
              <td id="day_30" class="realday unavailable">
                  <span class="dom">27</span>
              </td>
     
              <td id="day_31" class="realday unavailable">
                  <span class="dom">28</span>
              </td>
     
              <td id="day_32" class="realday unavailable">
                  <span class="dom">29</span>
              </td>
     
              <td id="day_33" class="weekend unavailable">
                  <span class="dom">30</span>
              </td>
     
              <td id="day_34" class="weekend unavailable">
                  <span class="dom">31</span>
              </td>
     
          </tr>
      </tbody>
    </table>

  3. #3
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2012
    Messages : 40
    Points : 17
    Points
    17
    Par défaut
    merci meziantou pour ta réponse (et désole pour le retard de la réponse)
    maintenant j'ai comprit comment la fonction java est appelé mais quand je click sur le liens la page est vide sans code
    (même si tu ma s donné le code source que j'avais déjà récupéré grâce a google chrome),et même si j'appel le lien avec un htmlweb ou un webclient le doc reste vide(voici le code que je fais pour y arriver)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    Dim url As String = "https://www.airbnb.fr/rooms/calendar_tab_inner2/656180?cal_month=3&cal_year=2013"
                Dim web As New HtmlWeb
    Dim doc = web.Load(url)
    je passe par htmlweb ou webclient pour pouvoir parser ensuite avec htmlagilitypack
    Si y a un truc que j'ai zapper j'aimerai bien savoir stp merci

    et est il possible avec htmlagilitypack de recuperer les requete java directement?

  4. #4
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2012
    Messages : 40
    Points : 17
    Points
    17
    Par défaut
    Bonjour,
    Je revient sur ce sujet car j'arrive toujours pas a récuperer la page web du tableau qui est appeler via javascript
    mon doc est tjrs vide ou alors me met le liens url du tableau maisn'affiche rien d'autre et ceux en passant aussi bien par webrequest , htmlagility pack ou webbrowser
    donc si quelqu'un peux m'aider svp
    Merci

  5. #5
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2014
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 10
    Points : 12
    Points
    12
    Par défaut
    Possible avec XPath:

    le bouton Calendrier est accessible depuis:
    /html[1]/body[1]/div[5]/div[2]/div[1]/div[1]/ul[1]/li[4]/a[1]

    lun de Lundi est accessible depuis:
    /html[1]/body[1]/div[5]/div[2]/div[1]/div[1]/div[5]/div[1]/div[1]/div[3]/table[1]/tbody[1]/tr[1]/th[1]

    Reste a utiliser un invokemembers("click") pour acceder au calendrier et faire un foreach des nodes dans
    /html[1]/body[1]/div[5]/div[2]/div[1]/div[1]/div[5]/div[1]/div[1]/div[3]/table[1]/

    Bon courage!

    Ha et une petite astuce pour utiliser la dernière version de internet explorer dans le browser ca peut être utile (pas très propre mais ca fonctionne! juste a changer appli.exe par le nom du projet) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
     
                // Auto-detect last version of Internet Explorer
                string VersionIE = "";
                if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer", "svcVersion", "Not Exist").ToString() == "Not Exist") {
                    var CheckVersionIE = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("Version").ToString();
                    string[] FoundedVersionIE = CheckVersionIE.Split('.');
                    VersionIE = FoundedVersionIE[0];
                } else {
                    var ChecksvcVersionIE = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("svcVersion").ToString();
                    string[] FoundedsvcVersionIE = ChecksvcVersionIE.Split('.');
                    VersionIE = FoundedsvcVersionIE[0];
                }
     
                // Use Last IE Version
                RegistryKey registrybrowser = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
                if (registrybrowser == null) {
                    RegistryKey registryFolder = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl", true);
                    registrybrowser = registryFolder.CreateSubKey("FEATURE_BROWSER_EMULATION");
                }
                if (VersionIE == "11") {
                    registrybrowser.SetValue("appli.exe", 0x2AF8, RegistryValueKind.DWord);
                    registrybrowser.SetValue("appli.exe", 0x2AF8, RegistryValueKind.DWord);
                }
                if (VersionIE == "10") {
                    registrybrowser.SetValue("appli.exe", 0x02710, RegistryValueKind.DWord);
                    registrybrowser.SetValue("appli.vshost.exe", 0x02710, RegistryValueKind.DWord);
                }
                if (VersionIE == "9") {
                    registrybrowser.SetValue("appli.exe", 0x2328, RegistryValueKind.DWord);
                    registrybrowser.SetValue("appli.vshost.exe", 0x2328, RegistryValueKind.DWord);
                }
                if (VersionIE == "8") {
                    registrybrowser.SetValue("appli.exe", 0x1F40, RegistryValueKind.DWord);
                    registrybrowser.SetValue("appli.vshost.exe", 0x1F40, RegistryValueKind.DWord);
                }
                if (VersionIE == "7") {
                    registrybrowser.SetValue("appli.exe", 0x1B58, RegistryValueKind.DWord);
                    registrybrowser.SetValue("appli.vshost.exe", 0x1B58, RegistryValueKind.DWord);
                }
                registrybrowser.Close();

  6. #6
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mars 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mars 2012
    Messages : 40
    Points : 17
    Points
    17
    Par défaut
    Merci pour la réponse je suis passer a autre chose pour le moment et je suis déjà assez éparpiller comme ça
    je vous tient au courant
    Bonne journée

Discussions similaires

  1. Réponses: 5
    Dernier message: 22/05/2008, 03h07
  2. Réponses: 1
    Dernier message: 09/04/2008, 22h27
  3. Récuperer des données de fiches passées au scanner
    Par Sunchaser dans le forum C++Builder
    Réponses: 8
    Dernier message: 17/11/2006, 23h44
  4. Comment récuperer des données entrées au clavier?
    Par Elisée A. dans le forum MFC
    Réponses: 2
    Dernier message: 13/02/2004, 07h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo