Reputation: 271
I want to scrape seasonal NBA team data from basketball-reference.com in CSV format. There is an option to convert these tables into CSV, but it requires clicking on a span
with an onclick
handler. This is an example.
Is there a way (don't really care what language) that I can write a scraper where it first somehow triggers each of these spans and then scrapes the CSV data?
Upvotes: 1
Views: 2402
Reputation: 125
Probably too late, but perhaps of benefit to those coming here via search: it is possible to get nice CSV data from basketball-reference.com. It's not obvious (and maybe what follows wasn't possible a year-and-a-half ago), but try this:
At the top of the table are some links like
Glossary · SHARE · Embed · CSV · Export · PRE · LINK · ?
Click on the SHARE link (not the CSV link)
This will bring up a similar table, where, if you wish, you can exclude some data from the CSV.
In the yellow box should be some links like
Share or get code for table as: html / link url / bbcode [table] or [code] / js widget / > / pre-formatted text / comma-separated / [[wiki]]
Click on 'comma-separated'. An overlay should pop-up with the CSV data, which you can copy-and-paste.
Upvotes: 0
Reputation: 4740
If you really don't care about the language, you can try WatIn. I've already use it for test automation purpouse, but in your case, should work also (thinking in some clicks in span
).
Upvotes: 1