ben-yeung / stock-Xtension

Chrome extension to quickly view StockX details of a sneaker to compare resell vs retail without leaving the product page
1 stars 0 forks source link

FinishLine support #3

Closed ben-yeung closed 3 years ago

ben-yeung commented 3 years ago

FinishLine links seem to be more friendly with providing the style codes for shoes: https://www.finishline.com/store/product/mens-new-balance-327-casual-shoes/prod2800652?styleId=MS327PBA&colorId=407

The one roadblock is how colorIDs are treated. For example, Adidas and New Balance shoes can be found by using the styleId only when calling the StockX api.

Jordans, however, need both the style id and color id added in order to fetch the correct colorway. From testing so far it appears that Adidas and other brands like New Balance seem to differentiate shoes without the need of colorId.

This would mean that before setting the api url we would need to identify the current shoe's brand and then appropriately concatenate a style id string.

First approach that comes to mind would be checking the url directly via .includes( ) to see which brand is present.

ben-yeung commented 3 years ago

Extracting the style id and color id works pretty well after implementing. Still testing but Nike, Jordan, and Adidas is returning results. When the url contains 'adidas' only the styleId attribute is used. For other brands such as Nike or Jordan the colorId is appended to the end of the styleId.

ben-yeung commented 3 years ago

FinishLine and JDSports urls with style ids proved to be consistent from basic testing. Support for both was added here