Compare commits
2 Commits
0615bb96ea
...
8e17ee3932
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e17ee3932 | ||
|
|
fc5dd132ce |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"conventionalCommits.scopes": [
|
"conventionalCommits.scopes": [
|
||||||
"api"
|
"api",
|
||||||
|
"recipe"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,11 @@ def get_recipe_from_xiachufang(url):
|
|||||||
|
|
||||||
steps = []
|
steps = []
|
||||||
for step in soup.find('div', class_='steps').find('ol').find_all('li'):
|
for step in soup.find('div', class_='steps').find('ol').find_all('li'):
|
||||||
steps.append([step.find('p').text.strip(), step.find('img')['src']])
|
step_text = step.find('p').text.strip()
|
||||||
|
step_img = step.find('img')
|
||||||
|
if step_img:
|
||||||
|
steps.append([step_text, step_img['src']])
|
||||||
|
else:
|
||||||
|
steps.append([step_text])
|
||||||
|
|
||||||
return {'name': name, 'ingredients': ingredients, 'steps': steps}
|
return {'name': name, 'ingredients': ingredients, 'steps': steps}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user