PaulMartrenchar commited on
Commit
f87b33f
·
1 Parent(s): ee55456

Better version of WelcomeToTheJungle.py

Browse files
Files changed (1) hide show
  1. WelcomeToTheJungle.py +22 -10
WelcomeToTheJungle.py CHANGED
@@ -196,18 +196,18 @@ def get_jobs(search_term):
196
  "Pragma": "no-cache",
197
  "Cache-Control": "no-cache",
198
  "x-algolia-agent": "Algolia for JavaScript (4.14.3); Browser (lite); JS Helper (3.11.2); react (17.0.2); react-instantsearch (6.38.3)",
199
- "x-algolia-api-key": "02f0d440abc99cae37e126886438b266",
200
  "x-algolia-application-id": "CSEKHVMS53"
201
  }
202
 
203
  data = """{
204
  "requests":[{
205
- "indexName":"wk_cms_jobs_production_published_at_desc",
206
- "params":"analyticsTags=%5B%22page%3Ajobs_index%22%2C%22language%3Aen%22%5D&aroundLatLng=48.85718%2C2.34141&aroundPrecision=20000&aroundRadius=20000&attributesToHighlight=%5B%22name%22%5D&attributesToRetrieve=%5B%22_geoloc%22%2C%22contract_type%22%2C%22experience_level_minimum%22%2C%22name%22%2C%22objectID%22%2C%22office%22%2C%22offices%22%2C%22organization.logo.url%22%2C%22organization.name%22%2C%22organization.reference%22%2C%22organization.slug%22%2C%22organization.website_organization%22%2C%22organization.descriptions%22%2C%22organization.has_default_job%22%2C%22promoted%22%2C%22published_at%22%2C%22reference%22%2C%22remote%22%2C%22slug%22%2C%22website%22%2C%22contract_type_names.en%22%2C%22organization.cover_image.en.small.url%22%2C%22organization.size.en%22%2C%22profession.category.en%22%2C%22profession.name.en%22%2C%22sectors_name.en%22%5D&clickAnalytics=true&facetFilters=%5B%5B%22contract_type_names.en%3AFull-Time%22%5D%2C%5B%22language%3Aen%22%5D%5D&facets=%5B%22offices.country_code%22%2C%22offices.state%22%2C%22offices.district%22%2C%22offices.location%22%2C%22online%22%2C%22organization.name%22%2C%22remote%22%2C%22contract_type_names.en%22%2C%22sectors_name.en.Advertising%20%2F%20Marketing%20%2F%20Agency%22%2C%22sectors_name.en.Architecture%22%2C%22sectors_name.en.Banking%20%2F%20Insurance%20%2F%20Finance%22%2C%22sectors_name.en.Consulting%20%2F%20Audit%22%2C%22sectors_name.en.Corporate%20Services%22%2C%22sectors_name.en.Culture%20%2F%20Media%20%2F%20Entertainment%22%2C%22sectors_name.en.Distribution%22%2C%22sectors_name.en.Education%20%2F%20Training%20%2F%20Recruitment%22%2C%22sectors_name.en.Engineering%22%2C%22sectors_name.en.Fashion%20%2F%20Luxury%20%2F%20Beauty%20%2F%20Lifestyle%22%2C%22sectors_name.en.Food%20and%20Beverage%22%2C%22sectors_name.en.Health%20%2F%20Social%20%2F%20Environment%22%2C%22sectors_name.en.Hotel%20%2F%20Tourism%20%2F%20Leisure%22%2C%22sectors_name.en.Industry%22%2C%22sectors_name.en.Legal%20%2F%20Law%22%2C%22sectors_name.en.Mobility%20%2F%20Transport%22%2C%22sectors_name.en.Nonprofit%20%2F%20Association%22%2C%22sectors_name.en.Public%20Administration%22%2C%22sectors_name.en.Real%20Estate%22%2C%22sectors_name.en.Tech%22%2C%22sectors.parent.en%22%2C%22profession_name.en.Audit%20%2F%20Finance%20%2F%20Insurance%22%2C%22profession_name.en.Business%22%2C%22profession_name.en.Consulting%22%2C%22profession_name.en.Customer%20Service%22%2C%22profession_name.en.Design%22%2C%22profession_name.en.Fashion%22%2C%22profession_name.en.Health%20%2F%20Medical%20%2F%20Social%22%2C%22profession_name.en.Hospitality%20%2F%20Restaurant%20services%22%2C%22profession_name.en.Industry%22%2C%22profession_name.en.Marketing%20%2F%20Communications%22%2C%22profession_name.en.Media%22%2C%22profession_name.en.Real%20Estate%22%2C%22profession_name.en.Retail%22%2C%22profession_name.en.Support%20Roles%22%2C%22profession_name.en.Tech%22%2C%22profession_name.en.Tourism%22%2C%22profession.category.en%22%2C%22experience_level_minimum%22%2C%22organization.size.en%22%2C%22language%22%5D&filters=website.reference%3Awttj_fr&getRankingInfo=true&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&highlightPreTag=%3Cais-highlight-0000000000%3E&hitsPerPage=80&maxValuesPerFacet=999&numericFilters=%5B%22experience_level_minimum%3E%3D0%22%2C%22experience_level_minimum%3C%3D2%22%5D&page=0&query=#####&tagFilters=&userToken=00c5e1a5-e384-4def-bae4-1d466974cc2d"
207
- }]
208
- }""".replace("#####", search_term.lower().replace(" ", "%20"))
209
 
210
- url = "https://csekhvms53-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia^%^20for^%^20JavaScript^%^20(4.14.3)^%^3B^%^20Browser^%^20(lite)^%^3B^%^20JS^%^20Helper^%^20(3.11.2)^%^3B^%^20react^%^20(17.0.2)^%^3B^%^20react-instantsearch^%^20(6.38.3)&x-algolia-api-key=02f0d440abc99cae37e126886438b266&x-algolia-application-id=CSEKHVMS53&search_origin=jobs_search_client"
211
 
212
  response = requests.post(url, headers=headers, data=data, verify=False)
213
 
@@ -222,23 +222,35 @@ def get_jobs(search_term):
222
  job["name"] = hit["name"]
223
  job["slug"] = hit["slug"]
224
  if hit["published_at"] != None:
225
- published_at = datetime.strptime(hit["published_at"], '%Y-%m-%dT%H:%M:%S.%f%z')
 
 
 
 
 
226
  job["published_at"] = published_at.strftime("%d/%m/%Y %H:%M:%S")
227
  else:
228
- job["published_at"] = "None"
229
  job["organization_name"] = hit["organization"]["name"]
230
  if hit["organization"].get("size", None) is not None:
231
  job["organization_size"] = hit["organization"]["size"]["en"]
232
  else:
233
  job["organization_size"] = ""
234
  job["organization_logo_url"] = hit["organization"]["logo"]["url"]
235
- job["organization_slug"] = hit["organization"]["website_organization"]["slug"]
236
  job["objectID"] = hit["objectID"]
237
  job["URL"] = "https://www.welcometothejungle.com/en/companies/{}/jobs/{}?o={}".format(job["organization_slug"], job["slug"], job["objectID"])
238
  jobs.append(job)
239
 
240
  return jobs
241
 
 
 
 
 
 
 
 
242
  def wtoj_get_html():
243
  content_writer = get_jobs('content writer')
244
  digital_marketing = get_jobs('Marketing')
@@ -255,7 +267,7 @@ def wtoj_get_html():
255
  seen_urls.add(obj["URL"])
256
  unique_objects.append(obj)
257
 
258
- jobs = sorted(unique_objects, key=lambda x: x["published_at"], reverse=True)
259
 
260
  #filter on the job description
261
  job_filter = ["marketing", "communication", "community", "business development", "experience", "social media", "brand", "ppc", "seo", "sea", "ads", "user acquisition", "adops", "consultant"]
 
196
  "Pragma": "no-cache",
197
  "Cache-Control": "no-cache",
198
  "x-algolia-agent": "Algolia for JavaScript (4.14.3); Browser (lite); JS Helper (3.11.2); react (17.0.2); react-instantsearch (6.38.3)",
199
+ "x-algolia-api-key": "4bd8f6215d0cc52b26430765769e65a0",
200
  "x-algolia-application-id": "CSEKHVMS53"
201
  }
202
 
