removed try/except from ripbang userscript

This commit is contained in:
rsteube 2017-01-02 21:53:04 +01:00
parent 8169d1865a
commit a716861bfa

View File

@ -10,13 +10,12 @@
#
import os, re, requests, sys, urllib
try:
for argument in sys.argv[1:]:
bang = '!' + argument
r = requests.get('https://duckduckgo.com/', params={'q': bang + ' SEARCHTEXT'})
r = requests.get('https://duckduckgo.com/',
params={'q': bang + ' SEARCHTEXT'})
searchengine = urllib.unquote(re.search("url=[^']+", r.text).group(
0))
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', '{}')
@ -26,6 +25,3 @@ try:
fifo.write('set searchengines %s %s' % (bang, searchengine))
else:
print '%s %s' % (bang, searchengine)
except:
# fail silent
exit(1)