Update wordpress-plugins-update.py

patch-4
Prince Chaddha 2024-06-18 20:45:37 +04:00 committed by GitHub
parent e14722ccd7
commit 7d5d48304d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -43,8 +43,14 @@ for page_number in range(1, 11):
# Parse HTML
soup = BeautifulSoup(html, 'html.parser')
results = soup.find(id="main")
articles = results.find_all("div", class_="plugin-card")
results = soup.find("div", {"id": "main"})
if results is None:
print("Failed to find the main plugin list. Check if the page structure has changed.")
continue
articles = results.find_all("article", class_="plugin-card")
if not articles:
print("No articles found on the page.")
continue
# Setting the top tag
top_tag = "top-100,top-200" if page_number <= 5 else "top-200"