Yassmen commited on
Commit
e19be2a
·
verified ·
1 Parent(s): 2f6212f

Update wuzzuf_scraper.py

Browse files
Files changed (1) hide show
  1. wuzzuf_scraper.py +19 -4
wuzzuf_scraper.py CHANGED
@@ -88,10 +88,25 @@ def Wuzzuf_scrapping(job_type , job_num):
88
  post_time.append(time.text)
89
 
90
  # to get the logo of the company
91
-
92
- data1 = requests.get(links[x])
93
- soup1 = BeautifulSoup(data1.content)
94
- company_logo.append(soup1.find_all('meta',{'property':"og:image"})[0]['content'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  #time.sleep(4)
96
 
97
 
 
88
  post_time.append(time.text)
89
 
90
  # to get the logo of the company
91
+ # Fetch the company logo
92
+ try:
93
+ data1 = requests.get(links[x])
94
+ data1.raise_for_status() # Check for HTTP errors
95
+ soup1 = BeautifulSoup(data1.content, 'html.parser')
96
+
97
+ logo_meta = soup1.find_all('meta', {'property': "og:image"})
98
+ if logo_meta:
99
+ company_logo.append(logo_meta[0]['content'])
100
+ else:
101
+ print("No logo meta tag found.")
102
+ company_logo.append("No logo found")
103
+
104
+ except requests.exceptions.RequestException as e:
105
+ print(f"Failed to fetch company logo: {e}")
106
+ company_logo.append("Error fetching logo")
107
+ # data1 = requests.get(links[x])
108
+ # soup1 = BeautifulSoup(data1.content)
109
+ #company_logo.append(soup1.find_all('meta',{'property':"og:image"})[0]['content'])
110
  #time.sleep(4)
111
 
112