203
  data = """{
204
  "requests":[{
205
+ "indexName":"wttj_jobs_production_en",
206
+ "params":"attributesToHighlight=%5B%22name%22%5D&attributesToRetrieve=%5B%22*%22%5D&clickAnalytics=true&hitsPerPage=80&maxValuesPerFacet=999&analytics=true&enableABTest=true&userToken=d9c8afab-18d1-41dc-b3ab-da2f75bf30e6&analyticsTags=%5B%22page%3Ajobs_index%22%2C%22language%3Aen%22%5D&facets=%5B%22benefits%22%2C%22organization.commitments%22%2C%22contract_type%22%2C%22contract_duration_minimum%22%2C%22contract_duration_maximum%22%2C%22has_contract_duration%22%2C%22education_level%22%2C%22has_education_level%22%2C%22experience_level_minimum%22%2C%22has_experience_level_minimum%22%2C%22organization.nb_employees%22%2C%22organization.labels%22%2C%22salary_yearly_minimum%22%2C%22has_salary_yearly_minimum%22%2C%22salary_currency%22%2C%22followedCompanies%22%2C%22language%22%2C%22new_profession.category_reference%22%2C%22new_profession.sub_category_reference%22%2C%22remote%22%2C%22sectors.parent_reference%22%2C%22sectors.reference%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&page=0&query=%22Digital%20Marketing%22&aroundLatLng=48.85717%2C2.3414&aroundRadius=20000&aroundPrecision=20000"},{"indexName":"wttj_jobs_production_en_promoted","params":"attributesToHighlight=%5B%22name%22%5D&attributesToRetrieve=%5B%22*%22%5D&clickAnalytics=true&hitsPerPage=200&maxValuesPerFacet=999&analytics=true&enableABTest=true&userToken=d9c8afab-18d1-41dc-b3ab-da2f75bf30e6&analyticsTags=%5B%22page%3Ajobs_index%22%2C%22language%3Aen%22%5D&facets=%5B%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)%20AND%20is_boosted%3Atrue%20AND%20NOT%20reference%3A7e884b19-1ce2-4386-bc6a-643890daf461%20AND%20NOT%20reference%3A1b0237ca-1971-4651-a062-6db5f4c9a6e1%20AND%20NOT%20reference%3Ac27ab821-6822-4156-b4ff-19a9a2940d9d&page=0&query=%22Digital%20Marketing%22&aroundLatLng=48.85717%2C2.3414&aroundRadius=20000&aroundPrecision=20000"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22benefits%22%2C%22organization.commitments%22%2C%22contract_type%22%2C%22contract_duration_minimum%22%2C%22contract_duration_maximum%22%2C%22has_contract_duration%22%2C%22education_level%22%2C%22has_education_level%22%2C%22experience_level_minimum%22%2C%22has_experience_level_minimum%22%2C%22organization.nb_employees%22%2C%22organization.labels%22%2C%22salary_yearly_minimum%22%2C%22has_salary_yearly_minimum%22%2C%22salary_currency%22%2C%22followedCompanies%22%2C%22language%22%2C%22new_profession.category_reference%22%2C%22new_profession.sub_category_reference%22%2C%22remote%22%2C%22sectors.parent_reference%22%2C%22sectors.reference%22%5D&filters=&hitsPerPage=0"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22benefits%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.commitments%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_type%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_minimum%22%5D&filters=contract_duration_minimum%3A1%20TO%203%20OR%20contract_duration_maximum%3A1%20TO%203%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_minimum%22%5D&filters=contract_duration_minimum%3A4%20TO%206%20OR%20contract_duration_maximum%3A4%20TO%206%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_minimum%22%5D&filters=contract_duration_minimum%3A7%20TO%2012%20OR%20contract_duration_maximum%3A7%20TO%2012%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_minimum%22%5D&filters=contract_duration_minimum%3A13%20TO%2024%20OR%20contract_duration_maximum%3A13%20TO%2024%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_minimum%22%5D&filters=contract_duration_minimum%3A25%20TO%2036%20OR%20contract_duration_maximum%3A25%20TO%2036%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22contract_duration_maximum%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22has_contract_duration%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22education_level%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22has_education_level%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22experience_level_minimum%22%5D&filters=experience_level_minimum%3A0%20TO%201%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22experience_level_minimum%22%5D&filters=experience_level_minimum%3A1%20TO%203%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22experience_level_minimum%22%5D&filters=experience_level_minimum%3A3%20TO%205%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22experience_level_minimum%22%5D&filters=experience_level_minimum%3A5%20TO%2010%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22experience_level_minimum%22%5D&filters=experience_level_minimum%20%3E%3D%2010%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22has_experience_level_minimum%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.nb_employees%22%5D&filters=organization.nb_employees%3A0%20TO%2015%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.nb_employees%22%5D&filters=organization.nb_employees%3A15%20TO%2050%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.nb_employees%22%5D&filters=organization.nb_employees%3A50%20TO%20250%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.nb_employees%22%5D&filters=organization.nb_employees%3A250%20TO%202000%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.nb_employees%22%5D&filters=organization.nb_employees%20%3E%3D%202000%20AND%20(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22organization.labels%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22salary_yearly_minimum%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22has_salary_yearly_minimum%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22salary_currency%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22followedCompanies%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22language%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22new_profession.category_reference%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22new_profession.sub_category_reference%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22remote%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22sectors.parent_reference%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=%22Digital%20Marketing%22"},{"indexName":"wttj_jobs_production_en","params":"analytics=false&facets=%5B%22sectors.reference%22%5D&filters=(%22offices.country_code%22%3A%22FR%22)%20AND%20(%22contract_type%22%3A%22full_time%22%20OR%20%22contract_type%22%3A%22temporary%22)%20AND%20(experience_level_minimum%3A0%20TO%201%20OR%20experience_level_minimum%3A1%20TO%203%20OR%20has_experience_level_minimum%3D0)&hitsPerPage=0&query=#####"}
207
+ ]}
208
+ """.replace("#####", search_term.lower().replace(" ", "%20").replace('"', "%22"))
209
 
