Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

[BUG] BestBuy bug Product-Data-Value body-copy is not always defined #42

Open
aemperor opened this issue Apr 29, 2020 · 5 comments
Open

Comments

@aemperor
Copy link

aemperor commented Apr 29, 2020

Summary:

The array index on line 76 of bestbuy.py causes an error when the product-data-value body-copy is not defined on the browser page. It seems there's some inconsistency with BestBuy's pages.

Error:

[2020-04-28 20:59:13][TASK 8] Error Loading Product Page (line 76 IndexError list index out of range)

Example Page:

https://www.bestbuy.com/site/combo/nintendo-switch-consoles/50fd30b0-690e-4cee-b87e-8f09ad1f85d7

Offending Line:

self.sku_id = doc.xpath('//span[@class="product-data-value body-copy"]/text()')[1].strip()

Offending Line Link:

https://github.com/natewong1313/bird-bot/blob/master/sites/bestbuy.py#L76

@5150Joker
Copy link

That bug is there even when the product-data value body-copy is present on the page. For example: https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445

@AdamOC3
Copy link

AdamOC3 commented Oct 6, 2020

Is there a solution for this?

@echocli
Copy link

echocli commented Nov 30, 2020

I know I'm late but try changing line 76 to this
self.sku_id = doc.xpath('//div[@class="sku product-data"]//span[@class="product-data-value body-copy"]/text()')[0].strip()

@SwiftCODA
Copy link

@echocli Are you located outside of the US? If so, figure out how to use a US proxy. The problem is that the HTML that is returned by the request is actually the page you see when you visit bestbuy.COM if you live in Canada. BestBuy.com sees that you have a Canadian IP and shows you a different page than expected. A US proxy should avoid this.

@SwiftCODA
Copy link

Solution is to use a United States Proxy. Please close. @natewong1313

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants