Bunsly / JobSpy

Jobs scraper library for LinkedIn, Indeed, Glassdoor & ZipRecruiter
https://usejobspy.com
MIT License
555 stars 109 forks source link

Indeed API jobSearch params #115

Closed cullenwatson closed 3 months ago

cullenwatson commented 4 months ago

To fetch the jobs, we're intially going through a public endpoint. But to fetch the description, we then use the Indeed API with jobData query by passing the job ids that we got through the search. Ideally we just use the Indeed API for the entire module by using the jobSearch query. However, there are two things we're missing from this endpoint that I can't figure out

POST https://apis.indeed.com/graphql

Headers indeed-api-key: 161092c2017b5bbab13edb12461a62d5a833871e7cad6d9d475304573de67ac8 accept: application/json indeed-co: US

GraphQL query

query GetJobData {
  jobSearch(
    what: "software",
    location: {
      where: "san francisco",
      radius: 50,
      radiusUnit: MILES
    },
    limit: 100,
    sort: DATE,
# this date range results in 400 but it's the correct fields
#    filters: {
#     date: {
#       field: "dateOnIndeed",
#       start: "1808162474000",
#       end: "1808162474000"
#     }
# and how to filter easyapply?
   )  {
    results { 
      trackingKey
      job {
        key
        title
        datePublished
        dateOnIndeed
        description {
            html
        }
        location {
            countryName
            countryCode
            city
            postalCode
            streetAddress
            formatted {
                short
                long
            }
        }
        compensation {
            baseSalary {
                unitOfWork
                range {
                    ... on Range {
                        min
                        max
                    }
                }
            }
            currencyCode
        }
        employer {
            relativeCompanyPageUrl
            name
        }
        recruit {
            viewJobUrl
            detailedSalary
            workSchedule
        }
      }

    }
  }
}

cURL format

curl --location 'https://apis.indeed.com/graphql' \
--header 'Host: apis.indeed.com' \
--header 'content-type: application/json' \
--header 'indeed-api-key: 161092c2017b5bbab13edb12461a62d5a833871e7cad6d9d475304573de67ac8' \
--header 'accept: application/json' \
--header 'indeed-locale: en-US' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'indeed-co: US' \
--data '{"query":"query GetJobData {\n  jobSearch(\n    what: \"software\",\n    location: {\n      where: \"san francisco\",\n      radius: 50,\n      radiusUnit: MILES\n    },\n    limit: 100,\n    sort: DATE,\n# this date range results in 400 but it'\''s the correct fields\n#    filters: {\n#     date: {\n#       field: \"dateOnIndeed\",\n#       start: \"1808162474000\",\n#       end: \"1808162474000\"\n#     }\n# and how to filter easyapply?\n   )  {\n    results { \n      trackingKey\n      job {\n        key\n        title\n        datePublished\n        dateOnIndeed\n        description {\n            html\n        }\n        location {\n            countryName\n            countryCode\n            city\n            postalCode\n            streetAddress\n            formatted {\n                short\n                long\n            }\n        }\n        compensation {\n            baseSalary {\n                unitOfWork\n                range {\n                    ... on Range {\n                        min\n                        max\n                    }\n                }\n            }\n            currencyCode\n        }\n        employer {\n            relativeCompanyPageUrl\n            name\n        }\n        recruit {\n            viewJobUrl\n            detailedSalary\n            workSchedule\n        }\n      }\n      \n    }\n  }\n}","variables":{}}'