From fb3836bbbe309609ae121dcb07df79334e2eb7e4 Mon Sep 17 00:00:00 2001 From: kaivio Date: Sat, 19 Mar 2022 18:09:29 +0800 Subject: [PATCH] feat(burl): add plugin burl(comes with browser usual headers for curl) --- plugins/burl/README.md | 3 +++ plugins/burl/burl.plugin.zsh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 plugins/burl/README.md create mode 100644 plugins/burl/burl.plugin.zsh diff --git a/plugins/burl/README.md b/plugins/burl/README.md new file mode 100644 index 000000000..2df494e4a --- /dev/null +++ b/plugins/burl/README.md @@ -0,0 +1,3 @@ +# burl + +Comes with browser usual headers for curl. diff --git a/plugins/burl/burl.plugin.zsh b/plugins/burl/burl.plugin.zsh new file mode 100644 index 000000000..a35a16304 --- /dev/null +++ b/plugins/burl/burl.plugin.zsh @@ -0,0 +1,31 @@ + +function burl() { + local url="$1" + if [[ "$url" == '' || "$rl" == '-h' ]]; then + cat < [...other args of curl] +EOF + return 0 + fi + + shift + curl "$url"\ + -H 'Connection: keep-alive'\ + -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"'\ + -H 'sec-ch-ua-mobile: ?0'\ + -H 'sec-ch-ua-platform: "Linux"'\ + -H 'DNT: 1'\ + -H 'Upgrade-Insecure-Requests: 1'\ + -H 'User-Agent: Mozilla/5.0 (X11; Debian; Linux x86_64; rv:85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36'\ + -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'\ + -H "origin: $(echo "$url" | sed 's!\([^\:/]\)/.*!\1!g')"\ + -H "referer: $url"\ + -H 'Sec-Fetch-Site: same-site'\ + -H 'Sec-Fetch-Mode: navigate'\ + -H 'Sec-Fetch-User: ?1'\ + -H 'Sec-Fetch-Dest: document'\ + -H 'Accept-Encoding: gzip, deflate, br'\ + -H 'Accept-Language: en-US,en;q=0.9'\ + "$@" +}