Skip to content

Instantly share code, notes, and snippets.

@alimbada
Last active November 20, 2025 18:46
Show Gist options
  • Select an option

  • Save alimbada/3e673cb21d04400953fda8d2c7fb1995 to your computer and use it in GitHub Desktop.

Select an option

Save alimbada/3e673cb21d04400953fda8d2c7fb1995 to your computer and use it in GitHub Desktop.
A collection of useful JS snippets designed for use in a browser console

Average price of a list of search results on eBay

This is particularly useful when you want to know the going rate of an item you're planning to sell, i.e. in conjunction with the "Sold items" filter.

$x("//ul[contains(@class,'srp-results')]//div//span[contains(@class,'s-card__price')]").slice(0,22).map(x => Number(x.innerText.slice(1))).reduce((x,y) => x + y)/22

NB: 22 is the number of items I want to take and average. Adjust as needed to match the number of items that match your search (or limit the number of items you want to take the average of).


Scrape video IDs from a YouTube Playlist

$x("//a[contains(@class,'ytd-playlist-video-renderer')]/@href").map(x => x.value.substring(9,20)).join('\n') 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment