Jump to content
UBot Underground

Scaping A Table


Recommended Posts

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.yahoo.com/quote/INTC/options?p=osis&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!

 

 

Link to post
Share on other sites

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)
}

Link to post
Share on other sites

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)

  • Like 1
Link to post
Share on other sites
  • 4 weeks later...

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)

This did it for me, thank you Pete.

 

Thanks to the other solution providers also, UbotBuddy and ds062692

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...