Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- id = 'bxc'
- url = f'https://www.tipranks.com/stocks/{id}/stock-analysis'
- headers = {'User-Agent': 'Googlebot-Mobile/2.1 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)'}
- response = requests.get(url, headers=headers)
- soup = BeautifulSoup(response.text, 'html.parser')
- og_description = soup.find('meta', attrs={'property': 'og:description'})['content']
- import re
- match = re.search(r'Smart Score of (\d+)', og_description)
- score = match.group(1)
- print(f'The Tipranks.com Smart Score of {id} is {score}')
Advertisement
Add Comment
Please, Sign In to add comment