The page loads data dynamically via JSON, but you can obtain this data through requests
as well. This script searches for a store, select first result and loads weekly specials:
import requests
from bs4 import BeautifulSoup
import json
store_search_url = 'https://www.harristeeter.com/api/v1/stores/search?Address={}&Radius=10000&AllStores=true&NewOrdering=false&OnlyPharmacy=false&OnlyFreshFood=false&FreshFoodOrdering=undefined'
weekly_specials_url = 'https://www.harristeeter.com/api/v1/stores/{}/departments/0/weekly_specials?'
headers = {'Referer': 'https://www.harristeeter.com/store-locator'}
with requests.session() as s:
r = s.get('https://www.harristeeter.com/store-locator', headers=headers)
store_search_data = s.get(store_search_url.format('pine ridge plaza, reynolda road'), headers=headers).json()
# This prints all results from store search:
# print(json.dumps(store_search_data, indent=4))
# we select the first match:
store_number = store_search_data['Data'][0]['Number']
weekly_specials_data = s.get(weekly_specials_url.format(store_number), headers=headers).json()
print(json.dumps(weekly_specials_data, indent=4))
Prints:
{
"Status": "success",
"Data": [
{
"ID": "4615146",
"AdWeek": "2019-07-16",
"DepartmentNumber": "4",
"AdWeekExpires": "07/16/2019",
"ActiveAdWeekRelease": "2019-07-16",
"StartDate": "7/10/2019",
"EndDate": "7/16/2019",
"IsCardRequired": true,
"Title": "Harris Teeter Cottage Cheese, Sour Cream, French",
"Description": "8-16 oz",
"Detail": "e-VIC Member Price $1.27",
"Price": "2/$3",
"SpecialPrice": "$1.27",
"DesktopImageUrl": "https://23360934715048b8b9a2-b55d76cb69f0e86ca2d9837472129d5a.ssl.cf1.rackcdn.com/sm_4615146.jpg",
"MobileImageUrl": "https://23360934715048b8b9a2-b55d76cb69f0e86ca2d9837472129d5a.ssl.cf1.rackcdn.com/sm_4615146.jpg",
"Limit": "6",
"Savings": "Save at Least 38\u00a2 on 2",
"Size": "8-16 oz",
"Subtitle": "Limit 6 at e-VIC Price",
"IsAdded": false,
"RetinaImageUrl": "https://23360934715048b8b9a2-b55d76cb69f0e86ca2d9837472129d5a.ssl.cf1.rackcdn.com/4615146.jpg",
"TIE": "1",
"Organic": "0",
"Type": "EVIC",
"DepartmentName": "Dairy & Chilled Foods"
},
{
"ID": "4614507",
... and so on.