Пытаюсь создать свой парсер, но почему-то в методе .get('href') вместо ссылки выдается слово *none*.
from bs4 import BeautifulSoup
import requests
import json
import csv
import random
from time import sleep
url = "https://it.itorrents-igruha.org"
headers = {
"Accept": "*/*",
"User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.125 Safari/537.36"
}
req = requests.get(url, headers=headers)
src = req.text
# print(src)
with open ("index.html", "w") as file:
file.write(src)
with open ("index.html") as file:
src = file.read()
soup = BeautifulSoup(src, "lxml")
all_games_hrefs = soup.find_all(class_="article-film")
# print(all_games_hrefs)
# all_games_dict = {}
for item in all_games_hrefs:
print(item.get('href'))
# item_text = item.text
# item_href = item.get("href")
# print(f"{item_text}: {item_href}")
# all_games_dict[item_text] = item_href
# with open("all_games_dict.json", "w") as file:
# json.dump(all_games_dict, file, indent=4, ensure_ascii=False)