Intro
This is a walkthrough on webscraping Google Scholar using SerpApi. This guide will show how to obtain a free API key allowing you to gather author publications and other information from Google Scholar. We’ll also go over how to securely store the API key in a .env
file and how to access the key from the .env
file.
Prerequisites
Navigate to the SerpApi website and register for a free account. You can sign in using your email or GitHub. After you register and confirm your email address, you will receive a secret key located towards the bottom of the screen.
Create a .env
file in your project repo. You’ll want to immediately add that to your .gitignore
file before you even commit the .env
file to your repo. You do not want to make the mistake of scripting your secret key into your files or forget to do it later. In the .env
file, add the following line:
# my google scholar api key
GOOGLE_KEY="<your_secret_key_provided_when_you_registered>"
End your .env
file with a newline. This will save you a minor warning later on.
Now you should save the file and commit it to your project repo.
** Stay tuned… coming back with more! **