// ==UserScript== // @name Edge CRX Downloader // @license AGPL-3.0 // @namespace https://github.com/54145a // @version 1.1 // @description Download CRX file from Edge Add-ons // @author 145a // @match https://microsoftedge.microsoft.com/addons/detail/* // @grant GM_registerMenuCommand // @grant GM_download // ==/UserScript== (function() { "use strict"; GM_registerMenuCommand('Download CRX', () => { // URL be like: https://microsoftedge.microsoft.com/addons/detail/content-farm-terminator/fgckcfkpckemdnnejbbfkkchanedbeje const parts = location.pathname.replace(/\/$/, '').split('/'); const id = parts.pop(); const name = parts.pop(); if (!id || !/^[a-z]{32}$/i.test(id)) { alert('Failed to extract extension ID.'); return; } const filename = name && /^[\w-]+$/.test(name) ? `${name}.crx` : `${id}.crx`; /** @see https://learn.microsoft.com/zh-cn/answers/questions/2366350/microsoft-edge-crx */ const url = `https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&prod=chromiumcrx&prodchannel=&x=id%3D${id}%26installsource%3Dondemand%26uc`; GM_download({ url: url, name: filename, saveAs: true }); }); })();