0

Всем привет, срочно нужна помощь! Python

Написал парсер и жду от него, что бы он мне пересылал ссылки с сайта на PDF документы, но при работе выдает None

from turtle import Turtle
from requests import request
import requests
from bs4 import BeautifulSoup

URL = "https://kim-online.ru/page/navigatsiya/ezhesutochnaya-putevaya-informatsiya/ezhesutochnaya-putevaya-informatsiya-za-2022-god/4780-maj-2022"

page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")

post = soup.find("div", class_="page-body")

url =post.find("p", class_="item-text marbot40", href=True)['href'].strip()

print(url)

1 ответ 1

0
post = soup.find("div", class_="item-text marbot40")
# берем самый свежий 
url = post.find_all('a')[-1]['href']
print(f'https://kim-online.ru{url}')
0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.