Answer the question
In order to leave comments, you need to log in
How to implement a parser?
I need a parser that can parse a site with 11,000 pages. The parser does a calculation of some data from the text from these pages.
url="https://website/post"
def parser():
for num in range(1,11000):
#получаю страницу сайта
BeautifulSoup=bs4.BeautifulSoup( requests.get(url+str(num)).text,"html.parser" )
# получаю блок с текстом
post_text=BeautifulSoup.select(".post-text")
print( "num= %s " % num)
try:
print(post_text)
print(post_text[0].text)
###
###Тут я обрабатываю текст и сохраняю число в переменную size
###
except IndexError:
pass
print(size)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question