Live data from Hacker News

Reversing Safeway's private APIs to automate coupon collection

blog.jonlu.ca

91–100 of 148 posts

Re: Reversing Safeway's private APIs to automate coupon collection

#91
post #10

Another tip: (area code) 867-5309 works for Safeway club card discounts in most area codes while piping tracking of your purchases to essentially null. Yes, Jenny’s number.

According to google it is a number from an early 80's pop song that at the time "caused a fad of people dialing 867-5309 and asking for "Jenny""

https://en.wikipedia.org/wiki/867-5309/Jenny

Re: Reversing Safeway's private APIs to automate coupon collection

#92

On a slightly unrelated note, I was trying to figure out why this guy is using a .ca domain when I realized, his name is Jon Luca. At first I thought his name was Jon Lu (and therefore asian). Good use of domain name.

I'm in Canada and shop at Sobeys, which owns the Safeway brand up here, thought there might be some relevance to me thanks to the .ca domain name. Unfortunately, there was no relevance but it was still an interesting read.

On a side note, Safeway and Sobeys in Canada don't have a loyalty program, instead they piggy back off of Air Miles. All of the special offers available just amount to bonus Air Miles, so they're not actually that worthwhile (IMO).

Re: Reversing Safeway's private APIs to automate coupon collection

#93
post #88

> This brought what used to be a painstaking process of clipping coupons from magazines to a slightly less painful process of having to click “Add” on all the coupons every week after logging onto their site. This is an insane trend in supermarket usability. You want to offer low prices, but only to people who go through a practice round of online shopping before doing it in person? Why are we doing this to ourselves…

They wouldn't make as much money if everyone clipped the coupon. However, most of the time, the coupons aren't really special. The loyalty club member price is already shown on the shelf anyway. Most "coupons" are more of an advertisement for the old folks who still do that. The incentive for the actually good coupons is to get you to come into the store and buy other stuff alongside the on-sale item. If I only have…

> They wouldn't make as much money if everyone clipped the coupon.

I get on a basic level it's a form of price discrimination, it just seems unfathomable that this bizarre skeuomorph, totally dependent on a series of random historical developments, would actually happen to line up with the way to extract the most return from your customers and/or give them the best experience.

But hey, I found the perpetual fake "50% off" sales at JC Penney's crazy making, and when they reversed that for more honest pricing they almost went out of business. I know I'm just shaking my fist at irrationality for no reason.

It still bothers me though.

Re: Reversing Safeway's private APIs to automate coupon collection

#94
I had written a similar program for US supermarket Publix, however I used it as an exercise to learn puppeteer[0] rather than using their private API directly.

Reading this inspired me to finally release it here: https://github.com/davecardwell/publix-coupon-clipper

[0] https://github.com/GoogleChrome/puppeteer

Re: Reversing Safeway's private APIs to automate coupon collection

#95
post #57

Earlier quoted context omitted.

Uses javascript to find all the page elements with the coupon add button styling attributes and then uses javascript to click each add button.

*uses jquery

`$` is a built-in wrapper around `document.querySelector` in many popular browser consoles (along with `$$` for `document.querySelectorAll`).

Though of course if Safeway's website does have a global `$` from jquery then that would take precedence.

Re: Reversing Safeway's private APIs to automate coupon collection

#96
It needs some tweaking to work now, but here is what I was using (in Python):

https://gist.github.com/danielatdattrixdotcom/bd6a05e3d8c499...

Executed via cron every day at a time before I would make a potential grocery run meant the coupons were already waiting on my account when I went to the store.

Re: Reversing Safeway's private APIs to automate coupon collection

#98
post #76

Earlier quoted context omitted.

The discount is markedly more substantial than 3%. If it's a Safeway brand gas station the max discount is a dollar off per gallon. The safeway gas station I used to do this at currently has regular for $2.69 a gallon.

The max discount I've ever seen is $0.20 for Chevron, but tends to be $0.10. Chevron is much less rare than a Safeway-branded gas station. Currently west coast gasoline is ~$4.00/g, so that's about 2.5-5.0% discount, which is in line with GP said.

I got 30 cents off yesterday at a Pacifica gas station. So far this purchase data hasn't hurt me in any fashion. They're welcome to it.

Re: Reversing Safeway's private APIs to automate coupon collection

#99
post #76

Earlier quoted context omitted.

The discount is markedly more substantial than 3%. If it's a Safeway brand gas station the max discount is a dollar off per gallon. The safeway gas station I used to do this at currently has regular for $2.69 a gallon.

The max discount I've ever seen is $0.20 for Chevron, but tends to be $0.10. Chevron is much less rare than a Safeway-branded gas station. Currently west coast gasoline is ~$4.00/g, so that's about 2.5-5.0% discount, which is in line with GP said.

For that $1 off/gallon gasoline, you need to have spent $1000 on groceries. So if your fillup is 10 gallons and gas costs $3/gallon, you will have spent $1000 to save $10. You aren't likely to spend $1000 between each fillup.

Re: Reversing Safeway's private APIs to automate coupon collection

#100
post #75

Earlier quoted context omitted.

Probably not... There's an ongoing case Linkedin v HiQ where Linkedin said HiQ was scraping publicly available linkedin profiles but there was a robots.txt that told them not to. HiQ kept doing it until Linkedin threatened them under the CFAA. HiQ just won a preliminary injunction to get to continue where the court said it was unlikely that they were violating the CFAA but they might change their minds as the case pr…

The Safeway API in question requires a user to be logged-in, authorized, and have explicitly agreed to a TOS (clickwrap). The HiQ v. LinkedIn case was centered around publicly accessible content which did not require the user to be authenticated nor have explicitly agreed to a TOS (browsewrap is not enforceable). I'd argue the above case does not apply here.

ahhh, yeah that is certainly quite distinct. Thanks for pointing that out.

HiQ v Linkedin kind of hinges on the implicit authorization given by making an API public. Here Safeway gave explicit authorization so I suppose it might come down to the TOS. Then again all Safeway has to do is revoke your account and you're gone, so I don't really know why anyone would be to worried about them coming after you with the CFAA. Cant be worth the effort.

Post reply on HN