Hi all,
After spending days manually searching for Pencil stock, I wrote two simple scripts to query Best Buy and Apple for stock. They worked as advertised, alerting me this morning that Best Buy had stock online. For myself, I set up a cron job to execute the scripts every 5 minutes and things seemed to work.
Best Buy
- https://gist.github.com/jeremygibbs/1a6c248d12dda568d67d
- You will need an API key from: https://developer.bestbuy.com
- This searches for both online and in-store availability
- For in-store, you give a lat/lon and a search distance
- If either is available, an email alert is sent with a link to the product
Apple
- https://gist.github.com/jeremygibbs/1d62544ee57dc4ee8633
- This searches for in-store availability
- You give a zip code.
- I haven't found the correct api call for distance, but you could easily filter
- If available, an email alert is sent with a link to the product
For both scripts, an html file is written for stand-alone viewing of availability status, or within Panic's Status Board app. I've attached a sample image to show what Status Board looks like.
As a caveat, I am not a php programmer - just familiar enough with the language to be functional. I understand that these could be written better, but my goal was to get something that worked.
Hopefully this will be a helpful starting point for those struggling to find stock.
After spending days manually searching for Pencil stock, I wrote two simple scripts to query Best Buy and Apple for stock. They worked as advertised, alerting me this morning that Best Buy had stock online. For myself, I set up a cron job to execute the scripts every 5 minutes and things seemed to work.
Best Buy
- https://gist.github.com/jeremygibbs/1a6c248d12dda568d67d
- You will need an API key from: https://developer.bestbuy.com
- This searches for both online and in-store availability
- For in-store, you give a lat/lon and a search distance
- If either is available, an email alert is sent with a link to the product
Apple
- https://gist.github.com/jeremygibbs/1d62544ee57dc4ee8633
- This searches for in-store availability
- You give a zip code.
- I haven't found the correct api call for distance, but you could easily filter
- If available, an email alert is sent with a link to the product
For both scripts, an html file is written for stand-alone viewing of availability status, or within Panic's Status Board app. I've attached a sample image to show what Status Board looks like.
As a caveat, I am not a php programmer - just familiar enough with the language to be functional. I understand that these could be written better, but my goal was to get something that worked.
Hopefully this will be a helpful starting point for those struggling to find stock.