This repository contains two versions of a JavaScript script designed to analyze and display statistical information about prices listed on ebay. The script extracts prices using a specific CSS selector, calculates statistical measures such as the minimum, maximum, average, median, and mode prices, and filters out outliers.
Important
THIS ONLY WORKS FOR SOLD/COMPLETED LISTINGS
There are two versions of the script:
-
Console Script: This version is intended for use in the developer console of a web browser. It includes descriptive comments to help understand and modify the code as needed.
-
Bookmarklet: This version is a compacted form of the script meant to be used as a browser bookmarklet for ease of use on any webpage without needing to open the developer console.
- Open the developer console on the webpage where you want to analyze prices. This is usually done by pressing
F12
or right-clicking on the page and selecting "Inspect". - Navigate to the Console tab.
- Copy and paste the entire Console Script into the console and press Enter. The results will be displayed in the console output.
- Create a new bookmark in your browser.
- Edit the bookmark and set the URL to be the entire Bookmarklet code.
- Save the bookmark.
- Click the bookmark while on the webpage you want to analyze. An alert box with the statistical data will appear.
The script works by performing the following steps:
-
Data Scraping: The script uses the CSS selector
.s-item__price .POSITIVE
to find elements on the webpage that contain pricing information. This can be adjusted to fit the specific structure of the target website. -
Data Cleaning: Prices are extracted as strings; the script removes any non-numeric characters (like dollar signs and commas) and converts these strings into numbers for analysis.
-
Outlier Removal: The script calculates the Interquartile Range (IQR) and uses it to identify and remove outliers from the data set. This ensures that the statistical analysis is not skewed by extreme values.
-
Statistical Analysis: The script calculates and displays the minimum, maximum, average, median, and mode prices from the cleaned, outlier-free dataset.