From a45ec160eb1788c2e7189c35e7ef7ee4983558d8 Mon Sep 17 00:00:00 2001 From: Rarescode Date: Thu, 14 Dec 2023 18:46:10 +0200 Subject: [PATCH] Fixed atpgroup company name --- sites/atpgroup.py | 72 +++++++++++++++++++++++++++++++++++++++++++ tests/module_names.py | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 sites/atpgroup.py diff --git a/sites/atpgroup.py b/sites/atpgroup.py new file mode 100644 index 00000000..73e446a1 --- /dev/null +++ b/sites/atpgroup.py @@ -0,0 +1,72 @@ +# +# +# +# atpgroup > https://atp-group.ro/cariere/ + + +from sites.website_scraper_bs4 import BS4Scraper + +class atpgroupScraper(BS4Scraper): + + """ + A class for scraping job data from atpgroup website. + """ + url = 'https://atp-group.ro/cariere/' + url_logo = 'https://atp-group.ro/wp-content/uploads/2022/09/logo.svg' + company_name = 'atpgroup' + + def __init__(self): + """ + Initialize the BS4Scraper class. + """ + super().__init__(self.company_name, self.url_logo) + + def get_response(self): + self.get_content(self.url) + + def scrape_jobs(self): + """ + Scrape job data from atpgroup website. + """ + + job_elements = self.get_jobs_elements('css_', "div.elementor-element.elementor-element-63afff4.elementor-widget.elementor-widget-theme-post-title.elementor-page-title.elementor-widget-heading > div > h3 > a") + # job_location_elements = self.get_jobs_elements('class_', 'elementor-post-info__terms-list-item') + job_location_elements = self.get_jobs_elements('class_', 'elementor-icon-list-items elementor-post-info') + + self.job_cities = [] + + for city in self.get_jobs_details_text(job_location_elements): + if city.split("Companie:")[0].replace("Locație: ", "") == '': + self.job_cities.append("Romania") + else: + self.job_cities.append(city.split("Companie:")[0].replace("Locație: ", "")) + + self.job_titles = self.get_jobs_details_text(job_elements) + # self.job_cities = self.get_jobs_details_text(job_location_elements) + self.job_urls = self.get_jobs_details_href(job_elements) + + self.format_data() + + def sent_to_future(self): + self.send_to_viitor() + + def return_data(self): + self.get_response() + self.scrape_jobs() + return self.formatted_data, self.company_name + + def format_data(self): + """ + Iterate over all job details and send to the create jobs dictionary. + """ + for job_title, job_url, job_city in zip(self.job_titles, self.job_urls, self.job_cities): + self.create_jobs_dict(job_title, job_url, "România", job_city) + +if __name__ == "__main__": + atpgroup = atpgroupScraper() + atpgroup.get_response() + atpgroup.scrape_jobs() + atpgroup.sent_to_future() + + + diff --git a/tests/module_names.py b/tests/module_names.py index 185b3512..fd06725c 100644 --- a/tests/module_names.py +++ b/tests/module_names.py @@ -77,7 +77,7 @@ 'autosiena': 'autosienaScraper', 'autonet': 'autonetScraper', 'autoclass': 'autoclassScraper', - 'atp-group': 'atpgroupScraper', + 'atpgroup': 'atpgroupScraper', 'artvertising': 'artvertisingScraper', # 'apavital': 'apavitalScraper', 'anahr': 'anahrScraper',