/
realWebsite.py
38 lines (29 loc) · 1.36 KB
/
realWebsite.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
34
35
36
37
38
from bs4 import BeautifulSoup
import requests
import time
URL = 'https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=python&txtLocation='
print('Put some skill that you are familiar with')
unfamiliar_skill = input('>')
print(f'Filtering out {unfamiliar_skill}')
def find_jobs():
html_text = requests.get(URL).text
soup = BeautifulSoup(html_text, 'lxml');
jobs = soup.find_all('li', class_ = 'clearfix job-bx wht-shd-bx');
for index, job in enumerate(jobs):
published_date = job.find('span', class_='sim-posted').span.text
if 'few' in published_date:
company_name = job.find('h3', class_ = 'joblist-comp-name').text.replace(' ', '')
skills = job.find('span', class_ = 'srp-skills').text.replace(' ', '')
more_info = job.header.h2.a['href']
if unfamiliar_skill not in skills:
with open(f'posts/{index}.txt', 'w') as f:
f.write(f'Company Name: {company_name.strip()} \n')
f.write(f'Required Skills: {skills.strip()} \n')
f.write(f'More Info: {more_info}')
print(f'File saved: {index}')
if __name__ == '__main__':
while True:
find_jobs()
time_wait = 10
print(f'Waiting {time_wait} minutes...')
time.sleep(time_wait * 60)