Skip to content

Instantly share code, notes, and snippets.

@zakirangwala
Created September 23, 2020 14:21
Show Gist options
  • Save zakirangwala/dcf4b2333eded33ad8db693c32d9a147 to your computer and use it in GitHub Desktop.
Save zakirangwala/dcf4b2333eded33ad8db693c32d9a147 to your computer and use it in GitHub Desktop.
Tutorial Code : Get the rotten tomato score of a movie
# Rotten Tomatoes Score
def rotten_tomatoes_score(query):
try:
query += query + " Rotten Tomatoes"
URL = google_query(query)[0]
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
res = soup.find(class_='mop-ratings-wrap__percentage').get_text()
check = res.split(' ')
for i in check:
if len(i) > 1:
return i
except Exception as e:
print('Could not retrieve tomatometer score')
speak('Could not retrieve tomatometer score')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment