Yassmen commited on
Commit
0aab451
1 Parent(s): be022a1

Update wuzzuf_scraper.py

Browse files
Files changed (1) hide show
  1. wuzzuf_scraper.py +17 -3
wuzzuf_scraper.py CHANGED
@@ -29,9 +29,23 @@ def Wuzzuf_scrapping(job_type , job_num):
29
 
30
  for i in range(int(pages_num) ):
31
  link_new = link1 +'&start='+str(i)
32
- data = requests.get(link_new)
33
- soup = BeautifulSoup(data.content)
34
- Title = soup.find_all('h2' , {'class': 'css-m604qf'})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  # to get the info about jobs
37
 
 
29
 
30
  for i in range(int(pages_num) ):
31
  link_new = link1 +'&start='+str(i)
32
+ try:
33
+ data = requests.get(link_new)
34
+ data.raise_for_status() # Check for HTTP errors
35
+ soup = BeautifulSoup(data.content, 'html.parser')
36
+ Title = soup.find_all('h2', {'class': 'css-m604qf'})
37
+
38
+ for x in range(len(Title)):
39
+ title.append(Title[x].find('a').text.strip())
40
+ loc = soup.find_all('span', {'class': 'css-5wys0k'})[x].text.split(',')
41
+ location.append(loc[0].strip())
42
+ country.append(loc[-1].strip())
43
+ links.append('https://wuzzuf.net' + Title[x].find('a').attrs['href'])
44
+
45
+ except requests.exceptions.RequestException as e:
46
+ # print(f"Request failed: {e}")
47
+ continue # Skip to the next page if there's an error
48
+
49
 
50
  # to get the info about jobs
51