Beautifulsoup Returning Empty Array
I'm currently trying to scrape data off a website, but using the code beneath it would return an empty array ' [] ' for some reason. I can't seem to figure out the reasoning behind
Solution 1:
this page use javascript to fetch data from server, and you can find javascript use this link to request data in chrome's dev_tools, so you can requests this link to get the info you need.
http://www.hkex.com.hk/eng/csm/ws/Result.asmx/GetData?location=priceMoveSearch&SearchMethod=2&LangCode=en&StockCode=&StockName=&Ranking=ByMC&StockType=ALL&mkt=hk&PageNo=1&ATypeSHEx=&AType=&FDD=&FMM=&FYYYY=&TDD=&TMM=&TYYYY=
there is no need to use selenium
Solution 2:
There are no true HTML rows in the document. The rows are dynamically generated by JavaScript. BeautifulSoup cannot execute JavaScript.
Solution 3:
If you view the contents of the html.text variable, you will notice that the content is generated dynamically and does not have any valid elements.
Post a Comment for "Beautifulsoup Returning Empty Array"