Skip to content

Commit

Permalink
fix(zr): date posted
Browse files Browse the repository at this point in the history
  • Loading branch information
cullenwatson committed Feb 3, 2024
1 parent 8e2ab27 commit 8a0c200
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "python-jobspy"
version = "1.1.40"
version = "1.1.41"
description = "Job scraper for LinkedIn, Indeed, Glassdoor & ZipRecruiter"
authors = ["Zachary Hampton <[email protected]>", "Cullen Watson <[email protected]>"]
homepage = "https://github.com/Bunsly/JobSpy"
Expand Down
2 changes: 2 additions & 0 deletions src/jobspy/scrapers/glassdoor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def get_location(self, location: str, is_remote: bool) -> (int, str):
location_type = "CITY"
elif location_type == "S":
location_type = "STATE"
elif location_type == 'N':
location_type = "COUNTRY"
return int(items[0]["locationId"]), location_type

@staticmethod
Expand Down
15 changes: 2 additions & 13 deletions src/jobspy/scrapers/ziprecruiter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"""
import math
import time
import re
from datetime import datetime, date
from datetime import datetime, timezone
from typing import Optional, Tuple, Any

from bs4 import BeautifulSoup
Expand Down Expand Up @@ -119,17 +118,7 @@ def process_job(self, job: dict) -> JobPost | None:
job_type = ZipRecruiterScraper.get_job_type_enum(
job.get("employment_type", "").replace("_", "").lower()
)

save_job_url = job.get("SaveJobURL", "")
posted_time_match = re.search(
r"posted_time=(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)", save_job_url
)
if posted_time_match:
date_time_str = posted_time_match.group(1)
date_posted_obj = datetime.strptime(date_time_str, "%Y-%m-%dT%H:%M:%SZ")
date_posted = date_posted_obj.date()
else:
date_posted = date.today()
date_posted = datetime.fromisoformat(job['posted_time'].rstrip("Z")).date()

return JobPost(
title=title,
Expand Down

0 comments on commit 8a0c200

Please sign in to comment.