Spaces:
Sleeping
Sleeping
Delete tools/fetch_paper.py
Browse files- tools/fetch_paper.py +0 -29
tools/fetch_paper.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
from scholarly import scholarly
|
| 2 |
-
|
| 3 |
-
def fetch_latest_research_papers(keywords: list, num_results: int = 5) -> list:
|
| 4 |
-
"""Fetches the latest research papers from Google Scholar based on provided keywords.
|
| 5 |
-
|
| 6 |
-
Args:
|
| 7 |
-
keywords: A list of keywords to search for relevant papers.
|
| 8 |
-
num_results: The number of papers to fetch (default is 5).
|
| 9 |
-
|
| 10 |
-
Returns:
|
| 11 |
-
A list of dictionaries containing paper details.
|
| 12 |
-
"""
|
| 13 |
-
try:
|
| 14 |
-
query = " ".join(keywords)
|
| 15 |
-
search_results = scholarly.search_pubs(query)
|
| 16 |
-
papers = []
|
| 17 |
-
for i in range(num_results):
|
| 18 |
-
paper = next(search_results, None)
|
| 19 |
-
if paper:
|
| 20 |
-
papers.append({
|
| 21 |
-
"title": paper['bib'].get('title', 'No Title'),
|
| 22 |
-
"authors": paper['bib'].get('author', 'Unknown Authors'),
|
| 23 |
-
"year": paper['bib'].get('pub_year', 'Unknown Year'),
|
| 24 |
-
"abstract": paper['bib'].get('abstract', 'No Abstract Available'),
|
| 25 |
-
"link": paper.get('pub_url', 'No Link Available')
|
| 26 |
-
})
|
| 27 |
-
return papers
|
| 28 |
-
except Exception as e:
|
| 29 |
-
return [f"Error fetching research papers: {str(e)}"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|