1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-11-30 18:43:17 +00:00
dotfiles/qutebrowser/userscripts/wikidns

6 lines
347 B
Bash
Executable file

#!/bin/sh
search=$(echo "$@" | tr ' ' +)
query='https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch='
wikiurl="https://en.wikipedia.org/wiki/$(curl "$query$search"| jq -r .query.search[0].title | sed 's/ /%20/')"
echo open "$(curl -L "$wikiurl" | pup '.infobox .url a.external attr{href}' | tail -n1)" >> "$QUTE_FIFO"