Created
August 2, 2019 17:17
-
-
Save s0md3v/ed481a45a156ef52f82e17cf902dff67 to your computer and use it in GitHub Desktop.
multi-threaded goop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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