• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 4.4k 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 Dec 3, 2023, 3:51 PM Dec 3, 2023, 3:50 PM

    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 Dec 7, 2023, 4:14 PM Dec 7, 2023, 4:08 PM

      @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 Dec 9, 2023, 5:14 PM Reply Quote 1
      • 1 Offline
        1a2a3a
        last edited by Dec 5, 2023, 5:22 PM

        @mumblebaj help please?

        S M 2 Replies Last reply Dec 5, 2023, 6:27 PM Reply Quote 0
        • S Away
          sdetweil @1a2a3a
          last edited by Dec 5, 2023, 6:27 PM

          @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
          • M Online
            mumblebaj Module Developer @1a2a3a
            last edited by Dec 6, 2023, 4:05 PM

            @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

            1 1 Reply Last reply Dec 6, 2023, 4:16 PM Reply Quote 0
            • 1 Offline
              1a2a3a @mumblebaj
              last edited by Dec 6, 2023, 4:16 PM

              @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?

              M S 2 Replies Last reply Dec 6, 2023, 4:19 PM Reply Quote 0
              • M Online
                mumblebaj Module Developer @1a2a3a
                last edited by Dec 6, 2023, 4:19 PM

                @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

                S 1 2 Replies Last reply Dec 6, 2023, 4:21 PM Reply Quote 0
                • S Away
                  sdetweil @1a2a3a
                  last edited by Dec 6, 2023, 4:19 PM

                  @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 Away
                    sdetweil @mumblebaj
                    last edited by Dec 6, 2023, 4:21 PM

                    @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 Dec 7, 2023, 3:34 PM Dec 7, 2023, 3:33 PM

                      @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 Dec 7, 2023, 4:08 PM Reply Quote 0
                      • M Offline
                        MMRIZE @1a2a3a
                        last edited by MMRIZE Dec 7, 2023, 4:14 PM Dec 7, 2023, 4:08 PM

                        @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 Dec 9, 2023, 5:14 PM Reply Quote 1
                        • 1
                        • 2
                        • 1 / 2
                        1 / 2
                        • First post
                          1/11
                          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