From 2fe71f67cf7149e5d5c9ec73b0aa522a119e186e Mon Sep 17 00:00:00 2001 From: Ilia Miheev Date: Fri, 14 Nov 2025 20:43:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20=D0=B2=20Pars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/en/Pars_EN.md | 5 +++++ pages/ru/Pars_RU.md | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pages/en/Pars_EN.md b/pages/en/Pars_EN.md index ad4096a..be9e384 100644 --- a/pages/en/Pars_EN.md +++ b/pages/en/Pars_EN.md @@ -55,6 +55,11 @@ nameFolder = 'img' # The first results are what we wanted, and the rest are not. Therefore, we prefer to get the first 84 elements locator = 'b_NgmZrVnRtV8MZMEjLs' allCards = soup.find_all(class_=locator)[:84] + if len(allCards) == 0: + print(f'''Something went wrong. Here is a list of possible causes: + 1) DuckDuckGo has changed the class for video cards. The code uses the locator "{locator}" + 2) The site did not load. Try increasing the timeSleep parameter or make a request later.''') + return # Getting all images allImg = [card.find('img') for card in allCards] diff --git a/pages/ru/Pars_RU.md b/pages/ru/Pars_RU.md index f297e5c..21bce3d 100644 --- a/pages/ru/Pars_RU.md +++ b/pages/ru/Pars_RU.md @@ -60,9 +60,9 @@ def main(): locator = 'b_NgmZrVnRtV8MZMEjLs' allCards = soup.find_all(class_=locator)[:84] if len(allCards) == 0: - print(f'''Something went wrong. Here is a list of possible causes: - 1) DuckDuckGo has changed the class for video cards. The code uses the locator "{locator}" - 2) The site did not load. Try increasing the timeSleep parameter or make a request later.''') + print(f'''Что-то пошло не так. Вот список возможных проблем: + 1) DuckDuckGo изменил назввание класса для карточек с видео. Сейчас используется локатор: "{locator}" + 2) Сайт не прогрузился. Попробуй увиличить значени параметра timeSleep или выполни запрос позже.''') return # Получаем все изображения