MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-News and BBC

    Scheduled Pinned Locked Moved Solved Troubleshooting
    40 Posts 4 Posters 10.2k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @DarrenHill
      last edited by

      @DarrenHill alt-spacebar, n

      MagicMirror is the app created by my install

      mm is the one created by following the manual instructions.

      pm2 stop all
      will stop everything

      pm2 info 0 (or name) will dump out the info about what is to be run…
      for MagicMirror it is /home/pi/MagicMirror/I stallers/mm.sh

      to delete an entry

      pm2 delete 0( or 1 or a name)
      then pm2 save to update the pm2 startup cache

      pm2 --help, like most Linux commands will tell you all the things it can do

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      D 2 Replies Last reply Reply Quote 0
      • D Offline
        DarrenHill @sdetweil
        last edited by

        @sdetweil Thanks - I just found the wiki page about auto starting and saw I had somehow got it running twice.

        That’s now fixed, but after a reboot the module issue still remains.

        I’ll go check logs and console now.

        1 Reply Last reply Reply Quote 0
        • D Offline
          DarrenHill @sdetweil
          last edited by

          @sdetweil OK I’ve found a News module error in the MagicMirror-out.log:

          [06.09.2022 20:26.46.502] [LOG]   [NEWS] Error :  https://newsapi.org/v2/top-headlines?sources=bbc-news&pageSize=100&apiKey=<redacted> TypeError: Cannot read properties of undefined (reading 'toString')
          
              at slugify (/home/pi/MagicMirror/modules/MMM-News/node_helper.js:24:17)
              at cb (/home/pi/MagicMirror/modules/MMM-News/node_helper.js:89:33)
              at getArticles (/home/pi/MagicMirror/modules/MMM-News/node_helper.js:135:22)
              at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
          
          

          I’ve removed my API key string, but the rest is copy/paste.

          I tried a git pull on the module the other day before my first post here, and it’s up to date.

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @DarrenHill
            last edited by

            @DarrenHill that error means the content back from the API is not as expected. either nothing there or the format changed.

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              DarrenHill @sdetweil
              last edited by

              @sdetweil OK, although from what @mumblebaj posted above it still works for him with my config?

              I’ll try removing it and reinstalling it and see if that helps.

              S M 2 Replies Last reply Reply Quote 0
              • S Offline
                sdetweil @DarrenHill
                last edited by

                @DarrenHill not a reinstall thing

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                D 1 Reply Last reply Reply Quote 0
                • D Offline
                  DarrenHill @sdetweil
                  last edited by

                  @sdetweil OK.

                  So I guess I’m stuck for now unless you or the others have any suggestions.

                  I was wondering as you say if the incoming info format had changed when it started throwing the #null text, but it’s weird that it works for others?

                  S 1 Reply Last reply Reply Quote 0
                  • M Offline
                    MMRIZE @DarrenHill
                    last edited by MMRIZE

                    @DarrenHill
                    Well, I also tried your config with my apiKey and it worked.

                    Try this in your browser and let’s see what happens.

                    https://newsapi.org/v2/top-headlines?sources=bbc-news&pageSize=100&apiKey=YOUR_KEY

                    M 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @DarrenHill
                      last edited by sdetweil

                      @DarrenHill ediut node_helper.js

                      insert this line

                            console.log("fetch result=",result)
                      

                      after line 128 so it looks like this

                            var result = await response.json()
                            console.log("fetch result=",result)
                            return(result)
                      

                      then rerun MM… best to stop using pm2 for all this

                      pm2 stop all
                      

                      then

                      cd ~/MagicMirror
                      npm start >somefile.txt 2>&1
                      

                      wait 15 seconds

                      ctrl-m to minimize MM
                      then ctrl-c on the terminal window you use to start MM

                      then edit somefile.txt

                      to look for status:
                      (ctrl-w in nano)

                      this is another dumb api… there is an error , but it doesn’t return it in the return code, but in the data!!!.. stupid…

                      for mine it says (with a bad key)

                      [06.09.2022 14:56.29.138] [LOG]   fetch result= {
                        status: 'error',
                        code: 'apiKeyInvalid',
                        message: 'Your API key is invalid or incorrect. Check your key, or go to https://newsapi.org to create a free API key.'
                      }
                      

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      D 1 Reply Last reply Reply Quote 0
                      • M Offline
                        MMRIZE @MMRIZE
                        last edited by

                        @MMRIZE said in MMM-News and BBC:

                        @DarrenHill
                        Well, I also tried your config with my apiKey and it worked.

                        Try this in your browser and let’s see what happens.

                        https://newsapi.org/v2/top-headlines?sources=bbc-news&pageSize=100&apiKey=YOUR_KEY

                        It should be like something similar to this(if your apiKey is valid);

                        {"status":"ok","totalResults":10,"articles":[{"source":{"id":"bbc-news","name":"BBC News"},"author":"BBC News","title":"Vaping: Juul to pay $438.5 m in youth marketing probe","description":"US prosecutors accuse the firm of \"relentlessly\" targeting underage buyers.","url":"http://www.bbc.co.uk/news/business-62813896","urlToImage":"https://ichef.bbci.co.uk/news/1024/branded_news/1F91/production/_126618080_323275f83124ee4f8c4cbed6b71c6807fe92d57c.jpg","publishedAt":"2022-09-06T19:52:21.045172Z","content":"Juul Labs will pay $438.5m (£380m) to end a probe of its advertising to underage buyers as it rose to be one of the top e-cigarette firms in the US.\r\nThe deal with 33 states and Puerto Rico also rest… [+1826 chars]"}, …
                        
                        D 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 4 / 4
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy