Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
Fix Raffle Items Scrape
Browse files Browse the repository at this point in the history
- Changed regex to get the raffle products

Note:
If it breaks again, i'll just switch to BS4
  • Loading branch information
Matthew17-21 committed Nov 11, 2021
1 parent 59c5c28 commit cf9a669
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions newegg/submit_raffle/raffles.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

def get_items():
temp = []
s = requests.Session()
while True:
try:
s = requests.Session()
res = s.get("https://www.newegg.com/product-shuffle")
raffle_products = json.loads(re.findall(r"{.+[:,].+}", res.text)[1].split("</script>")[0])
raffle_products = json.loads(re.findall(r"(?<=window\.__initialState__[^{]\S.)(.*?)(?=<\/script>)", res.text)[0])
for products in raffle_products["lotteryData"]["LotteryItems"]:
for raffle_item in products["ChildItem"]:
# Get the item(s) in the combo
Expand Down

0 comments on commit cf9a669

Please sign in to comment.