I am trying to use SERP API to make a call in Google Scholar. These are the test parameters that I am using:
params = {
'api_key': 'x',
'search_type': 'scholar',
# 'q': '"cloudberry pie"', # This is a search term with very few results (when you test the code you don't want to spend all your credits)
'q': SearchKeywords,
'lr': 'lang_en', # Only English results
'scholar_include_citations': 'false', # don't include citations
'scholar_year_min': '2023',
'scholar_year_max': '2023',
'hl': 'en', # Force Google to use the English UI when it returns results. We tried it without this parameter and this led to using a different language with every search, and interestingly to duplicate publications as well.
'sort_by': 'relevance',
}
Since SERP charges for each page of results and it costs a lot, I was thinking to sort by date and limit the number of results using these parameters:
params = {
'api_key': 'x',
'search_type': 'scholar',
# 'q': '"cloudberry pie"', # This is a search term with very few results (when you test the code you don't want to spend all your credits)
'q': SearchKeywords,
'lr': 'lang_en', # Only English results
'scholar_include_citations': 'false', # don't include citations
'scholar_year_min': '2023',
'scholar_year_max': '2023',
'hl': 'en', # Force Google to use the English UI when it returns results. We tried it without this parameter and this led to using a different language with every search, and interestingly to duplicate publications as well.
'sort_by': 'date',
'num': '10'
}
But I get this error:
{
"request_info":{
"success":false
"message":"Error whilst validating Search: 'num' parameter is not supported when 'search_type=scholar'."
}
}
Do you have any suggestions on how to achieve this sorting by date and getting a predefined number of results?
I tried with these parameters:
params = {
'api_key': 'x',
'search_type': 'scholar',
# 'q': '"cloudberry pie"', # This is a search term with very few results (when you test the code you don't want to spend all your credits)
'q': SearchKeywords,
'lr': 'lang_en', # Only English results
'scholar_include_citations': 'false', # don't include citations
'scholar_year_min': '2023',
'scholar_year_max': '2023',
'hl': 'en', # Force Google to use the English UI when it returns results. We tried it without this parameter and this led to using a different language with every search, and interestingly to duplicate publications as well.
'sort_by': 'date',
'num': '10'
}
But I got this error:
{
"request_info":{
"success":false
"message":"Error whilst validating Search: 'num' parameter is not supported when 'search_type=scholar'."
}
}
I would expect to get just the first 10 results sorted by date.