So i wrote this code for now, to get news from a specific topic from cnn right now im getting an error here is the code:
from bs4 import BeautifulSoup
import requests
import csv
import re
serch_term = input('What News are you looking for today? ')
url = f'https://edition.cnn.com/search?q={serch_term}'
page = requests.get(url)
doc = BeautifulSoup(page, "html.parser")
page_text = doc.find_all(class_="cnn-search__result-headline")
print(page_text)
But i am getting this error, i already tried a bunch of things but none of them worked for me
What News are you looking for today? coronavirus
Traceback (most recent call last):
File "c:\Users\user\Desktop\Informatik\Praktik\Projekte\Python\news_automation\main.py", line 10, in <module>
doc = BeautifulSoup(page, "html.parser")
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\bs4\__init__.py", line 312, in __init__
elif len(markup) <= 256 and (
TypeError: object of type 'Response' has no len()
i googled already and tried a bunch of things but none of them worked Does someone know what is wrong? So,