Skip to content

Instantly share code, notes, and snippets.

@s0md3v
Created August 2, 2019 17:17
Show Gist options
  • Save s0md3v/ed481a45a156ef52f82e17cf902dff67 to your computer and use it in GitHub Desktop.
Save s0md3v/ed481a45a156ef52f82e17cf902dff67 to your computer and use it in GitHub Desktop.
multi-threaded goop
import sys
import json
import concurrent.futures
from goop import goop
green = '\033[92m'
white = '\033[97m'
yellow = '\033[93m'
end = '\033[0m'
cookie = '<your facebook cookie here>'
threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=10)
futures = (threadpool.submit(goop.search, sys.argv[1], cookie, page, True) for page in range(int(sys.argv[2])))
for i in concurrent.futures.as_completed(futures):
result = i.result()
for each in result:
print ('''%s%s\n%s%s\n%s%s%s\n''' % (green, result[each]['text'], yellow, result[each]['url'], white, result[each]['summary'], end))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment