-
-
Save macdet/59d914fc9a1f218fe4927a118712c3e6 to your computer and use it in GitHub Desktop.
Revisions
-
beingskyler created this gist
Aug 2, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ # Author: Skyler Reeves | Ardent Growth | July 2020 location = "Louisville, KY" #@param {type:"string"} engine = "google" #@param ["google", "google scholar", "bing", "baidu", "yandex", "yahoo", "ebay"] url = #Insert URL String Here from Github from serpapi.google_search_results import GoogleSearchResults import pandas as pd import csv #Add your SERP API KEY between the '' below api_key = 'API_KEY_GOES_HERE' df1 = pd.read_csv(url) # Dataset is now stored in a Pandas Dataframe # The While Loop putting items into a queue query_queue = [] i = 0 while i < data_frame_size: query = df1.iloc[i][0] query_queue.append(query) i+=1 for search_query in query_queue: query_params = { "location": location, "engine": engine, "api_key": api_key, "q": search_query } search_client = GoogleSearchResults(query_params) search_results = search_client.get_dict() for link in search_results['organic_results']: print(link['link'])