Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #24261

Re: Data retrieving from html text on a webpage

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Data retrieving from html text on a webpage
Date Mon, 19 May 2014 13:11:53 +0200
Organization PointedEars Software (PES)
Lines 85
Message-ID <1435438.2RfG4i1VlX@PointedEars.de> (permalink)
References <08bb65e9-25e1-47f0-94bd-c1cb6525375e@googlegroups.com> <15572699.M38CgDd2lQ@PointedEars.de> <kcljn9d60qvgrdspb1b114j0f1jrd5ea4p@4ax.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1400497923 30799 eJwFwYkBgDAIA8CVGoGEjqM8+4/gXRjBkjPosbHVT+sOh1AT98A8p2Ynr6t1voLWLfnCYvYHHvQRGg== (19 May 2014 11:12:03 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 19 May 2014 11:12:03 +0000 (UTC)
User-Agent KNode/4.12.4
X-User-ID eJwFwQkBwDAIA0BLpXydHAjEv4TduYYE0sLDnM7r79xNEO1yYrPUq0m7LEm8CdMpPVsp31A7irqImtUG8ANodBb/
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Cancel-Lock sha1:8bjQ/wMORolx4F9Wrf9yibJSwTk=
X-NNTP-Posting-Host eJwFwYEBwCAIA7CX5oRCzwGl/59g4hsLJwwOc7kqxFnVsgjfTQxT5A31PQC+0J1T/NmJzHkwpRHN
Xref csiph.com comp.lang.javascript:24261

Show key headers only | View raw


John Harris wrote:

> Thomas 'PointedEars' Lahn wrote:
>> FAISAL ISMAIL wrote [translated]:
>>> i am [a Googlodyte¹] trying to [steal copyrighted information] from a
>>> table on the [website] (http://floodobservatory.colorado.edu/AMSR-E%20Gaging%20Reaches/Summary3.htm)
>>> the data is in rows and columns.  [I only want to steal] data for some
>>> specific country e.g Pakistan [in order to present it later as if it was
>>> my original research].
>>> [I want you to give me the code for free and be an accessor to this
>>> [crime without any questions asked because I think you are stupid enough
>>> to have a big enough helper complex to do just that.  Otherwise I have
>>> no clue what I am doing, and I cannot be bothered to search the Net, to
>>> learn and try something.]
>   <snip>
> 
> Why does Thomas use the symbol '>', meaning a direct literal unchanged
> copy of another's text, when he is supplying text written by him ?
> 
> Could it be that Internet rules don't apply to Thomas ?
                                                       ^
Could it be that you are still either only trolling here or still have no 
clue where you are reading and posting to?  This is *Usenet*, _not_ the 
Internet.  If any rules apply here, they are *Usenet* rules (which include 
Internet standards, but only in a purely technical sense).  Read the FAQ.

I concede that the style of my posting was in a non-hacker sense 
inappropriate; however, its formatting certainly was not (by contrast to 
that of the OP, due to the buggy interface and cluelessness):

It is customary to use rectangular brackets to indicate changes to quoted 
material (in Usenet this stems from its academic background).

I gave an additional hint as to what I found wrong with the OP and how to 
fix it, and I said sorry in advance for my style, though (which you snipped 
both, probably with purpose).

Anyhow, here is a more appropriate answer:

The rows of a table (section), and the cells of each row, are represented in 
the DOM as objects implementing the NodeList or HTMLCollection 
interface. [1]  (Therefore,) they can be converted to an Array of Arrays by 
calling the Array.prototype.map() method on them, respectively. [2]

In turn, elements of an Array instance can be filtered by calling the 
filter() method that it inherits from the built-in Array prototype 
(implementations of ECMAScript Edition 5 and later only, respectively) [3]:

  var filtered_data = [].map.call(
    table.tBodies[0].rows,
    function (row) {
      return [].map.call(
        row.cells,
        function (cell) {
          /* you can also do type conversion of cell data here */
          return …;
        }
      );
    }
  ).filter(
    function (row) {
      return …;
    }
  );

(Written less compact here for better understanding.  For increased 
efficiency, the value of [].map can be stored in a variable if needed 
repeatedly.)

Instead of calling these methods, one may also build arrays from rows and 
cells in C-style “for” loops.

It could be also more efficient to reverse the order: filter first, map 
second (because then you only need to map the data of the remaining rows).

___________
[1] <https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement.tBodies> pp.
[2] <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map> pp.
[3] <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter> pp.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Data retrieving from html text on a webpage FAISAL ISMAIL <faesal19@gmail.com> - 2014-05-18 01:18 -0700
  Re: Data retrieving from html text on a webpage Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-18 15:41 +0000
  Re: Data retrieving from html text on a webpage "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-18 17:41 +0200
    Re: Data retrieving from html text on a webpage FAISAL ISMAIL <faesal19@gmail.com> - 2014-05-18 12:52 -0700
  Re: Data retrieving from html text on a webpage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-18 23:29 +0200
    Re: Data retrieving from html text on a webpage John Harris <niam@jghnorth.org.uk.invalid> - 2014-05-19 11:04 +0100
      Re: Data retrieving from html text on a webpage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-19 13:11 +0200
        Re: Data retrieving from html text on a webpage John Harris <niam@jghnorth.org.uk.invalid> - 2014-05-20 10:43 +0100
          Re: Data retrieving from html text on a webpage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-21 14:34 +0200
            Re: Data retrieving from html text on a webpage John Harris <niam@jghnorth.org.uk.invalid> - 2014-05-22 10:42 +0100
    Re: Data retrieving from html text on a webpage FAISAL ISMAIL <faesal19@gmail.com> - 2014-05-22 09:07 -0700
  Re: Data retrieving from html text on a webpage Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-19 21:44 +0000
    Re: Data retrieving from html text on a webpage Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-19 23:55 +0200
      Re: Data retrieving from html text on a webpage "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-20 00:04 +0200
        Re: Data retrieving from html text on a webpage Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-20 12:59 +0200
          Re: Data retrieving from html text on a webpage "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-05-20 17:13 +0200
      Re: Data retrieving from html text on a webpage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-20 00:40 +0100
        Re: Data retrieving from html text on a webpage Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-20 13:17 +0200
          Re: Data retrieving from html text on a webpage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-21 14:19 +0200
            Re: Data retrieving from html text on a webpage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-21 13:51 +0100
              Re: Data retrieving from html text on a webpage Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-21 17:55 +0200
      Re: Data retrieving from html text on a webpage Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-20 10:05 +0000
        Re: Data retrieving from html text on a webpage Christoph Michael Becker <cmbecker69@arcor.de> - 2014-05-20 13:03 +0200

csiph-web