0

I have to scrape a JavaScript-rendered page in Python, but without Selenium. It must work for any pages, and I haven't found a proper way to that. How can I do it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jwoojin9
  • 295
  • 1
  • 5
  • 16

1 Answers1

1

requests-HTML uses Chromium to render JavaScript.

It will download Chromium in your home directory the first time you run render.

r = session.get('http://python-requests.org/')
r.html.render()
r.html.search('Python 2 will retire in only {months} months!')['months'] '<time>25</time>' 

Source: Documentation

Ash Ishh
  • 551
  • 5
  • 15