Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated bs4 search to account for multiple h4s #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions whole_foods_delivery_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def getWFSlot(productUrl):

slot_pattern = 'Next available'
try:
next_slot_text = soup.find('h4', class_ ='ufss-slotgroup-heading-text a-text-normal').text
next_slot_text = str([x.text for x in soup.findAll('h4', class_ ='ufss-slotgroup-heading-text a-text-normal')])
if slot_pattern in next_slot_text:
print('SLOTS OPEN!')
winsound.Beep(freq, duration)
Expand All @@ -39,7 +39,7 @@ def getWFSlot(productUrl):

try:
no_slot_pattern = 'No delivery windows available. New windows are released throughout the day.'
if no_slot_pattern == soup.find('h4', class_ ='a-alert-heading').text:
if no_slot_pattern in [x.text for x in soup.findAll('h4', class_ ='a-alert-heading')]:
print("NO SLOTS!")
except AttributeError:
print('SLOTS OPEN!')
Expand Down