how to retrieve multiple jobs using google-jobs-api #28640
Unanswered
SaiSanthosh1508
asked this question in
Q&A
Replies: 1 comment
-
@SaiSanthosh1508 the Try creating a CustomGoogleJobsAPIWrapper and add a custom class CustomGoogleJobsAPIWrapper(GoogleJobsAPIWrapper):
def __init__(self, number_jobs: int, *args, **kwargs):
super().__init__(*args, **kwargs)
self.number_jobs = number_jobs
def run(self, query: str) -> str:
"""Run query through Google Trends with Serpapi"""
# set up query
serpapi_api_key = cast(SecretStr, self.serp_api_key)
params = {
"engine": "google_jobs",
"api_key": serpapi_api_key.get_secret_value(),
"q": query,
}
total_results = []
client = self.serp_search_engine(params)
total_results = client.get_dict()["jobs_results"]
# extract n job info:
res_str = ""
for i in range(self.number_jobs):
job = total_results[i]
res_str += (
"\n_______________________________________________"
+ f"\nJob Title: {job['title']}\n"
+ f"Company Name: {job['company_name']}\n"
+ f"Location: {job['location']}\n"
+ f"Description: {job['description']}"
+ "\n_______________________________________________\n"
)
return res_str + "\n"
or just go |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
I'm trying to get multiple jobs,but no matter what I try I'm only getting one job search, also there is no parameter to set the number of values to be retrieved
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
Beta Was this translation helpful? Give feedback.
All reactions