From 5b78e292428a3df75e690a435f64bd68fb409425 Mon Sep 17 00:00:00 2001 From: ccppi Date: Mon, 12 Aug 2024 12:56:05 +0200 Subject: [PATCH] jobs.ch changed, so changed scrap implementation --- lib/conf | 9 ++++++++- lib/gui.py | 14 ++++++++------ lib/scrap_jobs.py | 13 +++++++------ lib/sysparse.py | 8 ++++++-- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/lib/conf b/lib/conf index ebdceb9..6274ed5 100644 --- a/lib/conf +++ b/lib/conf @@ -1,8 +1,15 @@ +[python_qt_indeed] +USER = NONE +PW = NONE +LOGINURL = NONE +SCRAPURL = https://ch.indeed.com/jobs?q=python+qt& +TAG = Informatiker, Python, qt + [quereinsteiger_indeed] USER = NONE PW = NONE LOGINURL = NONE -SCRAPURL = https://ch.indeed.com/jobs?q=quereinsteiger+it&l=&from=searchOnDesktopSerp&vjk=7c069ecf7f0cabb6 +SCRAPURL = https://ch.indeed.com/jobs?q=quereinsteiger+it TAG = Informatiker, Quereinsteiger [jobs.ch_seilbahn] diff --git a/lib/gui.py b/lib/gui.py index 9c7af65..36af9f6 100644 --- a/lib/gui.py +++ b/lib/gui.py @@ -99,6 +99,11 @@ class MainWindow(QMainWindow): self.view = QTableView() self.view.setModel(self.model) + + self.proxymodel2 = QSortFilterProxyModel(self) + self.proxymodel2.setSourceModel(self.model) + self.view.setModel(self.proxymodel2) + self.setProxyViewSettings() self.delegate = ColorDelegate(self) self.view.setItemDelegate(self.delegate) @@ -133,8 +138,8 @@ class MainWindow(QMainWindow): self.view.setColumnWidth(5,10) self.view.hideColumn(7) self.view.setSortingEnabled(True) - self.sel_model = self.view.selectionModel() - self.sel_model.selectionChanged.connect(self.cell_clicked) + #self.sel_model = self.view.selectionModel() + #self.sel_model.selectionChanged.connect(self.cell_clicked) def runWorker(self): self.thread = QThread() @@ -255,10 +260,7 @@ class MainWindow(QMainWindow): print("fetch iterations++") self.model.fetchMore() - self.proxymodel2 = QSortFilterProxyModel(self) - self.proxymodel2.setSourceModel(self.model) - self.view.setModel(self.proxymodel2) - self.setProxyViewSettings() + self.view.show() class PWPrompt(QDialog): def __init__(self): diff --git a/lib/scrap_jobs.py b/lib/scrap_jobs.py index 1d812cc..7b44d78 100644 --- a/lib/scrap_jobs.py +++ b/lib/scrap_jobs.py @@ -57,17 +57,18 @@ def scrap_jobs(url,entry,session): results = soup.find_all("div",attrs={'data-feat':'searched_jobs'}) - location_class = "P-sc-hyu5hk-0 Text__p2-sc-1lu7urs-10 Span-sc-1ybanni-0 Text__span-sc-1lu7urs-12 Text-sc-1lu7urs-13 jZCxUn" - location = item("p",location_class,0,"location") - ar_location = finder(results,location,LOCATION_CLEANUP=1) - company_class = "P-sc-hyu5hk-0 Text__p2-sc-1lu7urs-10 Span-sc-1ybanni-0 Text__span-sc-1lu7urs-12 Text-sc-1lu7urs-13 jZCxUn" + location_class = "d_grid items_start gap_s12 grid-cols_[auto_1fr] px_s8" + location = item("div",location_class,0,"location") + ar_location = finder(results,location,GETCHILDREN='p',LOCATION_CLEANUP=1) + + company_class = "mb_s12 lastOfType:mb_s0 textStyle_p2" company = item("p",company_class,0,"company") ar_company = finder(results,company,DEFAULT=1,GETCHILDREN='strong') - title = item("span","jlFpCz",0,"TITLE") + title = item("span","text_link.brand.base",0,"TITLE") ar_title = finder(results,title,DEFAULT=1) - date = item("span","Span-sc-1ybanni-0 Text__span-sc-1lu7urs-12 Text-sc-1lu7urs-13 krGudM hUhFmL",0,"date") + date = item("span","pos_absolute",0,"date") ar_date = finder(results,date,CLEANDATE=1) link = item("a",{'data-cy' :'job-link'},0,"link") diff --git a/lib/sysparse.py b/lib/sysparse.py index da4dfb4..fd3f6b2 100644 --- a/lib/sysparse.py +++ b/lib/sysparse.py @@ -76,7 +76,8 @@ def login_loop(config_file,gui,worker): ret_login = 0 session = 0 while (ret != 0): - worker.dialog_rejected = False + if gui: + worker.dialog_rejected = False ret = entry2 = config.readConfig(config_file,gui,worker) print(entry2) if(ret != 0 and ret_login != 1): @@ -87,7 +88,10 @@ def login_loop(config_file,gui,worker): log("worker.dialog_rejected = ",worker.dialog_rejected) session = login(entry2) ret_login = entry2.input_pw(gui,entry2.user,worker) - if worker.dialog_rejected == False: + if gui: + if worker.dialog_rejected == False: + choose_scraper(entry2,session) + if not gui: choose_scraper(entry2,session) def runner(entry,session,scrap_func,next_url_func):