Saturday, 15 August 2015

jquery - Data extraction -



jquery - Data extraction -

since playing around nodejs , express stuff got problems.

i got html things available , want extract info array. i'm able extrac basics things, more detailed info got struggles solve it.

here html part:

<hr> <h1>topic</h1> written by&nbsp;<font color=#ffffff>schween</font>&nbsp;&nbsp;am&nbsp;18.06.2014&nbsp;at&nbsp;21:26:15 <hr> test extract data! <hr>

and here how think

jsdom.env({ html: body, scripts: ['http://code.jquery.com/jquery-2.1.1.min.js'], done: function(errors, window) { var $ = window.jquery; $body = $(iconv.decode(new buffer(body), "iso-8859-1")), self.items[0] ={ topic: $body.find('h1:eq(1)').text(), author: $body.find('font[color=#ffffff]').first().text(), date: {should 18.06.204}, time: {should 21.26.15}, text: $body.find('hr:eq(1)').nextsibling } console.log(self.items); res.end(''); }

my questions:

i have no clue how can closer date , time? how can text out in between of 2 hr tags?

for me not expect finish solution - more prefer if give me ideas how can accomplish targets.

thanks lot & have great day schween

<hr> <h1>topic</h1> <b>written by&nbsp;<font color=#ffffff>schween</font>&nbsp;&nbsp;am&nbsp;18.06.2014&nbsp;at&nbsp;21:26:15</b> <hr> <i>this test extract data!</i> <hr> <p></p>

have features not defined. must example

var topic= $('h1:eq(0)').text(), author= $('font[color=#ffffff]').first().text(), text= $('i:eq(0)').text(), date=$('b').text().match(/(\d+)/g); var myarray = [ topic, author, text ]; console.log( myarray);

jquery

No comments:

Post a Comment