Last active
February 23, 2023 21:21
-
-
Save pdehaan/927e1b09f1b5daeffc2ab7f28e738a80 to your computer and use it in GitHub Desktop.
Scraping the official Mozilla add-ons for fun and profit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
import bytes from "bytes"; | |
import dedent from "dedent"; | |
const query = new URLSearchParams({ | |
author: "mozilla", | |
page_size: 100, | |
type: "extension", | |
}); | |
const uri = `https://addons.mozilla.org/api/v5/addons/search/?${query}`; | |
const dateFormatter = new Intl.DateTimeFormat("en-US", { dateStyle: "medium" }); | |
const res = await axios.get(uri); | |
console.log(uri + "\n\n"); | |
res.data.results?.sort((a, b) => { | |
const aDate = new Date(a.last_updated); | |
const bDate = new Date(b.last_updated); | |
return bDate - aDate; | |
}) | |
.forEach((ext) => { | |
const dat = new Date(ext.last_updated); | |
console.log(dedent` | |
name: ${ext.name["en-US"]} (${ext.current_version.version}) | |
size: ${bytes(ext.current_version.file.size, { decimalPlaces: 1, unitSeparator: " "})} | |
last_updated: ${ dateFormatter.format(dat)} (${msAgo(dat).toLocaleString()} days ago) | |
ratings: ${ext.ratings.average} (${ext.ratings.count?.toLocaleString()}) | |
average_daily_users: ${ext.average_daily_users.toLocaleString()} | |
weekly_downloads: ${ext.weekly_downloads.toLocaleString()} | |
homepage: ${ext.homepage?.url?.["en-US"] || "n/a"} | |
license: ${ext.current_version.license?.slug} | |
`); | |
console.log(""); | |
}); | |
function msAgo(date) { | |
const daysInMs = 1000 * 60 * 60 * 24; | |
const now = Date.now(); | |
const dateMs = new Date(date).getTime(); | |
return Math.ceil((now - dateMs) / daysInMs); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://addons.mozilla.org/api/v5/addons/search/?author=mozilla&page_size=100&type=extension | |
name: Firefox Relay (2.6.1) | |
size: 777.5 KB | |
last_updated: Feb 22, 2023 (2 days ago) | |
ratings: 4.0957 (1,275) | |
average_daily_users: 138,528 | |
weekly_downloads: 2,394 | |
homepage: https://relay.firefox.com/ | |
license: MPL-2.0 | |
name: Firefox Multi-Account Containers (8.1.2) | |
size: 847 KB | |
last_updated: Jan 23, 2023 (32 days ago) | |
ratings: 4.6199 (6,322) | |
average_daily_users: 331,542 | |
weekly_downloads: 9,431 | |
homepage: https://github.com/mozilla/multi-account-containers/#readme | |
license: MPL-2.0 | |
name: RegretsReporter (2.1.2) | |
size: 1.6 MB | |
last_updated: Jan 9, 2023 (46 days ago) | |
ratings: 3.9606 (127) | |
average_daily_users: 10,192 | |
weekly_downloads: 71 | |
homepage: https://foundation.mozilla.org/regrets-reporter | |
license: MPL-2.0 | |
name: Firefox Translations (1.2.0buildid20221114.185738) | |
size: 3.1 MB | |
last_updated: Nov 15, 2022 (101 days ago) | |
ratings: 3.7938 (422) | |
average_daily_users: 60,979 | |
weekly_downloads: 8,250 | |
homepage: https://blog.mozilla.org/en/mozilla/local-translation-add-on-project-bergamot/ | |
license: MPL-2.0 | |
name: Facebook Container (2.3.9) | |
size: 394.5 KB | |
last_updated: Nov 3, 2022 (113 days ago) | |
ratings: 4.4529 (3,734) | |
average_daily_users: 1,186,350 | |
weekly_downloads: 7,007 | |
homepage: https://github.com/mozilla/contain-facebook | |
license: MPL-2.0 | |
name: Extended Color Management (1.1.1) | |
size: 27.4 KB | |
last_updated: Jun 27, 2022 (242 days ago) | |
ratings: 4.75 (12) | |
average_daily_users: 1,800 | |
weekly_downloads: 101 | |
homepage: n/a | |
license: MPL-2.0 | |
name: Rally Pilot Studies (1.4.3buildid20220204.013924) | |
size: 3.1 MB | |
last_updated: Mar 21, 2022 (340 days ago) | |
ratings: 4.2353 (17) | |
average_daily_users: 6,016 | |
weekly_downloads: 67 | |
homepage: https://github.com/mozilla-rally/rally-core-addon/ | |
license: MPL-2.0 | |
name: B!tch to Boss (1.6) | |
size: 37.4 KB | |
last_updated: Mar 11, 2021 (715 days ago) | |
ratings: 3.4927 (274) | |
average_daily_users: 741 | |
weekly_downloads: 19 | |
homepage: n/a | |
license: MPL-2.0 | |
name: Firefox Color (2.1.7) | |
size: 123 KB | |
last_updated: Sep 24, 2020 (883 days ago) | |
ratings: 4.4156 (1,155) | |
average_daily_users: 116,135 | |
weekly_downloads: 2,815 | |
homepage: https://color.firefox.com | |
license: MPL-2.0 | |
name: Notes by Firefox (4.3.7) | |
size: 1.8 MB | |
last_updated: Sep 18, 2020 (889 days ago) | |
ratings: 4.0056 (536) | |
average_daily_users: 24,247 | |
weekly_downloads: 356 | |
homepage: https://github.com/mozilla/notes | |
license: MPL-2.0 | |
name: Side View (0.4.6423) | |
size: 47.4 KB | |
last_updated: Sep 25, 2018 (1,613 days ago) | |
ratings: 4.1733 (202) | |
average_daily_users: 13,943 | |
weekly_downloads: 303 | |
homepage: https://github.com/mozilla/side-view/ | |
license: MPL-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "moz-amo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "node index", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"type": "module", | |
"keywords": [], | |
"author": "Peter deHaan <[email protected]>", | |
"license": "MPL-2.0", | |
"dependencies": { | |
"axios": "^1.3.4", | |
"bytes": "^3.1.2", | |
"dedent": "^0.7.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment