Skip to content

Instantly share code, notes, and snippets.

View thirtythreeforty's full-sized avatar

George Hilliard thirtythreeforty

View GitHub Profile
@thirtythreeforty
thirtythreeforty / CouponScrapper
Created June 27, 2016 02:35 — forked from mxrss/CouponScrapper
Uses powershell to scrape website content for coupon sites using their json api's.
# this grabs offers from stater bros.com
$coupons = $null
$json = Invoke-WebRequest -Uri "http://coupons.staterbros.com/Coupons/Index?pageSize=600&currentPage=1&filter=0&sort=1&couponType=4&brandName=AllBrands&_=1383513834477" | select-object -Property Content
$StaterBriosrawObj = ConvertFrom-Json $json.Content
$StaterBriosrawObj.CouponsGrid | Group-Object { $_.Name } | Sort-Object -Descending Count
$staterCoupons = $StaterBriosrawObj.CouponsGrid
$coupons += $staterCoupons | Select-Object @{Name="Brand"; Expression={ $_.Name.tolower() -replace "[^A-Za-z0-9_.\$@ ]","" }}, #-replace [char]174, '' -replace [char]8482, '' } },
@{Name="Category";Expression={ "N/A"}},