mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-09 05:21:13 +02:00
Tweak chromagnon/cacheParse.py
This commit is contained in:
parent
0be96953af
commit
9d4f587e23
1 changed files with 5 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ import struct
|
|||
import sys
|
||||
import re
|
||||
import brotli
|
||||
import time
|
||||
|
||||
from . import csvOutput
|
||||
from . import SuperFastHash
|
||||
|
|
@ -112,12 +113,16 @@ class ChromeCache(object):
|
|||
def __init__(self,path):
|
||||
self.cache = parse(path)
|
||||
self.hash_cache = {}
|
||||
# t = time.time()
|
||||
for entry in self.cache:
|
||||
key = entry.keyToStr()
|
||||
if 'fanfiction.net' not in key:
|
||||
continue
|
||||
self.hash_cache[key] = entry
|
||||
normkey = re.sub(r'^(https://www.fanfiction.net/s/\d+/\d+/).+$',r'\1',key)
|
||||
## either overwrites (no harm), or adds new.
|
||||
self.hash_cache[normkey] = entry
|
||||
# print("======:%s"%(time.time()-t))
|
||||
|
||||
def get_cached_file(self,url):
|
||||
if url in self.hash_cache:
|
||||
|
|
|
|||
Loading…
Reference in a new issue