Why isn't the html code inside div is being parsed?

前端 未结 1 1961
不思量自难忘°
不思量自难忘° 2021-01-26 20:30

The html code

In this image there is html code inside the div id=\"root\"

Here is the code:

import requests 
from bs4 import Bea         


        
1条回答
  •  失恋的感觉
    2021-01-26 20:44

    The content inside of

    is likely loaded dynamically. You can check on your own if you visit the page with disabled JavaScript. With your approach, BeatifulSoup doesn't parse the content which was added dynamically (through JavaScript).

    More details here => BeautifulSoup not grabbing dynamic content

    I would recommend using a headless browser in your case to be able to fetch dynamic content which was generated with JavaScript. (headless browser is able to execute JavaScript so it makes dynamic content accessible for parsing)

    0 讨论(0)
提交回复
热议问题