Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Scraping javascript-generated data using Python [duplicate]

I want to scrape some data of following url using Python. http://www.hankyung.com/stockplus/main.php?module=stock&mode=stock_analysis_infomation&itemcode=078340

It's about a summary of company information.

What I want to scrape is not shown on the first page. By clicking tab named "재무제표", you can access financial statement. And clicking tab named "현금흐름표', you can access "Cash Flow".

I want to scrape the "Cash Flow" data.

However, Cash flow data is generated by javascript across the url. The following link is that url which is hidden, http://stock.kisline.com/compinfo/financial/main.action?vhead=N&vfoot=N&vstay=&omit=&vwidth=

Cash flow data is generated by submitting some option value and cookie to this url.

As you perceived, itemcode=078340 in the first link means stock code and there are as many as 1680 stocks that I want gather cash flow data. I want make it a loop structure.

Is there good way to scrape cash flow data? I tried scrapy but scrapy is difficult to cope with my another scraping code already I'm using.

Answer*

Draft saved
Draft discarded
Cancel
3
  • Thanks a lot. I'm gonna try selenium. Commented Apr 8, 2012 at 7:50
  • can i substitute jquery with this lxml +xpath part at the end (and follow the rest of the steps)? Commented Apr 1, 2013 at 12:48
  • Selenium comes with its own CSS selector engine (which probably uses the underlying browser), so you don't need neither jQuery nor lxml anymore Commented Apr 1, 2013 at 18:47

default

AltStyle によって変換されたページ (->オリジナル) /