use node js to do web crawler but can not search dataHow to append to a file in Node?Using node.js as a simple web serverHow can I update NodeJS and NPM to the next versions?How to uninstall npm modules in node js?How to show data from mysql in nodejs with a refresh ratenode how to create a directory if doesn't exist?Nodes http request before an async.mapformidable parse callback not be called and no errorWait for data from external API before making POST requestNode JS Promise TypeError: Cannot read property 'then' of undefined

Would it be appropriate to sand a floor between coats of poly with a handheld orbital sander?

A horrible Stockfish chess engine evaluation

Why did people still chant "Lock her up" at Trump rallies in 2019?

Efficiently defining a SparseArray function

Chorophyll and photosynthesis in plants with coloured leaves

What happens when adult Billy Batson says "Shazam"?

What are the indigenous English words for a prostitute?

What is the parallel of Day of the Dead with Stranger things?

Why do we need common sense in AI?

Graduate student with abysmal English writing skills, how to help

When did "&" stop being taught alongside the alphabet?

How to know if blackberries are safe to eat

Intelligent Ants in the Amazon

Swapping "Good" and "Bad"

How can I effectively communicate to recruiters that a phone call is not possible?

How do we handle pauses in a dialogue?

Why does wrapping Aluminium foil around my food help it keep warm, aluminium be good conductor should have no effect?

Credit score and financing new car

Integer Lists of Noah

What is this little owl-like bird?

How effective would wooden scale armor be in a medieval setting?

What is the right approach to quit a job during probation period for a competing offer?

Reverse dots and boxes

Having decision making power over someone's assets



use node js to do web crawler but can not search data


How to append to a file in Node?Using node.js as a simple web serverHow can I update NodeJS and NPM to the next versions?How to uninstall npm modules in node js?How to show data from mysql in nodejs with a refresh ratenode how to create a directory if doesn't exist?Nodes http request before an async.mapformidable parse callback not be called and no errorWait for data from external API before making POST requestNode JS Promise TypeError: Cannot read property 'then' of undefined






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I use node js to do web crawler.

I want to show the weather,but always fail.



enter image description here



this is my code,please tell me what I wrong thanks.



const request = require('request')
const ironmans = [
'https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
type=Weather&time=7Day',
]

async.map( ironmans, getInfo, (err, results)=>
console.log(results);
)

function getInfo(url, callback)
request(url, function(err, res, body)
var $ = cheerio.load(body)
const result = [];
const table_tr = $(".Forecast-box table tr");
for (let i = 1; i <3; i++) // tr
const table_td = table_tr.eq(i).find('td'); // (td)
const time = table_td.eq(2).text(); // time
const temperture = table_td.eq(4).text(); // temperture
const weather = table_td.eq(4).text(); // weather
result.push(Object.assign( time, temperture, weather ));

console.log(result);
)



thanks.










