Skip to content

Instantly share code, notes, and snippets.

@MarkWalters-dev
Created March 14, 2020 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkWalters-dev/a9a4d94c43db09f5292fef87b74034b4 to your computer and use it in GitHub Desktop.
Save MarkWalters-dev/a9a4d94c43db09f5292fef87b74034b4 to your computer and use it in GitHub Desktop.
Download chrome extension and extract it
#!/usr/bin/env bash
# pip has 2 options for downloading chrome extensions. cedl and chrome-webstore-download
# cedl has a more recent update than chrome-webstore-download
# but cedl polutes ~/bin by downloading to ~/bin/chrome-extensions so it is not an option without fixing that anti-feature
# chrome-webstore-download downloads to the current directory but requires -u|--url which is annoying but has the
# option to save to a custom filename with -f|--file which could come in handy
#
# This little script uses chrome-webstore-download to download and extract a chrome extension
#
# Example: crxdl https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf
hash chrome-webstore-download 2>/dev/null || pip install chrome-webstore-download
result=`chrome-webstore-download -u "$1"` || exit 1
resulttmp=${result/Downloading }
filename=${resulttmp/. *}
dir=${filename%%.crx}
unzip -o $filename -d $dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment