Last active
September 23, 2020 14:18
-
-
Save zakirangwala/6a6d388501fa26bc89e6ba05958aa379 to your computer and use it in GitHub Desktop.
Tutorial Code : Scrape web for IMDB movie link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imdb | |
# Find IMDB | |
def find_imdb(query): | |
try: | |
query += ' IMDB' | |
URL = google_query(query)[0] | |
page = requests.get(URL, headers=headers) | |
html_content = page.text | |
soup = BeautifulSoup(html_content, 'lxml') | |
title = soup.title.string | |
title = title[0:-7] | |
return title | |
except Exception as e: | |
print('Movie could not be found') | |
speak('Movie could not be found') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment