-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_finder.py
33 lines (28 loc) · 1.03 KB
/
app_finder.py
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
31
32
33
#import Beautiful Soup
from bs4 import BeautifulSoup
import requests
# var cookies = require('./cookies');
#retreive url to search
page_url = input("Enter URL: ")
mainSite = "https://www.glassdoor.com"
#requests page through User Agent Mozilla
page_response = requests.get(page_url, headers={'User-Agent': 'Mozilla/5.0'})
soup = BeautifulSoup(page_response.content, "html.parser")
# All Easy Apply Jobs
i = 1
for job in soup.find_all("li", attrs={"data-is-easy-apply":"true"}):
print("Job Number:", i)
sess = requests.Session()
easyApply_url = mainSite + job.find("a", attrs={"class":"jobLink"})["href"]
easyApply_response = sess.get(easyApply_url, headers={'User-Agent': 'Mozilla/5.0'})
curPage = BeautifulSoup(easyApply_response.content, "html.parser")
print(easyApply_url)
curPage = BeautifulSoup(easyApply_response.content, "html.parser")
#write links to file
f = open("webpage.txt", "a")
f.write("Job Number: "+ str(i) + '\n')
f.write(easyApply_url+'\n')
f.write('\n')
i=i+1
# f = open("webpage.txt", "w")
# f.write(soup.prettify())