diff --git a/lib/helpers.py b/lib/helpers.py index f5d200d..0c4f1cd 100644 --- a/lib/helpers.py +++ b/lib/helpers.py @@ -223,7 +223,7 @@ def indeedExtractDays(datestr): #print("int:",cleannumint,"today:",today,"cleandate:",datetime.fromtimestamp(cleandate).strftime('%Y-%m-%d')) return datetime.fromtimestamp(cleandate).strftime('%Y-%m-%d') return "NOTFound" -def getCookieFromBrowser(url): +def getCookiesFromBrowser(url): #workaround for loked database shutil.copyfile(cookiePath,tmpPath) cookie = '' @@ -233,7 +233,7 @@ def getCookieFromBrowser(url): cmd_read_cookies = f"""SELECT name,value FROM moz_cookies WHERE host like ?;""" print(cmd_read_cookies) cursor = connection.cursor() - cursor.execute(cmd_read_cookies,('%'+'indeed'+'%',)) + cursor.execute(cmd_read_cookies,('%'+url+'%',)) while len(rows)!=0: rows = cursor.fetchmany(25) for row in rows: @@ -246,3 +246,44 @@ def getCookieFromBrowser(url): #access cookies from firefox: #copy (because locked): cp .mozilla/firefox/imibizoh.default/cookies.sqlite cookies.sqlite #Select value from moz_cookies where host like '%indeed%' +def urlToDomain(url): + pos = patternSearch(url,"https://") + urlCut = dropBeforePos(url,pos) + print("url cut",urlCut) + posDot = skipAfterChar(urlCut,'.') + urlCut = dropBeforePos(urlCut,posDot) + print("url after cut dot:",urlCut) + posDot = skipAfterChar(urlCut,'.') + urlCut = dropAfterPos(urlCut,posDot) + print("url after cut dot:",urlCut) +def patternSearch(url,pattern): + x = 0 + for a,i in enumerate(url): + print("i:",i) + if i == pattern[x]: + if x