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 newsapi help

    Scheduled Pinned Locked Moved Solved Troubleshooting
    11 Posts 4 Posters 6.0k 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.
    • 1 Offline
      1a2a3a
      last edited by 1a2a3a

      hi i cant seems to get to module to work as intended.

      is it possible to specify 2 countries?
      even then, when i specify country as SG, it keep showing me the default news from 24news.

      what am i doing wrong here?

      {
                     module: "MMM-NewsAPI",
                     header: "news",
                     position: "top_center",
                     config: {
                             apiKey: "12345",
                             type: "horizontal",
                             choice: "headlines",
                             pageSize: 10,
                             sortBy: "publishedAt",
                             drawInterval: 1000*30,
                             templateFile: "template.html",
                             fetchInterval: 1000*60*60,
                             QRCode: true,
                             query: {
                                     country: "sg",
         			category: "",
         			q: "",
                                     qInTitle: "",
                                     domains: "",
                                     excludeDomains: "",
                                     language: "",
                             }
                     }
             },
      
      1 Reply Last reply Reply Quote 0
      • M Offline
        MMRIZE @1a2a3a
        last edited by MMRIZE

        @1a2a3a

        When you set choices:'headlines' and query.country: 'sg', it doesn’t mean news from Singapore press. Rather, it would be more similar to About/For Singapore or Popular in Singapore.

        Usually for news from Specific national press, sources: [...] would be used.
        For example;

        sources: ['bild', 'die-zeit'], 
        

        will show the news from the specific sources of Germany.

        You can check sources by nation like this by yourself.

        # Open your browser then navigate to here;
        https://newsapi.org/v2/top-headlines/sources?country=de&apiKey=YOUR_API_KEY
        

        a846d5ff-f7ae-4b9f-b36c-31e5fec90de8-image.png

        But unfortunately, For Singapore, there is no registered national source for this API.
        fdc62d89-c3b5-41dd-a6ed-9e93f075af96-image.png

        It means even though this NewsAPI collects the news from various sources, you cannot specify the sources from only Singapore. You are not alone. For many countries, the API doesn’t provide the national source.

        1 1 Reply Last reply Reply Quote 1
        • 1 Offline
          1a2a3a
          last edited by

          @mumblebaj help please?

          S mumblebajM 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @1a2a3a
            last edited by

            @1a2a3a looking at the newsapi doc says comma separated for multiples… doesn’t says country can be, or not.

            you may need to restrict domains…

            just from looking at tje newsapi doc
            @mumblebaj any help?

            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 @1a2a3a
              last edited by

              @1a2a3a Hi. Apologies for the late reply. Timezone difference. It does not support multiple countries. Blank for all countries or only a single country specified.

              Check out my modules at: https://github.com/mumblebaj?tab=repositories
              Check my blog-post: https://mumblebaj.xyz/

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

                @mumblebaj no apologies needed on the late reply, all well and understood. That’s unfortunate. Was really hoping for multiple country and sources. Can I assume if I really want multiple, I’ll need to have multiple module instances of newsapi?

                Are there any modules anyone know of that can newsfeed support multiple countries?

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

                  @1a2a3a Yeah, unfortunately it would mean a bit of a re-write to perform multiple calls per country but that would mean your call limit would get finished much much quicker.

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories
                  Check my blog-post: https://mumblebaj.xyz/

                  S 1 2 Replies Last reply Reply Quote 0
                  • S Offline
                    sdetweil @1a2a3a
                    last edited by

                    @1a2a3a this modules doesn’t support multiple instances.

                    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 @mumblebaj
                      last edited by

                      @mumblebaj and if multiple instances same problem

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 1
                      • 1 Offline
                        1a2a3a @mumblebaj
                        last edited by 1a2a3a

                        @mumblebaj i cant get my newsapi to work properly.

                        im trying to get SG all news. i set country to SG but its return other country news like 1News, AZoM. i dont understand why?

                        {
                                       module: "MMM-NewsAPI",
                                       header: "News",
                                       position: "top_center",
                                       config: {
                                               apiKey: "12345",
                                               type: "horizontal",
                                               choice: "headlines",
                                               pageSize: 50,
                                               
                                               drawInterval: 1000*30,
                                               templateFile: "template.html",
                                               fetchInterval: 1000*60*60,
                                               QRCode: true,
                                               query: {
                                                       country: "sg",
                           			
                           			category: "",
                           			
                           			
                                                       source: "",
                                                       domains: "",
                                                       excludeDomains: "",
                                                       language: "en",
                                               }
                                       }
                               },
                        
                        M 1 Reply Last reply Reply Quote 0
                        • M Offline
                          MMRIZE @1a2a3a
                          last edited by MMRIZE

                          @1a2a3a

                          When you set choices:'headlines' and query.country: 'sg', it doesn’t mean news from Singapore press. Rather, it would be more similar to About/For Singapore or Popular in Singapore.

                          Usually for news from Specific national press, sources: [...] would be used.
                          For example;

                          sources: ['bild', 'die-zeit'], 
                          

                          will show the news from the specific sources of Germany.

                          You can check sources by nation like this by yourself.

                          # Open your browser then navigate to here;
                          https://newsapi.org/v2/top-headlines/sources?country=de&apiKey=YOUR_API_KEY
                          

                          a846d5ff-f7ae-4b9f-b36c-31e5fec90de8-image.png

                          But unfortunately, For Singapore, there is no registered national source for this API.
                          fdc62d89-c3b5-41dd-a6ed-9e93f075af96-image.png

                          It means even though this NewsAPI collects the news from various sources, you cannot specify the sources from only Singapore. You are not alone. For many countries, the API doesn’t provide the national source.

                          1 1 Reply Last reply Reply Quote 1
                          • 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