In this code, you have added an additional input for the user to specify the number of search results they want to retrieve. You use this input to update the num parameter in the Google search URL.
Then, you open a CSV file with a filename that includes the search keyword and number of results, and write the headers "Title" and "Link" to the file.
You loop through the search results and extract the title and link for each result. You use an if statement to check if the link starts with "https://www.instagram.com/" before writing the title and link to the CSV file and printing them to the console.
Overall, this code allows the user to customize the number of search results they want to retrieve and saves the results to a CSV file with a descriptive filename.
Generated using ChatGPT