Skip to content

Instantly share code, notes, and snippets.

@sbolel
Last active October 24, 2020 02:43
Show Gist options
  • Save sbolel/51b66ee47314d4407788e447c2abf71a to your computer and use it in GitHub Desktop.
Save sbolel/51b66ee47314d4407788e447c2abf71a to your computer and use it in GitHub Desktop.
Get Chrome extension source
#!/bin/sh
# Downloads a Chrome extensions source.
# @param {string} extension_id - the id in the url for the extension
if [[ $# == 0 ]]; then
printf "Enter the ID of the extension: "
read -r extension_id
else
extension_id=$1
fi
extension_url="https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc"
curl -L -o "$HOME/Downloads/$extension_id.zip" "$extension_url"
unzip -d "$HOME/Downloads/$extension_id-source" "$HOME/Downloads/$extension_id.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment