I have a python function that uses the requests library and BeautifulSoup to scrape a particular user's tweets.
import requests
from bs4 import BeautifulSoup
contents = requests.get("https://twitter.com/user")
soup = BeautifulSoup(contents.text, "html.parser")
When the requests library accesses Twitter, it uses the legacy version of Twitter. However, since Twitter recently dropped support for its legacy version, the requests library no longer works and returns html code saying that this version of Twitter is out of date.
Is there a way to make the requests library access the newer version of Twitter?