Skip to content

Instantly share code, notes, and snippets.

@almog
Last active August 4, 2019 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almog/2546339adc258a661e93cd4d15873ec1 to your computer and use it in GitHub Desktop.
Save almog/2546339adc258a661e93cd4d15873ec1 to your computer and use it in GitHub Desktop.
Extract list of high volume ebay sellers
// Run this script on a search page to get a list of large sellers (>1000)
// Use &_saslop=2&_sasl=<comma separated list to exclude sellers>
let sellerNameAndSalesMapper = (elem) => {
let sellerAndSalesText = elem.innerText.match(/Seller: ([-.\w]*) \(([\d,]*)\)/).slice(1)
return { seller: sellerAndSalesText[0], sales: parseInt(sellerAndSalesText[1].replace(',', ''), 10) }
}
let bigSellersFilter = (sellerAndSales) => {
const LARGE_SELLER_CAP = 1000
return sellerAndSales['sales'] > LARGE_SELLER_CAP
}
let sellerAndSalesElems = Array.from(document.querySelectorAll('.s-item__seller-info-text'))
let sellerAndSales = sellerAndSalesElems.map(sellerNameAndSalesMapper)
let bigSellersNames = sellerAndSales.filter(bigSellersFilter).map((o) => o['seller'])
let uniqueSellersNames = Array.from((new Set(bigSellersNames)))
let nonTruncatedNames = uniqueSellersNames.filter((name) => !name.includes('...'))
let truncatedNames = uniqueSellersNames.filter((name) => name.includes('...'))
console.log(nonTruncatedNames.join(','))
console.log("Truncated names:", truncatedNames.join(','))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment