diff --git a/lib/helpers.py b/lib/helpers.py index 80d28cc..5cd3739 100644 --- a/lib/helpers.py +++ b/lib/helpers.py @@ -79,9 +79,9 @@ def finder(results,item,**modes): else: result = entry.findAll(item.tag,class_=item.tag_content) log("found count results:",len(result)) - if len(result) == 0 and DEBUG == True: + if not result and DEBUG == True: for x in results: - log(x) + log("No entry found for: ",item.name,item.tag,item.tag_content," -->", x) input() if result: log("theres a result") diff --git a/lib/scrap_jobs.py b/lib/scrap_jobs.py index b962e1f..7760302 100644 --- a/lib/scrap_jobs.py +++ b/lib/scrap_jobs.py @@ -46,19 +46,19 @@ 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 = 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" - company = item("p",company_class,0) + 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","jlFpCz",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 = item("span","Span-sc-1ybanni-0 Text__span-sc-1lu7urs-12 Text-sc-1lu7urs-13 krGudM hUhFmL",0,"date") ar_date = finder(results,date,CLEANDATE=1) - link = item("a",{'data-cy' :'job-link'},0) + link = item("a",{'data-cy' :'job-link'},0,"link") ar_link = finder(results,link,LINK=1,ATTRS=1,BASEURL="https://jobs.ch") tag = entry.tag#get from config @@ -138,16 +138,16 @@ def scrap_jobagent(url,entry,session): print("no li items found") log("page:",page) - title = item("span","jobtitle",0) + title = item("span","jobtitle",0,"jobagent title") ar_title = finder(results,title) - location = item("span","location",0) + location = item("span","location",0,"jobagent location") ar_location = finder(results,location,LOCATION_CLEANUP=1) - company = item("span","company",0) + company = item("span","company",0,"jobagent company") ar_company = finder(results,company,DEFAULT=1) - link = item("a","title",0) + link = item("a","title",0,"jobagent link") ar_link = finder(results,link,LINK=1) date = item("span","pubdate",0)