share|improve this question






























    0















    I use node js to do web crawler.

    I want to show the weather,but always fail.



    enter image description here



    this is my code,please tell me what I wrong thanks.



    const request = require('request')
    const ironmans = [
    'https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
    type=Weather&time=7Day',
    ]

    async.map( ironmans, getInfo, (err, results)=>
    console.log(results);
    )

    function getInfo(url, callback)
    request(url, function(err, res, body)
    var $ = cheerio.load(body)
    const result = [];
    const table_tr = $(".Forecast-box table tr");
    for (let i = 1; i <3; i++) // tr
    const table_td = table_tr.eq(i).find('td'); // (td)
    const time = table_td.eq(2).text(); // time
    const temperture = table_td.eq(4).text(); // temperture
    const weather = table_td.eq(4).text(); // weather
    result.push(Object.assign( time, temperture, weather ));

    console.log(result);
    )



    thanks.










    share|improve this question


























      0












      0








      0








      I use node js to do web crawler.

      I want to show the weather,but always fail.



      enter image description here



      this is my code,please tell me what I wrong thanks.



      const request = require('request')
      const ironmans = [
      'https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
      type=Weather&time=7Day',
      ]

      async.map( ironmans, getInfo, (err, results)=>
      console.log(results);
      )

      function getInfo(url, callback)
      request(url, function(err, res, body)
      var $ = cheerio.load(body)
      const result = [];
      const table_tr = $(".Forecast-box table tr");
      for (let i = 1; i <3; i++) // tr
      const table_td = table_tr.eq(i).find('td'); // (td)
      const time = table_td.eq(2).text(); // time
      const temperture = table_td.eq(4).text(); // temperture
      const weather = table_td.eq(4).text(); // weather
      result.push(Object.assign( time, temperture, weather ));

      console.log(result);
      )



      thanks.










      share|improve this question
















      I use node js to do web crawler.

      I want to show the weather,but always fail.



      enter image description here



      this is my code,please tell me what I wrong thanks.



      const request = require('request')
      const ironmans = [
      'https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
      type=Weather&time=7Day',
      ]

      async.map( ironmans, getInfo, (err, results)=>
      console.log(results);
      )

      function getInfo(url, callback)
      request(url, function(err, res, body)
      var $ = cheerio.load(body)
      const result = [];
      const table_tr = $(".Forecast-box table tr");
      for (let i = 1; i <3; i++) // tr
      const table_td = table_tr.eq(i).find('td'); // (td)
      const time = table_td.eq(2).text(); // time
      const temperture = table_td.eq(4).text(); // temperture
      const weather = table_td.eq(4).text(); // weather
      result.push(Object.assign( time, temperture, weather ));

      console.log(result);
      )



      thanks.







      node.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 8:18

























      asked Mar 26 at 0:50







      user8449442





























          1 Answer
          1






          active

          oldest

          votes


















          0














          The weather table has been appended to the page by a xhr request, that mean if you use request to get the page resource, then you can not get the data table(like you View page source). Try another ways (headless browser), simple way crawl https://www.cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm instead of https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
          type=Weather&time=7Day






          share|improve this answer























          • how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

            – user8449442
            Mar 26 at 1:24












          • @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

            – hoangdv
            Mar 26 at 1:52











          • hoangdv I know thanks.

            – user8449442
            Mar 26 at 2:00











          • I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

            – user8449442
            Mar 27 at 8:35










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348369%2fuse-node-js-to-do-web-crawler-but-can-not-search-data%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown
























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The weather table has been appended to the page by a xhr request, that mean if you use request to get the page resource, then you can not get the data table(like you View page source). Try another ways (headless browser), simple way crawl https://www.cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm instead of https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
          type=Weather&time=7Day






          share|improve this answer























          • how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

            – user8449442
            Mar 26 at 1:24












          • @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

            – hoangdv
            Mar 26 at 1:52











          • hoangdv I know thanks.

            – user8449442
            Mar 26 at 2:00











          • I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

            – user8449442
            Mar 27 at 8:35















          0














          The weather table has been appended to the page by a xhr request, that mean if you use request to get the page resource, then you can not get the data table(like you View page source). Try another ways (headless browser), simple way crawl https://www.cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm instead of https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
          type=Weather&time=7Day






          share|improve this answer























          • how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

            – user8449442
            Mar 26 at 1:24












          • @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

            – hoangdv
            Mar 26 at 1:52











          • hoangdv I know thanks.

            – user8449442
            Mar 26 at 2:00











          • I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

            – user8449442
            Mar 27 at 8:35













          0












          0








          0







          The weather table has been appended to the page by a xhr request, that mean if you use request to get the page resource, then you can not get the data table(like you View page source). Try another ways (headless browser), simple way crawl https://www.cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm instead of https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
          type=Weather&time=7Day






          share|improve this answer













          The weather table has been appended to the page by a xhr request, that mean if you use request to get the page resource, then you can not get the data table(like you View page source). Try another ways (headless browser), simple way crawl https://www.cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm instead of https://www.cwb.gov.tw/V7/forecast/town368/towns/6400800.htm?
          type=Weather&time=7Day







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 1:04









          hoangdvhoangdv

          2,8301 gold badge7 silver badges19 bronze badges




          2,8301 gold badge7 silver badges19 bronze badges












          • how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

            – user8449442
            Mar 26 at 1:24












          • @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

            – hoangdv
            Mar 26 at 1:52











          • hoangdv I know thanks.

            – user8449442
            Mar 26 at 2:00











          • I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

            – user8449442
            Mar 27 at 8:35

















          • how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

            – user8449442
            Mar 26 at 1:24












          • @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

            – hoangdv
            Mar 26 at 1:52











          • hoangdv I know thanks.

            – user8449442
            Mar 26 at 2:00











          • I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

            – user8449442
            Mar 27 at 8:35
















          how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

          – user8449442
          Mar 26 at 1:24






          how I can know to use this website? where can I find? cwb.gov.tw/V7/forecast/town368/3Hr/6400800.htm

          – user8449442
          Mar 26 at 1:24














          @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

          – hoangdv
          Mar 26 at 1:52





          @samuraikyo37 Open developer tool (Chrome browser), in Network tab, when you click to 1週預報, 過去24小時 or 逐3小時預報 button, a network request has been fired. This is what you want.

          – hoangdv
          Mar 26 at 1:52













          hoangdv I know thanks.

          – user8449442
          Mar 26 at 2:00





          hoangdv I know thanks.

          – user8449442
          Mar 26 at 2:00













          I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

          – user8449442
          Mar 27 at 8:35





          I am wondering that why I cant get weather (which column have sun and moon picture), I try : weather =table_tr.eq(3).text(); / or const a = $(".Forecast-box table tr td title"); weather = a.eq(1).text(); still not work. how I can do? thanks

          – user8449442
          Mar 27 at 8:35








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348369%2fuse-node-js-to-do-web-crawler-but-can-not-search-data%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript