def google_scraper(temp): links = [] count = 1 for link in duckduckgo.search(temp, max_results=16): if count%4==0: links.append(link) count += 1 else: count += 1 ID = "kaisahai" + str(random.random()) url_1 = links[1] image = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSlJ6i0MqP20vfAwE1bCofPt6bKDQ27NA_GUrtR28GYHq1Xf67P" title_1 = links[1].split('/')[2] source_1 = links[1].split('/')[2] temp_1 = {'url' : url_1, 'imageURL': image, 'title':title_1,'source':source_1, 'id':ID} ID = "kaisahai" + str(random.random()) url_2 = links[3] image = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSlJ6i0MqP20vfAwE1bCofPt6bKDQ27NA_GUrtR28GYHq1Xf67P" title_2 = links[3].split('/')[2] source_2 = links[3].split('/')[2] temp_2 = {'url' : url_1, 'imageURL': image, 'title':title_2,'source':source_2, 'id':ID} return temp_1,temp_2
def check_duckduckgoInfo(email): try: links = duckduckgo.search(email, max_results=10) for link in links: print "|--[INFO][DuckDuckGO][SEARCH][>] " + str(link) except: print colores.alert + "|--[WARNING][DUCKDUCKGO][>] Error..." + colores.normal
def check_duckduckgo_smart_info(email: str) -> None: no_company = ("gmail", " hotmail", " yahoo", " protonmail", " mail") split1: List[str] = email.split("@") name: str = split1[0].replace(".", " ") split2: List[str] = split1[1].split(".") company: str = split2[0].replace(".", "") data: str if company in no_company: data = name else: data = f"{name} {company}" links: Generator = duckduckgo.search(data, max_results=10) for link in links: link_as_str = str(link) print(f"|--[INFO][DuckDuckGO][SMART SEARCH][>] {link_as_str}") if "linkedin.com/in/" in link_as_str: print( f"{colores['green']}|----[>][POSSIBLE LINKEDIN DETECT] ----{colores['normal']}" ) if "twitter.com" in link_as_str: print( f"{colores['green']}|----[>][POSSIBLE TWITTER DETECT] ----{colores['normal']}" ) if "facebook.com" in link_as_str: print( f"{colores['green']}|----[>][POSSIBLE FACEBOOK DETECT] ----{colores['normal']}" ) if "soundcloud.com/" in link_as_str: print( f"{colores['green']}|----[>][POSSIBLE SOUNDCLOUD DETECT] ----{colores['normal']}" )
def extractUrls(dorks): temp = [] for dork in open(dorks, "r").readlines(): for link in search(dork.strip(), max_results=400): if link not in temp: temp.append(link) return temp
def test_detect_no_results(self): """ Check that we correctly identify a 'no results' situation from the live search engine. """ noresults = "\"%s\"" % "".join(['fjdka', 'fdasfda', 'toitjfg']) self.assertEqual([], list(duckduckgo.search(noresults, max_results=5)))
def get_duckduckgoInfo(email): try: links = duckduckgo.search(email, max_results=10) for link in links: if "delsexo.com" in str(link): pass else: print "INFO:DuckDuckGO:SEARCH> " + str(link) except: print colores.alert + "|--[WARNING][DUCKDUCKGO][>] F**k!" + colores.normal
def extractUrls(dorks): temp = [] urls = [] for dork in open(dorks, 'r').readlines(): for link in search(dork.strip(), max_results=100): temp.append(link) for url in temp: if url not in urls: urls.append(url) return urls
def check_duckduckgo_info(email: str) -> None: try: links: Generator = duckduckgo.search(email, max_results=10) for link in links: if "delsexo.com" not in str(link): print(f"|--[INFO][DuckDuckGO][SEARCH][>] {link}") except Exception: print( f"{colores['alert']}|--[WARNING][DUCKDUCKGO][>] Error...{colores['normal']}" )
def getCompleteUrl(query): time.sleep(1) try: print('Searching for:', query) for j in search(query, max_results=10): if j.startswith(query): return j else: print('result:', j) except Exception as e: print('Exception in search:', e)
def serveSuccess(name): for link in duckduckgo.search(name, 10): url = link break player = PlayerProfile(url, bs) data = {} data['query'] = name data['duck_source'] = url data['tranfermarkt_image_figurina'] = player.PlayerData.img json_data = json.dumps(data) return json_data
def Searchduckduckgo(domain): try: url_scan = [] dork1 = "site:" + domain + " " + "inurl:.php?id=" links = duckduckgo.search(dork1, max_results=10) for link in links: url_scan.append(str(link)) l = len(url_scan) if l < 2: print "|----[WARNING] The search hasn't results with 'inurl:.php?id='." return None else: print "|----[INFO] Founds the result: " + str(l) return url_scan except Exception as e: print e
def check_duckduckgoSmartInfo(email): no_company = ("gmail"," hotmail"," yahoo"," protonmail"," mail") split1 = email.split("@") name = split1[0].replace("."," ") split2 = split1[1].split(".") company = split2[0].replace(".", "") if company in no_company: data = name else: data = name + " " + company links = duckduckgo.search(data, max_results=10) for link in links: print "|--[INFO][DuckDuckGO][SMART SEARCH][>] " + str(link) if "linkedin.com/in/" in str(link): print colores.green + "|----[>][POSSIBLE LINKEDIN DETECT] ----" + colores.normal if "twitter.com" in str(link): print colores.green + "|----[>][POSSIBLE TWITTER DETECT] ----" + colores.normal if "facebook.com" in str(link): print colores.green + "|----[>][POSSIBLE FACEBOOK DETECT] ----" + colores.normal if "soundcloud.com/" in str(link): print colores.green + "|----[>][POSSIBLE SOUNDCLOUD DETECT] ----" + colores.normal
def main(): """Controls the flow of the ddg application""" 'Build the parser and parse the arguments' parser = argparse.ArgumentParser( description='www.duckduckgo.com zero-click api for your command-line' ) parser.add_argument('query', nargs='*', help='the search query') parser.add_argument('-b', '--bang', action='store_true', help='open the !bang redirect url in a new browser tab') parser.add_argument('-d', '--define', action='store_true', help='return the definition result') parser.add_argument('-j', '--json', action='store_true', help='return the zero-click info api json response') parser.add_argument('-l', '--lucky', action='store_true', help='open the result url in a new browser tab') parser.add_argument('-s', '--search', action='store_true', help='launch a DuckDuckGo search in a new browser tab') parser.add_argument('-u', '--url', action='store_true', help='return the result url') args = parser.parse_args() 'Get the queries' if args.query: queries = [' '.join(args.query)] elif not sys.stdin.isatty(): queries = sys.stdin.read().splitlines() else: parser.print_help() return 'Determine if we need to add any prefixes based on user flags' prefix = '!ddg ' if args.search else '!' if args.bang else '' 'Loop through each query' for query in queries: 'Prefix the query' query = prefix + query 'Get a response from api.duckduck.com using the duckduckgo module' results = duckduckgo.search(query) 'If results is null, continue to the next query' if not results: continue 'Print the raw json output and return' if args.json: print_result(results.json) continue 'a list of where to look for an answer first' results_priority = get_results_priority(args) 'do we want the text or url output of the answer found' var = get_text_or_url(args) 'action to perform when an answer is found' action = get_action(args) 'Search for an answer and perform an action' failed_to_find_answer = True for r in results_priority: result = getattr(getattr(results, r), var) if result: action(result) failed_to_find_answer = False break 'Let the user know if no answer was found' if failed_to_find_answer: if results.type == 'disambiguation': print 'Your query was ambiguous, please be more specific' else: print 'No results found'
message = ( "Currently, @CryptoBotHunter detected {} #Twitter #crypto #bots.\n" "Detailed list is available here: {}").format( len(pseudos), pbin_url) try: api.update_status(message) except: print("api.update_status()") if __name__ == '__main__': while True: pattern = random.choice(patterns) search = str.join(' ', pattern) print(search) #result = GoogleSearch().search(search, num_results=100) result = duckduckgo.search(search, max_results=100) parse_google_web_search(result, pattern) publish_summary_tweet() time.sleep(DELAY_BETWEEN_PUBLICATION) for p in list(pseudos): url = get_profile_picture_url("https://twitter.com/{}".format(p)) if url: google_image_search(url) publish_tweet(p, pseudos[p]) time.sleep(DELAY_BETWEEN_PUBLICATION)
import duckduckgo urls = open("./urls_politica.txt", "w+") for link in duckduckgo.search('site:www.ansa.it/sito/notizie/politica', max_results=400): urls.write(link + "\n") print link urls.close()
def test_get_some_results(self): """ Check that we're actually getting some URLS for a common search term. """ results = list(duckduckgo.search('test', max_results=5)) self.assertEqual(5, len(results))
def cmd_ddg(self, nick, args, admin): """Használat: !ddg query""" if not args: return cmd_help(nick, 'ddg', admin) else: return duckduckgo.search(args)
def cmd_ddg(nick, args, admin): """Használat: !ddg query""" if not args: return cmd_help(nick, 'ddg', admin) else: return duckduckgo.search(args)
headers['Accept'] = \ 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' headers['Accept-Encoding'] = 'gzip, defalte' headers['Connection'] = 'keep-alive' headers['User-Agent'] = \ 'Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0' temp = [] t_data = ['imdb', 'rotten'] count = 0 for x in range(0, len(movie)): try: if int(movie[x]['releasedate'][0]) >= YEAR: name = movie[x]['name'][0] print(name) count = count + 1 rr = search(name) time.sleep(.2) soupp = BeautifulSoup(rr, 'html.parser') souppp = soupp.select(".result__url") data = {} data[t_data[0]] = "" data[t_data[1]] = "" for y in t_data: for x in souppp: result = str(x).find(y) if (result != -1): data[y] = x['href'] break data['name'] = name pprint(data) temp.append(json.dumps(data))
def main(): """Controls the flow of the ddg application""" 'Build the parser and parse the arguments' parser = argparse.ArgumentParser( description='www.duckduckgo.com zero-click api for your command-line') parser.add_argument('query', nargs='*', help='the search query') parser.add_argument( '-b', '--bang', action='store_true', help='open the !bang redirect url in a new browser tab') parser.add_argument('-d', '--define', action='store_true', help='return the definition result') parser.add_argument('-j', '--json', action='store_true', help='return the zero-click info api json response') parser.add_argument('-l', '--lucky', action='store_true', help='open the result url in a new browser tab') parser.add_argument('-s', '--search', action='store_true', help='launch a DuckDuckGo search in a new browser tab') parser.add_argument('-u', '--url', action='store_true', help='return the result url') args = parser.parse_args() 'Get the queries' if args.query: queries = [' '.join(args.query)] elif not sys.stdin.isatty(): queries = sys.stdin.read().splitlines() else: parser.print_help() return 'Determine if we need to add any prefixes based on user flags' prefix = '!ddg ' if args.search else '!' if args.bang else '' 'Loop through each query' for query in queries: 'Prefix the query' query = prefix + query 'Get a response from api.duckduck.com using the duckduckgo module' results = duckduckgo.search(query) 'If results is null, continue to the next query' if not results: continue 'Print the raw json output and return' if args.json: print_result(results.json) continue 'a list of where to look for an answer first' results_priority = get_results_priority(args) 'do we want the text or url output of the answer found' var = get_text_or_url(args) 'action to perform when an answer is found' action = get_action(args) 'Search for an answer and perform an action' failed_to_find_answer = True for r in results_priority: result = getattr(getattr(results, r), var) if result: action(result) failed_to_find_answer = False break 'Let the user know if no answer was found' if failed_to_find_answer: if results.type == 'disambiguation': print 'Your query was ambiguous, please be more specific' else: print 'No results found'
def main(): """Controls the flow of the ddg application""" 'Build the parser and parse the arguments' parser = argparse.ArgumentParser( description='www.duckduckgo.com zero-click api for your command-line' ) parser.add_argument('query', nargs='*', help='the search query') parser.add_argument('-b', '--bang', action='store_true', help='prefix query with ! and launch the redirect url') parser.add_argument('-d', '--define', action='store_true', help='prefix query with define') parser.add_argument('-j', '--json', action='store_true', help='returns the raw json output') parser.add_argument('-l', '--lucky', action='store_true', help='launch the first url found') parser.add_argument('-s', '--search', action='store_true', help='launch a search on www.duckduckgo.com') parser.add_argument('-u', '--url', action='store_true', help='return the url of the result found') args = parser.parse_args() 'Get the queries' if args.query: queries = [' '.join(args.query)] elif not sys.stdin.isatty(): queries = sys.stdin.read().splitlines() else: parser.print_help() return 'Determine if we need to add any prefixes based on user flags' prefix = 'define ' if args.define else '' if args.search: prefix = '!ddg ' + prefix elif args.bang: prefix = '!' + prefix 'Loop through each query' for query in queries: 'Prefix the query' query = prefix + query 'Get a response from www.duckduck.com using the duckduckgo module' results = duckduckgo.search(query) 'If the user requested the raw JSON output, print it now and continue to the next query' if args.json: print results.json continue 'Define a response priority to determine what order to look for an answer' redirect_mode = args.bang or args.search or args.lucky results_priority = ['redirect', 'result', 'abstract'] if redirect_mode else ['answer', 'abstract', 'result'] 'Insert the definition priority at the front or second to last depending on the -d flag' results_priority.insert(0 if args.define else len(results_priority) - 1, 'definition') 'Search for an answer and respond accordingly based on user input args' failed_to_find_answer = True for r in results_priority: result = getattr(getattr(results, r), 'url' if (redirect_mode or args.url) else 'text') if result: webbrowser.open_new_tab(result) if (redirect_mode and not args.url) else print_result(result) failed_to_find_answer = False break 'Let the user know if no answer was found' if failed_to_find_answer: if results.type == 'disambiguation': print 'Your query was ambiguous, please be more specific' else: print 'No results found'
def main(): """Controls the flow of the ddg application""" "Build the parser and parse the arguments" parser = argparse.ArgumentParser(description="www.duckduckgo.com zero-click api for your command-line") parser.add_argument("query", nargs="*", help="the search query") parser.add_argument("-b", "--bang", action="store_true", help="open the !bang redirect url in a new browser tab") parser.add_argument("-d", "--define", action="store_true", help="return the definition result") parser.add_argument("-j", "--json", action="store_true", help="return the zero-click info api json response") parser.add_argument("-l", "--lucky", action="store_true", help="open the result url in a new browser tab") parser.add_argument("-s", "--search", action="store_true", help="launch a DuckDuckGo search in a new browser tab") parser.add_argument("-u", "--url", action="store_true", help="return the result url") args = parser.parse_args() "Get the queries" if args.query: queries = [" ".join(args.query)] elif not sys.stdin.isatty(): queries = sys.stdin.read().splitlines() else: parser.print_help() return "Determine if we need to add any prefixes based on user flags" prefix = "!ddg " if args.search else "!" if args.bang else "" "Loop through each query" for query in queries: "Prefix the query" query = prefix + query "Get a response from api.duckduck.com using the duckduckgo module" results = duckduckgo.search(query) "If results is null, continue to the next query" if not results: continue "Print the raw json output and return" if args.json: print_result(results.json) continue "a list of where to look for an answer first" results_priority = get_results_priority(args) "do we want the text or url output of the answer found" var = get_text_or_url(args) "action to perform when an answer is found" action = get_action(args) "Search for an answer and perform an action" failed_to_find_answer = True for r in results_priority: result = getattr(getattr(results, r), var) if result: action(result) failed_to_find_answer = False break "Let the user know if no answer was found" if failed_to_find_answer: if results.type == "disambiguation": print "Your query was ambiguous, please be more specific" else: print "No results found"
import duckduckgo results = duckduckgo.search('test', max_results=2) for res in results: print(res)