Created
December 5, 2024 03:39
-
-
Save BohemianHacks/611e2fd211a322f0a8d1323ac5424e8a to your computer and use it in GitHub Desktop.
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 characters
import requests | |
from bs4 import BeautifulSoup | |
# Function to search Google Scholar | |
def google_scholar_search(query): | |
url = "https://scholar.google.com/scholar?q=" + query | |
response = requests.get(url) | |
soup = BeautifulSoup(response.content, "html.parser") | |
# Parse results and extract PDF links | |
# Function to download PDFs | |
def download_pdf(url, filename): | |
response = requests.get(url) | |
with open(filename, "wb") as f: | |
f.write(response.content) | |
# Main function | |
def main(): | |
search_queries = ["scale insects", "scale insect secretions", "bioengineering scale insects"] | |
for query in search_queries: | |
pdf_links = google_scholar_search(query) | |
for link in pdf_links: | |
filename = link.split("/")[-1] | |
download_pdf(link, filename) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment