| from bs4 import BeautifulSoup | |
| import requests | |
| import string | |
| def get_image_from_url(url): | |
| try: | |
| r = requests.get(url) | |
| soup = BeautifulSoup(r.content, 'html.parser') | |
| img = soup.find('figure', 'thumbnail').find('img') | |
| return img['src'] | |
| except: | |
| return None | |
| depunctuate = lambda x: x.translate(str.maketrans('','',string.punctuation)) | |