Kev 69 Posted November 25, 2019 Report Share Posted November 25, 2019 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! Quote Link to post Share on other sites
ds062692 19 Posted November 26, 2019 Report Share Posted November 26, 2019 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) } Quote Link to post Share on other sites
Pete 121 Posted November 26, 2019 Report Share Posted November 26, 2019 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) 1 Quote Link to post Share on other sites
UBotBuddy 331 Posted December 1, 2019 Report Share Posted December 1, 2019 I like this if I only need one of them. scrape table($element offset(,0),&table1) Buddy Quote Link to post Share on other sites
Kev 69 Posted December 28, 2019 Author Report Share Posted December 28, 2019 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.