Last active
May 20, 2018 16:05
-
-
Save carcigenicate/d68901d2d5a09c2788c7d16914bbe3d9 to your computer and use it in GitHub Desktop.
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
def fnc (): | |
baseurls = lst() # Added an s to the name because there's multiple | |
for baseurl in baseurls # Then grab each url | |
request = requests.get(baseurl) | |
response = str(request.content) | |
page_soup = BeautifulSoup(response, 'html.parser') | |
a = page_soup.findAll("div",{"class":"large-7 medium-9 columns"}) | |
b = page_soup.findAll("div",{"body field"}) | |
c = page_soup.findAll("div",{"field-ingredients-data field-wrapper"}) | |
d = page_soup.findAll("div",{"field-how-to-use-data field-wrapper"}) | |
e = (a[0].h1) | |
f = b[1] | |
g = (c[0].p) | |
h = (d[0].p) | |
title = str(e.text.strip()) | |
description = str(f.text.strip()) | |
ingredients = str(g.text.strip()) | |
howtuse = str(h.text.strip()) | |
return '\n' + title + '\n' + '\n' + description + '\n' + '\n' + ingredients + '\n' + howtuse + '\n' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment