Skip to content

Commit

Permalink
Page error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lgangm committed Apr 28, 2022
1 parent 325e460 commit 8076bed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/packages/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
# extract maximum number of jobs stated, only applicable for the "base" url
def extract_maximums(base_url):
page_soup,_ = requestAndParse(base_url)

print(page_soup)
tmp_match_1 = [item for item in page_soup.find_all("p") if "data-test" in item.attrs][0]
tmp_match_2 = [item for item in page_soup.find_all("div") if "data-test" in item.attrs][-1]
tmp_match_2 = [item for item in page_soup.find_all("div") if "data-test" in item.attrs][-2]

maxJobs_raw = tmp_match_1.get_text() # e.g. 7,764 Jobs
maxPages_raw = tmp_match_2.get_text() # e.g. Page 1 of 30

try:
assert "Jobs" in maxJobs_raw
assert "jobs" in maxJobs_raw
assert "Page" in maxPages_raw
except Exception as e:
print(e)
Expand All @@ -28,6 +29,8 @@ def extract_maximums(base_url):
maxJobs = re.sub(r"\D", "", maxJobs_raw)
maxPages = re.sub(r"\D", "", maxPages_raw)[1:]



return(int(maxJobs), int(maxPages))


Expand Down

0 comments on commit 8076bed

Please sign in to comment.