Merge branch 'rsteube-master'
This commit is contained in:
commit
b9ddea0e7a
@ -21,6 +21,7 @@ Added
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
- Userscripts now have a new `$QUTE_COMMANDLINE_TEXT` environment variable, containing the current commandline contents.
|
- Userscripts now have a new `$QUTE_COMMANDLINE_TEXT` environment variable, containing the current commandline contents.
|
||||||
|
- New `ripbang` userscript to create a searchengine from a duckduckgo bang
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -213,6 +213,7 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Brian Jackson
|
* Brian Jackson
|
||||||
* thuck
|
* thuck
|
||||||
* sbinix
|
* sbinix
|
||||||
|
* rsteube
|
||||||
* neeasade
|
* neeasade
|
||||||
* jnphilipp
|
* jnphilipp
|
||||||
* Tobias Patzl
|
* Tobias Patzl
|
||||||
@ -239,7 +240,6 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Eric Drechsel
|
* Eric Drechsel
|
||||||
* zwarag
|
* zwarag
|
||||||
* xd1le
|
* xd1le
|
||||||
* rsteube
|
|
||||||
* rmortens
|
* rmortens
|
||||||
* pkill9
|
* pkill9
|
||||||
* oniondreams
|
* oniondreams
|
||||||
|
27
misc/userscripts/ripbang
Executable file
27
misc/userscripts/ripbang
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
#
|
||||||
|
# Adds DuckDuckGo bang as searchengine.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# :spawn --userscript ripbang [bang]...
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# :spawn --userscript ripbang amazon maps
|
||||||
|
#
|
||||||
|
import os, re, requests, sys, urllib
|
||||||
|
|
||||||
|
for argument in sys.argv[1:]:
|
||||||
|
bang = '!' + argument
|
||||||
|
r = requests.get('https://duckduckgo.com/',
|
||||||
|
params={'q': bang + ' SEARCHTEXT'})
|
||||||
|
|
||||||
|
searchengine = urllib.unquote(re.search("url=[^']+", r.text).group(0))
|
||||||
|
searchengine = searchengine.replace('url=', '')
|
||||||
|
searchengine = searchengine.replace('/l/?kh=-1&uddg=', '')
|
||||||
|
searchengine = searchengine.replace('SEARCHTEXT', '{}')
|
||||||
|
|
||||||
|
if os.getenv('QUTE_FIFO'):
|
||||||
|
with open(os.environ['QUTE_FIFO'], 'w') as fifo:
|
||||||
|
fifo.write('set searchengines %s %s' % (bang, searchengine))
|
||||||
|
else:
|
||||||
|
print '%s %s' % (bang, searchengine)
|
Loading…
Reference in New Issue
Block a user