Crawling a page-changing website using JavaScript with Python

Asked 2 years ago, Updated 2 years ago, 32 views

I'm a beginner who learned Pythoncrying Because the web page changes the page using JavaScript, the URL does not change and the page changes. I checked to crawl with Python, and it was based on the URL What should I do in this case? It's written like this

//<ahref="javascript:OnPage(11)">11</a>

javascript python

2022-09-21 15:23

1 Answers

javascript is an environment that is run dynamically by a VM.

In other words, you have to do it separately using a javascript engine such as spider monkey.

However, there are too many things to consider in that case, so if you're not considering performance, you can crawl using a browser using selenium.

I recommend selenium and Phantom JS combination.


2022-09-21 15:23

If you have any answers or tips


© 2025 OneMinuteCode. All rights reserved.