Skip to content

Commit

Permalink
feat: fix cafenero
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHllm committed Dec 7, 2024
1 parent 0db079a commit 2fcdf42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions canteens/cafenero.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def extract_nextcloud_link(html):
The link as string.
"""
soup = bs4.BeautifulSoup(html, 'html.parser')
link = [a for a in soup.find_all('a', href=True) if 'Speisekarte als' in a.text and 'nextcloud' in a.get('href') and 'download' in a.get('href')][0].get('href')
return link
link = [a for a in soup.find_all('a', href=True) if 'speisekarte als' in a.text.lower()][0].get('href')
return 'https://cafenero.net/' + link


def get_pdf(link):
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cafenero.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def test_download_website__with_connect_timeout():
def test_extract_nextcloud_link():
html = cafenero.download_website()
link = cafenero.extract_nextcloud_link(html)
assert 'nextcloud' in link
assert 'download' in link

assert link

@flaky
def test_get_pdf(pdf_file):
Expand Down

0 comments on commit 2fcdf42

Please sign in to comment.