Created
July 2, 2025 09:06
-
-
Save melardev/15893b3621d670002e8b9565cdb809c0 to your computer and use it in GitHub Desktop.
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
| // Based on the Chrome extension: https://github.com/tonystark93/crx-download | |
| // Adapted to be run from the Developer console | |
| // To my surprise, when I entered the link in Chrome, it downloaded the extension and apparently tried to install it | |
| // but it triggered a security error, for exrta safety download the extension in Firefox incognito window | |
| (() => { | |
| const chromeURLPattern = /^https?:\/\/chrome\.google\.com\/webstore\/.+?\/([a-z]{32})(?=[\/#?]|$)/; | |
| const microsoftURLPattern = /^https?:\/\/microsoftedge\.microsoft\.com\/addons\/detail\/.+?\/([a-z]{32})(?=[\/#?]|$)/; | |
| const chromeNewURLPattern = /^https?:\/\/chromewebstore\.google\.com\/detail\/.+?\/([a-z]{32})(?=[\/#?]|$)/; | |
| function getChromeVersion() { | |
| const pieces = navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/); | |
| if (!pieces || pieces.length !== 5) return undefined; | |
| return { | |
| major: parseInt(pieces[1], 10), | |
| minor: parseInt(pieces[2], 10), | |
| build: parseInt(pieces[3], 10), | |
| patch: parseInt(pieces[4], 10), | |
| }; | |
| } | |
| function getNaclArch() { | |
| if (navigator.userAgent.includes('x64')) return 'x86-64'; | |
| if (navigator.userAgent.includes('x86')) return 'x86-32'; | |
| return 'arm'; | |
| } | |
| const versionObj = getChromeVersion(); | |
| if (!versionObj) return console.error("Failed to detect Chrome version."); | |
| const version = `${versionObj.major}.${versionObj.minor}.${versionObj.build}.${versionObj.patch}`; | |
| const nacl_arch = getNaclArch(); | |
| const url = location.href; | |
| let match = chromeURLPattern.exec(url) || chromeNewURLPattern.exec(url); | |
| let platform = "chrome"; | |
| if (!match) { | |
| match = microsoftURLPattern.exec(url); | |
| platform = "edge"; | |
| } | |
| if (!match || !match[1]) { | |
| console.error("Extension ID not found in current URL."); | |
| return; | |
| } | |
| const extId = match[1]; | |
| if (platform === "chrome") { | |
| const crxUrl = `https://clients2.google.com/service/update2/crx?response=redirect&prodversion=${version}&acceptformat=crx2,crx3&x=id%3D${extId}%26uc&nacl_arch=${nacl_arch}`; | |
| const zipUrl = `https://clients2.google.com/service/update2/crx?response=redirect&prodversion=${version}&x=id%3D${extId}%26installsource%3Dondemand%26uc&nacl_arch=${nacl_arch}&acceptformat=crx2,crx3`; | |
| console.log("Extension ID:", extId); | |
| console.log("Platform: Chrome"); | |
| console.log("CRX URL:", crxUrl); | |
| console.log("ZIP URL (Base64 CRX download):", zipUrl); | |
| } else if (platform === "edge") { | |
| const crxUrl = `https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&prod=chromiumcrx&prodchannel=&x=id%3D${extId}%26installsource%3Dondemand%26uc`; | |
| console.log("Extension ID:", extId); | |
| console.log("Platform: Edge"); | |
| console.log("CRX URL:", crxUrl); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment