Skip to content

Commit

Permalink
Fixing XPath for KetoConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch committed Oct 1, 2017
1 parent 929ec43 commit c8a148e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ketohub/spiders.py
Expand Up @@ -46,7 +46,7 @@ def find_ketoconnect_image_url(response):
return opengraph_url

for image_url in response.xpath(
'//div[@id="tve_editor"]/img/@src').extract():
'//div[@id="tve_editor"]//img/@src').extract():
if image_url.endswith('.jpg'):
return image_url

Expand Down
2 changes: 2 additions & 0 deletions tests/test_spiders.py
Expand Up @@ -27,7 +27,9 @@ def test_finds_image_when_opengraph_image_is_not_set(self):
body="""
<html>
<div id="tve_editor">
<span class="junk">
<img class="tve_image" alt="" style="width: 400px;" src="https://mock.com/recipe-image.jpg" width="400" height="600" data-attachment-id="9282">
</span>
</div>
</html>""")), 'https://mock.com/recipe-image.jpg')

Expand Down

0 comments on commit c8a148e

Please sign in to comment.