1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| import requests from bs4 import BeautifulSoup
url = "https://www.peakbagger.com/list.aspx?lid=5651" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.42" }
resp = requests.get(url, headers=headers) soup = BeautifulSoup(resp.content, 'html.parser')
.find(class_='gray') .findAll('tr')
.find(class_='gray').text
resp.close()
|