Code inside div is not showing up when web scraping

  Kiến thức lập trình

I am trying out web scraping in Python at a Scratch project, and I have a problem.

When I go to developer tools(for me it’s Ctrl-Shift-J), the code are different from when I run the code:

from urllib.request import urlopen

url = ‘https://scratch.mit.edu/projects/994662672/’

page = urlopen(url)

html_bytes = page.read()

html = html_bytes.decode(“utf-8”)

print(html)
And the result I got when I ran the code is the same as when I went to the source code on that website(Ctrl+U).
The code in the developer tools have the text for the comments, while the code that the program gave me only have a div tag with nothing in it: “<div id=”app”></div>”
How do I get the code inside the div tag from my Python program?

I tried talking with ChatGPT but it is glitchy.

LEAVE A COMMENT