Skip to content

Instantly share code, notes, and snippets.

@Aikufurr
Created January 26, 2022 14:57
Show Gist options
  • Save Aikufurr/76a5b68ff0bc2f3c17081512155adf63 to your computer and use it in GitHub Desktop.
Save Aikufurr/76a5b68ff0bc2f3c17081512155adf63 to your computer and use it in GitHub Desktop.
import subprocess
import json
import sys
output = subprocess.Popen(["curl", "-s", "-L", "http://suggestqueries.google.com/complete/search?client=firefox&q=" + sys.argv[1]], stdout=subprocess.PIPE).communicate()[0]
l = json.loads(output)[1]
for i,e in enumerate(l):
print(str(i) + ": " + e)
i = input("> ")
p = subprocess.Popen(["xsel", "-bi"], stdin=subprocess.PIPE)
p.communicate(input=l[int(i)].encode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment