I am not sure why you are concatenating \a on the end of url as this re-directs to the about-us page. Also, I see no table/tr/td tags to work with on base url or about-us. Instead, if you meant to cycle through the two pages (or more) that are the pagination for the base url you can do this by testing for the presence of the rel
attribute with value next
. And yes, you need a valid User-Agent header.
import requests
from bs4 import BeautifulSoup as bs
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
}
page = 1
with requests.Session() as s:
s.headers = headers
while True:
r = s.get(f'https://techadvisorblog.com/page/{page}/')
soup = bs(r.content, 'lxml')
print(soup.select_one('title').text)
if soup.select_one('[rel=next]') is None:
break
page+=1