Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [gelöst] Modul cheerio ohne Funktion in Javascript

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Modul cheerio ohne Funktion in Javascript

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

      Für ein Script (von @OliverIO - siehe https://forum.iobroker.net/topic/60747/daten-aus-pw-geschützte-website/20?_=1670607484863) benötige ich das Modul cheerio im Javascript-Adapter, doch leider ist das Modul bei mir wirkungslos und wirft auch keine Fehler.

      Zu meiner Konfiguration:

      • Admin: 6.2.23
      • js-controller: 4.0.23
      • javascript: 6.1.4
      • Node.js: v16.18.1
      • NPM: 8.19.2

      Einstellung im Javascript-Adapter:
      e5b7480b-9dd0-4839-a954-3d809537fd10-grafik.png

      cheerio im ioBroker:

      latzi@ioBroker:/opt/iobroker$ npm list cheerio
      iobroker.inst@3.0.0 /opt/iobroker
      ├── cheerio@1.0.0-rc.12
      ├─┬ iobroker.javascript@6.1.4
      │ └── cheerio@1.0.0-rc.12
      └─┬ iobroker.smartcontrol@1.3.2
        └── cheerio@1.0.0-rc.12 deduped
      latzi@ioBroker:/opt/iobroker$
      

      Testscript:

      const cheerio = require('cheerio');
      const $ = cheerio.load('<h2 class="title">Hello world</h2>');
      $('h2.title').text('Hello there!');
      $('h2').addClass('welcome');
      $.html();
      

      Leider kommt kommt keine Ausgabe (und auch keine Fehlermeldung trotz debug) 😞
      Zu erwarten wäre:

      15:18:58.522	debug javascript.0 (3875) script.js.Test.test: <html><head></head><body><h2 class="title welcome">Hello there!</h2></body></html> 
      

      Hat jemand eine Idee wie ich das lösen kann?

      OliverIO bahnuhr 2 Replies Last reply Reply Quote 0
      • OliverIO
        OliverIO @Latzi last edited by

        @latzi
        Evtl ergänzend.
        Bei mindestens 2 anderen funktioniert das einwandfrei
        Und kann gerne durch jeden anderen getestet werden

        1 Reply Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active @Latzi last edited by

          @latzi

          Ich hatte auch schon cheerio in js.
          Lief bei mir Anfangs. Nach irgendeinem Update lief es dann nicht mehr.

          Musste dies dann durch andere Befehle entsprechend ersetzen.
          Gibt dazu hier irgendwo auch ein thread von mir.

          Fazit bei mir:
          cheerio ging dann nicht mehr.

          F 1 Reply Last reply Reply Quote 0
          • F
            fastfoot @bahnuhr last edited by

            @bahnuhr sagte in Modul cheerio ohne Funktion in Javascript:

            Fazit bei mir:
            cheerio ging dann nicht mehr.

            das kenne ich auch, war aber eine frühere Version. Jetzt mit der 1.0.0-rc.12 funktioniert alles wie es soll.

            1 Reply Last reply Reply Quote 0
            • Latzi
              Latzi last edited by

              Aus irgend einem Grund kommt meine ScriptEngine mit dem console.debugnicht klar (auch wenn debug eingestellt ist), jedoch mit log oder console.log erhalte ich die Ausgaben.

              Somit ist das Thema für mich gelöst (zumindest was die Funktion von cheerio angeht).

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              651
              Online

              31.8k
              Users

              80.0k
              Topics

              1.3m
              Posts

              javascript
              4
              5
              323
              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