Skip to content

Instantly share code, notes, and snippets.

@joshuashaffer
Created October 17, 2017 22:46
Show Gist options
  • Save joshuashaffer/8ed739889ae89d1145cd6c76f2b1fd86 to your computer and use it in GitHub Desktop.
Save joshuashaffer/8ed739889ae89d1145cd6c76f2b1fd86 to your computer and use it in GitHub Desktop.
Add User Agents to wget Command Completion in zsh
--- functions/Completion/Unix/_wget.org 2013-10-10 10:30:13.000000000 -0400
+++ functions/Completion/Unix/_wget 2017-10-17 18:40:36.035294849 -0400
@@ -3,6 +3,18 @@
local curcontext="$curcontext" state line
typeset -A opt_args
+local user_agents
+user_agents=("Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"
+"Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+"
+"NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"
+"Mozilla/5.0 (PLAYSTATION 3; 3.55)"
+"PSP (PlayStation Portable); 2.00"
+"wii libnup/1.0"
+"Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)"
+"Googlebot/2.1 (+http://www.googlebot.com/bot.html)"
+"NCSA Mosaic/3.0 (Windows 95)"
+"Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14")
+
_arguments -C -s \
'(- *)'{--version,-V}'[display version info]' \
'(- *)'{--help,-h}'[display help]' \
@@ -59,7 +71,7 @@
'--proxy-password=:password' \
'--referer=:URL:_urls' \
'--save-headers[save http headers]' \
- '(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent' \
+ '(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent:(${user_agents})' \
'--no-http-keep-alive[disable HTTP keep-alive]' \
'--no-cookies=[turn cookies off]' \
'--load-cookies=[specify file to load cookies from]:cookie file:_files' \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment