Advertisement
g96

Untitled

g96
Apr 2nd, 2022
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1.  
  2. import requests
  3. from bs4 import BeautifulSoup
  4.  
  5. def extract(page):
  6.     headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36'}
  7.     url = f'https://be.indeed.com/jobs?q=data+scientist&l=belgium&start={page}'
  8.     r = requests.get(url,headers, verify= False)
  9.     soup = BeautifulSoup(r.content, 'html.parser')
  10.     return soup
  11.  
  12.  
  13.  
  14. def transform(soup):
  15.     divs = soup.find_all('div', class_ ='job_seen_beacon')
  16.     for item in divs:
  17.         title = item.find("span").text
  18.         company = item.find('span', class_ ='companyName').text
  19.         print(title)
  20.         print(company)
  21.     return
  22.  
  23. c= extract(0)
  24.  
  25. print(transform(c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement