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

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현