From 578dc164c70ce12f3977a33a40001bdbda061d9c Mon Sep 17 00:00:00 2001 From: thecookingsenpai Date: Sat, 13 Jan 2024 00:33:29 +0100 Subject: [PATCH] Fixed a return error --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 9c0ff28..9de5d15 100644 --- a/main.py +++ b/main.py @@ -74,7 +74,8 @@ def extract_data(url): response = requests.get(url, timeout=5) soup = BeautifulSoup(response.text, "html.parser") links = apnews.fetchAndDigest(soup) - transform_links(links) + datas = transform_links(links) + return datas def handle_pagination(soup): next_page = soup.find("a", {"rel": "next"}) @@ -89,8 +90,8 @@ def main(): all_data = [] while url: - data = extract_data(url) - all_data.extend(data) + datas = extract_data(url) + all_data.extend(datas) url = handle_pagination( BeautifulSoup(requests.get(url, timeout=5).text, "html.parser") )