import requests
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
url = 'https://www.xxx.cn/xxxxx'
response = requests.get(url,headers=headers)
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'html.parser')
for link in soup.find_all('a'):
href = link.get('href')
if href is not None:
print(href)
print(soup)
else:
print(f'Failed to retrieve the webpage: Status code - {response.status_code}')