add time converter for indeed
This commit is contained in:
parent
1bf8198c70
commit
e305a7ba75
@ -6,7 +6,7 @@ import re
|
||||
from dateconverter import *
|
||||
from datetime import datetime
|
||||
DEBUG = True
|
||||
|
||||
number = ['0','1','2','3','4','5','6','7','8','9']
|
||||
def log(*s):
|
||||
if DEBUG:
|
||||
print(s)
|
||||
@ -190,3 +190,22 @@ def makeSession(url):
|
||||
with requests.Session() as session:
|
||||
page = session.get(url)
|
||||
return session
|
||||
def indeedExtractDays(datestr):
|
||||
cleannumstr=''
|
||||
cleannumint=-1
|
||||
cleandate=''
|
||||
foundchar=False
|
||||
for a in datestr:
|
||||
print(a)
|
||||
if a in number and foundchar==False:
|
||||
foundchar=True
|
||||
cleannumstr+=a
|
||||
elif a in number and foundchar == True:
|
||||
cleannumstr+=a
|
||||
elif a not in number and foundchar == True:
|
||||
break
|
||||
cleannumint = int(cleannumstr)
|
||||
today = int(datetime.utcnow().timestamp())
|
||||
cleandate = today - cleannumint * 60 * 60 * 7 * 4
|
||||
#print("int:",cleannumint,"today:",today,"cleandate:",datetime.fromtimestamp(cleandate).strftime('%Y-%m-%d'))
|
||||
return datetime.fromtimestamp(cleandate).strftime('%Y-%m-%d')
|
||||
|
Loading…
Reference in New Issue
Block a user