Jump to content



Photo

Scaping A Table


  • Please log in to reply
3 replies to this topic

#1 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 November 2019 - 09:40 AM

Hi all,

 

Im trying to scrape a table of data from Yahoo Finance, but for the life of me I can't get it to get the info I need.

 

I'm trying to scrape this page:

 

https://finance.yaho...date=1576800000

 

I'm looking to get the main items which are: Contract name, Bid and Ask price and Strike.

 

Can anyone share a solution?

Thanks in advance!

 

 


Sell Software tools? Then You Need Us

 

 


#2 ds062692

ds062692

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v4.0
  • License:Professional Edition

Posted 25 November 2019 - 08:10 PM

Might not be the cleanest but this should work. 

add list to list(%test,$scrape attribute(<class=w"data-row*">,"outerhtml"),"Delete","Global")
set(#row,0,"Global")
loop($list total(%test)) {
    set table cell(&out,#row,0,$replace regular expression($find regular expression($list item(%test,#row),"<td class=\"data-col0(.*?)/td>"),"<(.*?)>",""))
    set table cell(&out,#row,1,$replace regular expression($find regular expression($list item(%test,#row),"<td class=\"data-col2(.*?)/td>"),"<(.*?)>",""))
    set table cell(&out,#row,2,$replace regular expression($find regular expression($list item(%test,#row),"<td class=\"data-col4(.*?)/td>"),"<(.*?)>",""))
    set table cell(&out,#row,3,$replace regular expression($find regular expression($list item(%test,#row),"<td class=\"data-col5(.*?)/td>"),"<(.*?)>",""))
    increment(#row)
}



#3 Pete

Pete

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 886 posts
  • LocationUK london
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 November 2019 - 11:09 PM

Myself i would just take the whole tables, really depends how you like to skin you cat

 

scrape table(<class="calls W(100%) Pos® Bd(0) Pt(0) list-options">,&TableOne)
scrape table(<class="puts W(100%) Pos® list-options">,&TableTwo)



#4 UBotBuddy

UBotBuddy

    UBot Studio Training

  • ADMIN
  • 3537 posts
  • LocationVirginia
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 01 December 2019 - 02:08 PM

I like this if I only need one of them.

 

scrape table($element offset(<class="calls W(100%) Pos® Bd(0) Pt(0) list-options">,0),&table1)

 

 

Buddy


UBot Training for FREE! Yes, that is correct!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users