Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Parser: TV-Sender Fußball [Closed]

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Parser: TV-Sender Fußball [Closed]

    This topic has been deleted. Only users with topic management privileges can see it.
    • OliverIO
      OliverIO @adsfa last edited by

      @adsfa
      parseFloat ist eine Funktion die das Ergebnis zurück gibt, daher musst du es auch zuweisen

      preis = parseFloat(preis);
      
      A 2 Replies Last reply Reply Quote 1
      • A
        adsfa @OliverIO last edited by

        @oliverio Super, vielen Dank!! 🙂

        1 Reply Last reply Reply Quote 0
        • A
          adsfa @OliverIO last edited by adsfa

          @oliverio
          Ich hätte nochmal eine Frage zu einer anderen Webseite bei der ich es leider nicht hinbekomme den Preis zu erfragen. Wenn man die Seite öffnet erscheint der Preis erst nach 1 Sekunde, evtl. liegt es daran?
          Leider kommt ein leeres Ergebnis raus.

          Link: https://www.thenorthface.de/shop/de/tnf-de/carto-triclimate-jacke-fuer-damen-5iwj

          const cheerio = require('cheerio');
          const axios = require('axios');
          
          async function Scrape() {
              const response = await axios.get('https://www.thenorthface.de/shop/de/tnf-de/carto-triclimate-jacke-fuer-damen-5iwj');
              const $ = cheerio.load(response.data);
              let preis = $('#product-info > div.product-content-info-price.product-price.product-price-js > span.product-content-info-offer-price.offer-price.offer-price-js.product-price-amount-js').text();
          
              console.log(preis);
          }
          Scrape();
          

          Das ist der JS-Path und die Abänderung (ich lösche alles vor der Klammer und ändere die Anführungszeichen von " in '.

          document.querySelector("#product-info > div.product-content-info-price.product-price.product-price-js > span.product-content-info-offer-price.offer-price.offer-price-js.product-price-amount-js")
          '#product-info > div.product-content-info-price.product-price.product-price-js > span.product-content-info-offer-price.offer-price.offer-price-js.product-price-amount-js'
          
          OliverIO 1 Reply Last reply Reply Quote 0
          • OliverIO
            OliverIO @adsfa last edited by

            @adsfa
            sorry, hat ein wenig gedauert.

            dein skript hat deswegen kein ergebnis, weil der preis in der datei gar nicht enthalten ist, sondern nur ein platzhalter, der später dann durch javascript gefüllt wird.
            der wirkliche preis wird von der seite dynamisch abgerufen und ist in dieser datei enthalten

            https://www.thenorthface.de/webapp/wcs/stores/servlet/VFAjaxItemPricingView?requestype=ajax&storeId=7007&langId=-3&catalogId=13505&productId=1144743&requesttype=ajax

            da wird dann direkt ein json objekt zurückgegeben, das du direkt auswerten kanns.
            ob die abfrage allerdings noch zusätzlich gesichert ist, so das man das nicht strukturiert per skript abrufen kann, hab ich nicht ausprobiert

            A 1 Reply Last reply Reply Quote 1
            • A
              adsfa @OliverIO last edited by

              @oliverio Vielen Dank! Danke das habe ich so ungefähr verstanden :).
              Wie hast du den Link gefunden?

              OliverIO 1 Reply Last reply Reply Quote 0
              • OliverIO
                OliverIO @adsfa last edited by

                @adsfa
                Mir den Developer Tools des browsers geschaut was die Seite da noch lädt.

                A 1 Reply Last reply Reply Quote 1
                • A
                  adsfa @OliverIO last edited by

                  @oliverio Vielen Dank! Ich hätte nochmal eine Frage, falls das ok ist.

                  Wie kann ich auf ein Element klicken?
                  Ich habe z.B. diese Adidas Seite und würde gerne auf die Schuhgröße klicken. Geht das?

                  const cheerio = require('cheerio');
                  const axios = require('axios');
                  
                  async function Scrape() {
                      const response = await axios.get('https://www.adidas.de/adilette-aqua-slides/F35550.html');
                      const $ = cheerio.load(response.data);
                      let preis  = $('#main-content > div.sidebar-wrapper___3uF26 > div.sidebar___29cCJ > div > div.product-price___2Mip5.gl-vspace > div.price___Z74_w.price___35NVI.gl-flex-col > div > div > div').text();
                      let lieferzeit = $('#main-content > div.sidebar-wrapper___3uF26 > div.sidebar___29cCJ > section > div.gl-callout.backorder-callout___Sa5vJ > div > h5').text();
                  
                      console.log(preis);
                      console.log(lieferzeit );
                  }
                  Scrape();
                  

                  Vielen Dank 🙂

                  OliverIO 1 Reply Last reply Reply Quote 0
                  • OliverIO
                    OliverIO @adsfa last edited by OliverIO

                    @adsfa
                    theoretisch ja.
                    allerdings wird beim klick auf die schuhgröße eine kauderwelsch adresse aufgerufen
                    https://www.adidas.de/Gnb58ttYk1PE/cL/2Crmr3uBA4/ii1wmh7OOp/ITULbHd7Rgg/aUMoS/HsEYgsB

                    in diesem kauderwelch sind sicherlich alle produktparameter hinein verschlüsselt.
                    um diesen link zu ermitteln müsste man zunächst den code analysieren.
                    Das ist ziemlich aufwändig.

                    Andere Alternative wäre mit pupeteer die adresse aufzurufen und dann anweisungen zu geben ein bestimmtes element zu laden und aus der seite dann den text extrahieren.
                    Auch das ist aufwändig, da im hintergrund ein kompletter browser geladen wird.

                    im obigen beispiel werden ja nur die html-daten geladen und mittels einer jquery ähnlichen bibliothek ausgewertet. aber es wird kein browser ausgeführt.

                    beide methoden funktionieren nur solange bis die seite in seiner struktur geändert wird, dann muss man das wieder neu aufbauen.

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      adsfa @OliverIO last edited by

                      @oliverio Vielen Dank für die ausführliche Beschreibung.
                      Dann schaue ich mir Pupeteer mal genauer an und Selenium über Python steht auch auf meiner Liste.

                      OliverIO 1 Reply Last reply Reply Quote 0
                      • OliverIO
                        OliverIO @adsfa last edited by

                        @adsfa
                        pupeteer ist direkt für nodejs und macht mehr oder weniger genau das selbe wie selenium.
                        es sind aber beide keine easy benutzerprogramme sondern erfordern jeweils programmier skills, sonst kannst damit nicht wirklich was anfangen

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          Digi-Bit @OliverIO last edited by

                          Hallo,

                          Ist schon etwas älter das Thema aber ich habe das JS ja von hier und vielleicht ist dies dann so einfacher.

                          const cheerio = require('cheerio');
                          const axios = require('axios');
                          const dp = "0_userdata.0.test1";
                           
                          async function getFussball() {
                              const response = await axios.get('https://www.fussball-im-tv.com/team/colonia');
                              const $ = cheerio.load(response.data);
                              let datum = $('#utcRelativeContent > table:nth-child(1) > tbody > tr.cabeceraTabla > td').text();
                              let uhr = $('#utcRelativeContent > table:nth-child(1) > tbody > tr:nth-child(2) > td.hora').text();
                              let lokal = $('#utcRelativeContent > table:nth-child(1) > tbody > tr:nth-child(2) > td.local > span').text();
                              let visitor = $('#utcRelativeContent > table:nth-child(1) > tbody > tr:nth-child(2) > td.visitante > span').text();
                              let tv = $('#utcRelativeContent > table:nth-child(1) > tbody > tr:nth-child(2) > td.canales > ul li').toArray().map(el=>$(el).text()).join(", ");
                              setState(dp,lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                              console.log(lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                          }
                          getFussball();
                           
                          
                          

                          dies funktionier leider nicht mehr 😧

                          bei den oberen beiden Zeilen ist jetzt auch eine rote "welle" drunter also denke ich das es damit irgend wie zusammen hängt
                          Bild_2024-02-15_174355633.png

                          im Adapter ist auch noch alles eingetragen

                          Bild_2024-02-15_174554863.png

                          Ich habe auch schon ein altes Backup installiert aber aber auch da geht es nicht 😞

                          Kann mir da jemand weiter helfen den ich fand es recht nützlich nicht immer suchen zu müssen auf welchem Portal man sich das Fussball spiel anschauen kann !

                          mfg

                          Digi-Bit

                          OliverIO 1 Reply Last reply Reply Quote 0
                          • OliverIO
                            OliverIO @Digi-Bit last edited by

                            @digi-bit

                            Der Anbieter hatte leichte Änderungen an seiner Seite vorgenommen

                            const cheerio = require('cheerio');
                            const axios = require('axios');
                            const dp = "0_userdata.0.test1";
                             
                            async function getFussball() {
                                const response = await axios.get('https://www.fussball-im-tv.com/team/colonia');
                                const $ = cheerio.load(response.data);
                                let datum = $('#utcRelativeContent > table:nth-child(2) > tbody > tr.cabeceraTabla > td').text();
                                let uhr = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.hora').text();
                                let lokal = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.local > span').text();
                                let visitor = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.visitante span').text();
                                let tv = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.canales > ul li').toArray().map(el=>$(el).text()).join(", ");
                                setState(dp,lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                                console.log(lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                            }
                            getFussball();
                            
                            D 1 Reply Last reply Reply Quote 1
                            • D
                              Digi-Bit @OliverIO last edited by

                              @oliverio sagte in Parser: TV-Sender Fußball [Closed]:

                              @digi-bit

                              Der Anbieter hatte leichte Änderungen an seiner Seite vorgenommen

                              const cheerio = require('cheerio');
                              const axios = require('axios');
                              const dp = "0_userdata.0.test1";
                               
                              async function getFussball() {
                                  const response = await axios.get('https://www.fussball-im-tv.com/team/colonia');
                                  const $ = cheerio.load(response.data);
                                  let datum = $('#utcRelativeContent > table:nth-child(2) > tbody > tr.cabeceraTabla > td').text();
                                  let uhr = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.hora').text();
                                  let lokal = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.local > span').text();
                                  let visitor = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.visitante span').text();
                                  let tv = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.canales > ul li').toArray().map(el=>$(el).text()).join(", ");
                                  setState(dp,lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                                  console.log(lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                              }
                              getFussball();
                              

                              Hallo,

                              Ahhh, danke erstmal aber leider wird der "lokal " nicht angezeigt, kannst du da noch was machen ?

                              mfg

                              Digi-Bit

                              OliverIO 1 Reply Last reply Reply Quote 0
                              • OliverIO
                                OliverIO @Digi-Bit last edited by OliverIO

                                dann so

                                @digi-bit sagte in Parser: TV-Sender Fußball [Closed]:

                                const cheerio = require('cheerio');
                                const axios = require('axios');
                                const dp = "0_userdata.0.test1";
                                 
                                async function getFussball() {
                                    const response = await axios.get('https://www.fussball-im-tv.com/team/colonia');
                                    const $ = cheerio.load(response.data);
                                    let datum = $('#utcRelativeContent > table:nth-child(2) > tbody > tr.cabeceraTabla > td').text();
                                    let uhr = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.hora').text();
                                    let lokal = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.local span').text();
                                    let visitor = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.visitante span').text();
                                    let tv = $('#utcRelativeContent > table:nth-child(2) > tbody > tr:nth-child(2) > td.canales > ul li').toArray().map(el=>$(el).text()).join(", ");
                                    setState(dp,lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                                    console.log(lokal + " - " + visitor + " | " + datum + " um " + uhr + " | " + tv);
                                }
                                getFussball();
                                
                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                1.0k
                                Online

                                31.7k
                                Users

                                79.8k
                                Topics

                                1.3m
                                Posts

                                4
                                25
                                1411
                                Loading More Posts
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes
                                Reply
                                • Reply as topic
                                Log in to reply
                                Community
                                Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                The ioBroker Community 2014-2023
                                logo