[I'm trying to only get the links that contain the text '/Archive.aspx?ADID='. However, I always get all the links on the webpage instead. After I get the links I want, how would I navigate to each of those pages? Thanks in advance!][1]
from bs4 import BeautifulSoup, SoupStrainer
import requests
url = "https://www.ci.atherton.ca.us/Archive.aspx?AMID=41"
key = '/Archive.aspx?ADID='
page = requests.get(url)
data = page.text
soup = BeautifulSoup(data)
for link in soup.find_all('a'):
if 'Archive.aspx?ADID=' in page.text:
print(link.get('href'))