-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebscrap.py
More file actions
30 lines (21 loc) · 773 Bytes
/
webscrap.py
File metadata and controls
30 lines (21 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from bs4 import BeautifulSoup
from requests import get
import requests
def extract_jobs(term):
url = f"https://remoteok.com/remote-{term}-jobs"
request = requests.get(url, headers={"User-Agent": "Kimchi"})
results = []
if request.status_code == 200:
print("good")
soup = BeautifulSoup(request.text, "html.parser")
jobs=soup.find_all('tr',class_="job")
for job in jobs:
company = job.find('h3',itemprop="name")
position=job.find('h2',itemprop="title")
location=job.find('div',class_="location")
print(company,position,location)
# write your ✨magical✨ code here
else:
print("Can't get jobs. try again!")
return results
extract_jobs("python")