def getCacheFileNames(url):
# Obtiene el directorio de la cache para esta url
siteCachePath = getSiteCachePath(url)
# Obtiene el ID de la cache (md5 de la URL)
cacheId = get_md5(url)
logger.debug("[scrapertools.py] cacheId="+cacheId)
# Timestamp actual
nowtimestamp = time.strftime("%Y%m%d%H%M%S", time.localtime())
logger.debug("[scrapertools.py] nowtimestamp="+nowtimestamp)
# Nombre del fichero
# La cache se almacena en una estructura CACHE + URL
ruta = os.path.join( siteCachePath , cacheId[:2] , cacheId[2:] )
newFile = os.path.join( ruta , nowtimestamp + ".cache" )
logger.debug("[scrapertools.py] newFile="+newFile)
if not os.path.exists(ruta):
os.makedirs( ruta )
# Busca ese fichero en la cache
cachedFile = getCachedFile(siteCachePath,cacheId)
return cachedFile, newFile
# Busca ese fichero en la cache
scrapertools_old.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录