paperscraper.scholar
paperscraper.scholar
¶
search_api_requests_get(*, api_key: Optional[str] = None, url: str = SEARCH_API_URL, **kwargs) -> requests.Response
¶
Perform an authenticated SearchApi request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
Optional[str]
|
Explicit API key. |
None
|
url
|
str
|
SearchApi URL. |
SEARCH_API_URL
|
Returns:
| Type | Description |
|---|---|
Response
|
requests.Response: API response. |
Source code in paperscraper/citations/utils.py
dump_papers(papers: pd.DataFrame, filepath: str) -> None
¶
Receives a pd.DataFrame, one paper per row and dumps it into a .jsonl file with one paper per line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
papers
|
DataFrame
|
A dataframe of paper metadata, one paper per row. |
required |
filepath
|
str
|
Path to dump the papers, has to end with |
required |
Source code in paperscraper/utils.py
retry_with_exponential_backoff(*, max_attempts: int = 3, retry_if: Callable[[T], bool] = lambda result: False, exceptions: Tuple[Type[BaseException], ...] = (), base_delay: float = 1) -> Callable[[Callable[..., T]], Callable[..., T]]
¶
Retry a function after failures, waiting base_delay * 2**attempt.
Source code in paperscraper/utils.py
get_scholar_papers(title: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], backend: Literal['auto', 'scholarly', 'searchapi'] = 'auto', *, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> pd.DataFrame
¶
Performs Google Scholar API request of a given title and returns list of papers with fields as desired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Google Scholar search query. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
backend
|
Literal['auto', 'scholarly', 'searchapi']
|
Scholar backend. |
'auto'
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
SearchApi-specific keyword arguments. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
get_scholar_papers_searchapi(title: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> pd.DataFrame
¶
Retrieve Google Scholar paper metadata through SearchApi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Google Scholar search query. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
Supports |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
get_scholar_author_papers(author: str, max_results: int = 30, *, author_id: Optional[str] = None, api_key: Optional[str] = None, full_info: bool = False) -> pd.DataFrame
¶
Return papers by a researcher from Google Scholar through SearchApi.
An exact Google Scholar profile is preferred. If none exists, results from
an author:"name" Scholar query are returned and may mix namesakes.
The default limit is 30 papers; explicit integer limits are respected.
full_info=True requires a profile and consumes one extra SearchApi
request per paper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
author
|
str
|
Researcher name. |
required |
max_results
|
int
|
Maximum papers to return. Defaults to 30. |
30
|
author_id
|
Optional[str]
|
Optional Google Scholar author ID for exact identification. |
None
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
full_info
|
bool
|
Add journal, date, volume, issue, pages, publisher, and description from each paper's citation detail. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
get_searchapi_scholar_citation(paper: dict, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> dict
¶
Retrieve citation details for a SearchApi Scholar result when available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paper
|
dict
|
SearchApi |
required |
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
Supports |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
SearchApi |
dict
|
|
dict
|
|
dict
|
|
dict
|
|
Source code in paperscraper/scholar/scholar.py
get_and_dump_scholar_papers(title: str, output_filepath: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], backend: Literal['auto', 'scholarly', 'searchapi'] = 'auto', *, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> None
¶
Combines get_scholar_papers and dump_papers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Paper to search for on Google Scholar. |
required |
output_filepath
|
str
|
Path where the dump will be saved. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
backend
|
Literal['auto', 'scholarly', 'searchapi']
|
Scholar backend. |
'auto'
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
SearchApi-specific keyword arguments. |
None
|
Source code in paperscraper/scholar/scholar.py
scholar
¶
get_scholar_papers(title: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], backend: Literal['auto', 'scholarly', 'searchapi'] = 'auto', *, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> pd.DataFrame
¶
Performs Google Scholar API request of a given title and returns list of papers with fields as desired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Google Scholar search query. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
backend
|
Literal['auto', 'scholarly', 'searchapi']
|
Scholar backend. |
'auto'
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
SearchApi-specific keyword arguments. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
get_scholar_papers_searchapi(title: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> pd.DataFrame
¶
Retrieve Google Scholar paper metadata through SearchApi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Google Scholar search query. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
Supports |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
get_scholar_author_papers(author: str, max_results: int = 30, *, author_id: Optional[str] = None, api_key: Optional[str] = None, full_info: bool = False) -> pd.DataFrame
¶
Return papers by a researcher from Google Scholar through SearchApi.
An exact Google Scholar profile is preferred. If none exists, results from
an author:"name" Scholar query are returned and may mix namesakes.
The default limit is 30 papers; explicit integer limits are respected.
full_info=True requires a profile and consumes one extra SearchApi
request per paper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
author
|
str
|
Researcher name. |
required |
max_results
|
int
|
Maximum papers to return. Defaults to 30. |
30
|
author_id
|
Optional[str]
|
Optional Google Scholar author ID for exact identification. |
None
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
full_info
|
bool
|
Add journal, date, volume, issue, pages, publisher, and description from each paper's citation detail. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame. One paper per row. |
Source code in paperscraper/scholar/scholar.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
get_searchapi_scholar_citation(paper: dict, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> dict
¶
Retrieve citation details for a SearchApi Scholar result when available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paper
|
dict
|
SearchApi |
required |
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
Supports |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
SearchApi |
dict
|
|
dict
|
|
dict
|
|
dict
|
|
Source code in paperscraper/scholar/scholar.py
get_and_dump_scholar_papers(title: str, output_filepath: str, fields: List = ['title', 'authors', 'year', 'abstract', 'journal', 'citations'], backend: Literal['auto', 'scholarly', 'searchapi'] = 'auto', *, api_key: Optional[str] = None, search_api_kwargs: Optional[dict] = None) -> None
¶
Combines get_scholar_papers and dump_papers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Paper to search for on Google Scholar. |
required |
output_filepath
|
str
|
Path where the dump will be saved. |
required |
fields
|
List
|
List of strings with fields to keep in output. |
['title', 'authors', 'year', 'abstract', 'journal', 'citations']
|
backend
|
Literal['auto', 'scholarly', 'searchapi']
|
Scholar backend. |
'auto'
|
api_key
|
Optional[str]
|
Explicit SearchApi key. |
None
|
search_api_kwargs
|
Optional[dict]
|
SearchApi-specific keyword arguments. |
None
|