I
I
iamXado2020-06-13 22:10:20
Python
iamXado, 2020-06-13 22:10:20

How to scrape from a site on Dzhanga?

There is this code:

from urllib.request import urlopen
from bs4 import BeautifulSoup

html_doc = urlopen('site').read()
soup = BeautifulSoup(html_doc)
div = soup.find('div', 'class')
print(div)


There is a div with a class called 'class' for example. There is text inside this div, it can be seen in the source code of the page, but this text itself comes from {{ text }} (as I understand it, this is django). The question is how to get this text.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-06-13
@hottabxp

div = soup.find('div', class_='class').text
print(div)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question