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 13.6k 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.
    • D Offline
      DarrenHill @MMRIZE
      last edited by DarrenHill

      @MMRIZE said in MMM-News and BBC:

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

      I get this, which looks slightly different to yours? :

      {"status":"ok","totalResults":10,"articles":[{"title":"Vaping: Juul to pay $438.5 m in youth marketing probe","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T19:52:21.045172Z","url":"http://www.bbc.co.uk/news/business-62813896"},{"title":"Eliza Fletcher: Police identify body found in search for heiress","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T16:52:18.6995928Z","url":"http://www.bbc.co.uk/news/world-us-canada-62811661"},{"title":"Ukraine war: Russians to pay €45 more to enter EU under new rules","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T16:37:23.3671715Z","url":"http://www.bbc.co.uk/news/world-europe-62811675"},{"title":"Fat Leonard: Malaysian businessman linked to US Navy scandal escapes","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T16:22:22.2671956Z","url":"http://www.bbc.co.uk/news/world-us-canada-62764226"},{"title":"Canada stabbings: Police hunt remaining suspect after Saskatchewan attacks","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T15:22:24.1190163Z","url":"http://www.bbc.co.uk/news/live/world-us-canada-62811629"},{"title":"Ukraine: Ben Stiller and Sean Penn latest Americans banned from Russia","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T12:52:14.8462267Z","url":"http://www.bbc.co.uk/news/world-europe-62806655"},{"title":"Canada stabbings: Relatives identify 'random' victims of Saskatchewan attack","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T11:07:21.1055569Z","url":"http://www.bbc.co.uk/news/world-us-canada-62804826"},{"title":"Liz Truss: Boris Johnson to give farewell speech before new PM takes office","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-06T04:37:21.3806544Z","url":"http://www.bbc.co.uk/news/live/uk-politics-62802807"},{"title":"Keith Davis: He was protecting the oceans - then he disappeared","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-05T20:52:23.0241991Z","url":"http://www.bbc.co.uk/news/world-us-canada-62603911"},{"title":"Timed Teaser: How did Putin mark Gorbachev's death?","author":"BBC News","source":{"Id":"bbc-news","Name":"BBC News"},"publishedAt":"2022-09-05T20:37:23.1798468Z","url":"http://www.bbc.co.uk/news/world-us-canada-62763889"}]}
      

      @sdetweil I’ll do your test now…

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

        @DarrenHill
        Ok, I found something. I don’t know why, but your result has “articles.source.Name” instead of “articles.source.name” that makes this error.

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

          @MMRIZE yes, was just about to post that

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @sdetweil I get this (for the relevant bit):

            
            [06.09.2022 21:11.46.552] [LOG]   fetch result= {
              status: 'ok',
              totalResults: 10,
              articles: [
                {
                  title: 'Vaping: Juul to pay $438.5 m in youth marketing probe',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T19:52:21.045172Z',
                  url: 'http://www.bbc.co.uk/news/business-62813896'
                },
                {
                  title: 'Eliza Fletcher: Police identify body found in search for heiress',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T16:52:18.6995928Z',
                  url: 'http://www.bbc.co.uk/news/world-us-canada-62811661'
                },
                {
                  title: 'Ukraine war: Russians to pay €45 more to enter EU under new rules',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T16:37:23.3671715Z',
                  url: 'http://www.bbc.co.uk/news/world-europe-62811675'
                },
                {
                  title: 'Fat Leonard: Malaysian businessman linked to US Navy scandal escapes',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T16:22:22.2671956Z',
                  url: 'http://www.bbc.co.uk/news/world-us-canada-62764226'
                },
                {
                  title: 'Canada stabbings: Police hunt remaining suspect after Saskatchewan attacks',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T15:22:24.1190163Z',
                  url: 'http://www.bbc.co.uk/news/live/world-us-canada-62811629'
                },
                {
                  title: 'Ukraine: Ben Stiller and Sean Penn latest Americans banned from Russia',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T12:52:14.8462267Z',
                  url: 'http://www.bbc.co.uk/news/world-europe-62806655'
                },
                {
                  title: "Canada stabbings: Relatives identify 'random' victims of Saskatchewan attack",
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T11:07:21.1055569Z',
                  url: 'http://www.bbc.co.uk/news/world-us-canada-62804826'
                },
                {
                  title: 'Liz Truss: Boris Johnson to give farewell speech before new PM takes office',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-06T04:37:21.3806544Z',
                  url: 'http://www.bbc.co.uk/news/live/uk-politics-62802807'
                },
                {
                  title: 'Keith Davis: He was protecting the oceans - then he disappeared',
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-05T20:52:23.0241991Z',
                  url: 'http://www.bbc.co.uk/news/world-us-canada-62603911'
                },
                {
                  title: "Timed Teaser: How did Putin mark Gorbachev's death?",
                  author: 'BBC News',
                  source: [Object],
                  publishedAt: '2022-09-05T20:37:23.1798468Z',
                  url: 'http://www.bbc.co.uk/news/world-us-canada-62763889'
                }
              ]
            }
            [06.09.2022 21:11.46.635] [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:136:22)
                at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
            
            
            
            
            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @DarrenHill
              last edited by

              @DarrenHill said in MMM-News and BBC:

                source: [Object],
              

              its in there

              Sam

              How to add modules

              learning how to use browser developers window for css changes

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

                @MMRIZE said in MMM-News and BBC:

                @DarrenHill
                Ok, I found something. I don’t know why, but your result has “articles.source.Name” instead of “articles.source.name” that makes this error.

                Anything I can do to overcome that?

                No idea why I’m getting different API returns to you guys…?

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

                  @DarrenHill @MMRIZE

                  also doesn’t get ‘content’ or ‘description’, so those will fail too…

                  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

                    I tried to register for a new api key, but when I tried it told me that they don’t support the UK (where I am) so I wonder if that somehow has something to do with it.

                    This has obviously changed since I first registered, and given I’m getting some response from the API it is at least partially working, but besides that I have no idea…

                    mumblebajM 1 Reply Last reply Reply Quote 0
                    • mumblebajM Offline
                      mumblebaj Module Developer @DarrenHill
                      last edited by

                      @DarrenHill Hi. Apologies for the late reply. I am on a different timezone than the other guys.

                      I would suggest using MMM-NewsAPI. The same API key that you are using with MMM-News will work.

                      Check out my modules at: https://github.com/mumblebaj?tab=repositories
                      Check my blog-post: https://mumblebaj.xyz/
                      Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

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

                        @mumblebaj - Thanks, no need to apologise.

                        I tried the other module, and it also doesn’t show anything besides it’s “News” header title.

                        The config I tried was:

                                {
                                    module: "MMM-NewsAPI",
                                    header: "News",
                                    position: "bottom_center",
                                    config: {
                                        apiKey : "<my API key>",
                                        domains: "bbc.co.uk",
                                        language: "en"
                                        }
                                },
                        
                        

                        And also I tried replacing the domains: with sources: “bbc-news” and that gave the same results.

                        There’s nothing in the logs, aside from confirming that the module is loading (as can be seen from the displayed title too).

                        S mumblebajM 3 Replies Last reply Reply Quote 0
                        • S Offline
                          sdetweil @DarrenHill
                          last edited by

                          @DarrenHill from the doc

                          Add DEBUG Handling.
                          Only add debug: true to the config section if you are experiencing issues and require more information to find issues.

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

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

                            @DarrenHill domins or sources must be inside the much more complex query section of the config

                            see the doc

                                                query: {
                                                        country: "",
                                                        category: "",
                                                        q: "",
                                                        qInTitle: "",
                                                        sources: "",
                                                        domains: "cnn.com,nytimes.com,news24.com",
                                                        excludeDomains: "",
                                                        language: ""
                                                }
                            

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 0
                            • mumblebajM Offline
                              mumblebaj Module Developer @DarrenHill
                              last edited by sdetweil

                              @DarrenHill MMM-NewsAPI has a whole lot more configs. See below sample.

                              {
                                                      module: "MMM-NewsAPI",
                                                      header: "news",
                                                     //  disabled: true,
                                                      position: "bottom_bar",
                                                      pages: {"sport": "bottom_bar"},
                                                      config: {
                                                              apiKey: <api-key>,
                                                              type: "horizontal",
                                                              choice: "everything",
                                                              pageSize: 20,
                                                              sortBy: "publishedAt",
                                                              drawInterval: 1000*30,
                                                              templateFile: "template.html",
                                                              fetchInterval: 1000*60*60,
                                                              query: {
                                                                      country: "",
                                                                      category: "",
                                                                      q: "",
                                                                      qInTitle: "",
                                                                      sources: "",
                                                                      domains: "bbc.co.uk",
                                                                      excludeDomains: "",
                                                                      language: ""
                                                                      }
                                                              }
                              				},

                              Check out my modules at: https://github.com/mumblebaj?tab=repositories
                              Check my blog-post: https://mumblebaj.xyz/
                              Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

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

                                @mumblebaj - Thanks for the support, and for both modules.

                                Unfortunately that gives me a headline in Spanish (I think) about Apple iPhone 14 with “undefined” below it.

                                I also tried your everything example configs from your GH page and got a similar layout (headline and undefined).

                                I’m beginning to think NewsAPI itself is screwed for me unfortunately, so we may be onto a loser here regardless of module.

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

                                  @mumblebaj i commented out your disabled: true,

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  1 Reply Last reply Reply Quote 1
                                  • mumblebajM Offline
                                    mumblebaj Module Developer @DarrenHill
                                    last edited by

                                    @DarrenHill That is very weird as the configs seem to work for me and the other guys who have tried to assist thus far.

                                    Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                    Check my blog-post: https://mumblebaj.xyz/
                                    Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

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

                                      @mumblebaj - Yes, as I said I’m starting to think that your modules are both working fine, but the API feed I’m getting from NewsAPI is somehow corrupted and they are universally having issues with it.

                                      I can’t create a new API key as it won’t let me (it says they don’t support UK now if you try and create a new key from here), and I guess that might be related somehow?

                                      4223b88d-2348-4c14-8963-bdfe989b087c-image.png

                                      So I think we might be at a dead end here unfortunately with anything that’s using that API as its source.

                                      mumblebajM S 2 Replies Last reply Reply Quote 0
                                      • mumblebajM Offline
                                        mumblebaj Module Developer @DarrenHill
                                        last edited by

                                        @DarrenHill The data coming through is fine as it works for me with the source that you provided. Not sure why you not able to create an API key though. I just tested creating another API Key and that worked as well. Unfortunately I am not able to assist with getting a key created.

                                        Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                        Check my blog-post: https://mumblebaj.xyz/
                                        Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

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

                                          @DarrenHill see my chat message

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

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

                                            @mumblebaj newsapi.org free is only 100 calls per day

                                            I guess 4/hour is ok

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • 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