210
+ url = "https://csekhvms53-2.algolianet.com/1/indexes/*/queries?x-algolia-agent=Algolia^%^20for^%^20JavaScript^%^20(4.20.0)^%^3B^%^20Browser^%^20(lite)^%^3B^%^20JS^%^20Helper^%^20(3.11.2)^%^3B^%^20react^%^20(17.0.2)^%^3B^%^20react-instantsearch^%^20(6.38.3)&x-algolia-api-key=4bd8f6215d0cc52b26430765769e65a0&x-algolia-application-id=CSEKHVMS53&search_origin=jobs_search_client"
211
 
212
  response = requests.post(url, headers=headers, data=data, verify=False)
213
 
 
222
  job["name"] = hit["name"]
223
  job["slug"] = hit["slug"]
224
  if hit["published_at"] != None:
225
+ try:
226
+ # Try parsing with fractional seconds
227
+ published_at = datetime.strptime(hit["published_at"], '%Y-%m-%dT%H:%M:%S.%f%z')
228
+ except ValueError:
229
+ # If it fails, try parsing without fractional seconds
230
+ published_at = datetime.strptime(hit["published_at"], '%Y-%m-%dT%H:%M:%S%z')
231
  job["published_at"] = published_at.strftime("%d/%m/%Y %H:%M:%S")
232
  else:
233
+ job["published_at"] = "Unknown"
234
  job["organization_name"] = hit["organization"]["name"]
235
  if hit["organization"].get("size", None) is not None:
236
  job["organization_size"] = hit["organization"]["size"]["en"]
237
  else:
238
  job["organization_size"] = ""
239
  job["organization_logo_url"] = hit["organization"]["logo"]["url"]
240
+ job["organization_slug"] = hit["organization"]["slug"]
241
  job["objectID"] = hit["objectID"]
242
  job["URL"] = "https://www.welcometothejungle.com/en/companies/{}/jobs/{}?o={}".format(job["organization_slug"], job["slug"], job["objectID"])
243
  jobs.append(job)
244
 
245
  return jobs
246
 
247
+
248
+ def parse_datetime(dt_str):
249
+ if dt_str == "Unknown":
250
+ return datetime.min # Return the minimum possible datetime
251
+ else:
252
+ return datetime.strptime(dt_str, "%d/%m/%Y %H:%M:%S")
253
+
254
  def wtoj_get_html():
255
  content_writer = get_jobs('content writer')
256
  digital_marketing = get_jobs('Marketing')
 
267
  seen_urls.add(obj["URL"])
268
  unique_objects.append(obj)
269
 
270
+ jobs = sorted(unique_objects, key=lambda x: parse_datetime(x["published_at"]), reverse=True)
271
 
272
  #filter on the job description
273
  job_filter = ["marketing", "communication", "community", "business development", "experience", "social media", "brand", "ppc", "seo", "sea", "ads", "user acquisition", "adops", "consultant"]