-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from lalalaurentiu/main
Fixed Fortech scraper
- Loading branch information
Showing
1 changed file
with
27 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
import requests | ||
import json | ||
from bs4 import BeautifulSoup | ||
from utils import * | ||
|
||
urls = [ | ||
'https://www.fortech.ro/job-openings/', | ||
'https://www.fortech.ro/job-openings/page/2/', | ||
] | ||
from scraper.Scraper import Scraper | ||
from utils import (publish, publish_logo, show_jobs) | ||
|
||
page = 1 | ||
url = f'https://www.fortech.ro/job-openings/page/{page}/' | ||
company = 'FORTECH' | ||
|
||
final_jobs = [] | ||
|
||
for url in urls: | ||
r = requests.get(url) | ||
soup = BeautifulSoup(r.text, 'html.parser') | ||
|
||
job_elements = soup.find('div', class_='cards fortech-cards') | ||
scraper = Scraper() | ||
scraper.get_from_url(url) | ||
|
||
job_elements = scraper.find('div', class_='cards').find_all( | ||
'div', class_='card-wrapper') | ||
|
||
while job_elements: | ||
for job in job_elements: | ||
job_link = job.find('a') | ||
if job_link and 'title' in job_link.attrs: | ||
if job_link: | ||
job_title = job_link['title'] | ||
job_url = job_link['href'] | ||
|
||
job_url = job_link['href'] | ||
final_jobs.append( | ||
{ | ||
'job_title' : job_title, | ||
'job_link' : job_url, | ||
'remote' : 'remote', | ||
'city' : 'Cluj-Napoca', | ||
'county': 'Cluj', | ||
'country' : 'Romania', | ||
'company' : company | ||
'job_title': job_title, | ||
'job_link': job_url, | ||
'remote': ['Hybrid', 'Remote', 'On-site'], | ||
'country': 'Romania', | ||
'company': company | ||
} | ||
) | ||
|
||
for version in [1,4]: | ||
page += 1 | ||
url = f'https://www.fortech.ro/job-openings/page/{page}/' | ||
scraper.get_from_url(url) | ||
job_elements = scraper.find('div', class_='cards fortech-cards') | ||
|
||
for version in [1, 4]: | ||
publish(version, company, final_jobs, 'Grasum_Key') | ||
|
||
publish_logo(company, 'https://www.fortech.ro/wp-content/themes/fresh-fortech/dist/images/logo-blue.png?v=1') | ||
publish_logo( | ||
company, 'https://www.fortech.ro/wp-content/themes/fresh-fortech/dist/images/logo-blue.png?v=1') | ||
|
||
print(json.dumps(final_jobs, indent=4)) | ||
show_jobs(final_jobs) |