diff --git a/fanficfare/adapters/adapter_fanfictionnet.py b/fanficfare/adapters/adapter_fanfictionnet.py index 5cd20fcb..a5aacff3 100644 --- a/fanficfare/adapters/adapter_fanfictionnet.py +++ b/fanficfare/adapters/adapter_fanfictionnet.py @@ -170,6 +170,7 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter): if "Please check to see you are not using an outdated url." in data: raise exceptions.FailedToDownload("Error downloading Chapter: %s! 'Chapter not found. Please check to see you are not using an outdated url.'" % url) + # canonicalurl = soup.select_one('link[rel=canonical]')['href'] self.set_story_idurl(canonicalurl) @@ -185,9 +186,10 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter): # get chapter part of url. except: chapcount = 1 - tryurl = "https://%s/s/%s/%d/"%(self.getSiteDomain(), - self.story.getMetadata('storyId'), - chapcount+1) + tryurl = "https://%s/s/%s/%d/%s"%(self.getSiteDomain(), + self.story.getMetadata('storyId'), + chapcount+1, + self.urltitle) logger.debug('=Trying newer chapter: %s' % tryurl) newdata = self._fetchUrl(tryurl) if "not found. Please check to see you are not using an outdated url." not in newdata \ diff --git a/fanficfare/chromagnon/cacheBlock.py b/fanficfare/chromagnon/cacheBlock.py index 51355ea8..a330e7a6 100644 --- a/fanficfare/chromagnon/cacheBlock.py +++ b/fanficfare/chromagnon/cacheBlock.py @@ -55,10 +55,7 @@ class CacheBlock(): # Read Magic Number magic = struct.unpack('I', header.read(4))[0] -<<<<<<< HEAD # print("magic number:%s"%hex(magic)) -======= ->>>>>>> e94a36a7 (Rebasing onto master) if magic == CacheBlock.BLOCK_MAGIC: self.type = CacheBlock.BLOCK header.seek(2, 1) diff --git a/fanficfare/chromagnon/cacheData.py b/fanficfare/chromagnon/cacheData.py index ebb7e6ff..ba2e033a 100644 --- a/fanficfare/chromagnon/cacheData.py +++ b/fanficfare/chromagnon/cacheData.py @@ -113,11 +113,7 @@ class CacheData(): else: block = open(os.path.join(self.address.path,self.address.fileSelector), 'rb') block.seek(8192 + self.address.blockNumber*self.address.entrySize) -<<<<<<< HEAD - data = block.read(self.size) -======= - data = block.read(self.size).decode('utf-8') ->>>>>>> e94a36a7 (Rebasing onto master) + data = block.read(self.size)#.decode('utf-8',errors='ignore') block.close() return data diff --git a/fanficfare/chromagnon/cacheEntry.py b/fanficfare/chromagnon/cacheEntry.py index 480a4213..5ffb6c0f 100644 --- a/fanficfare/chromagnon/cacheEntry.py +++ b/fanficfare/chromagnon/cacheEntry.py @@ -118,7 +118,7 @@ class CacheEntry(): if self.keyAddress == 0: return self.key else: - return self.key.data() + return self.key.data().decode('utf-8') def __str__(self): string = "Hash: 0x%08x" % self.hash + '\n' diff --git a/fanficfare/chromagnon/cacheParse.py b/fanficfare/chromagnon/cacheParse.py index 58ef77dc..9fcb10a3 100644 --- a/fanficfare/chromagnon/cacheParse.py +++ b/fanficfare/chromagnon/cacheParse.py @@ -39,7 +39,6 @@ import os import struct import sys import re -<<<<<<< HEAD import time def do_cprofile(func): @@ -67,10 +66,6 @@ except: def brotli_decompress(inbuf): # wants the output, too, but returns it return brotlidec(inbuf,[]) -import time -======= -import brotli ->>>>>>> e94a36a7 (Rebasing onto master) from . import csvOutput from . import SuperFastHash @@ -143,24 +138,16 @@ class ChromeCache(object): def __init__(self,path): self.cache = parse(path) self.hash_cache = {} -<<<<<<< HEAD # t = time.time() for entry in self.cache: key = entry.keyToStr() if 'fanfiction.net' not in key: continue -======= - for entry in self.cache: - key = entry.keyToStr() ->>>>>>> e94a36a7 (Rebasing onto master) 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 -<<<<<<< HEAD # print("======:%s"%(time.time()-t)) -======= ->>>>>>> e94a36a7 (Rebasing onto master) def get_cached_file(self,url): if url in self.hash_cache: @@ -176,11 +163,7 @@ class ChromeCache(object): if entry.httpHeader.headers[b'content-encoding'] == b"gzip": data = gzip.decompress(data) elif entry.httpHeader.headers[b'content-encoding'] == b"br": -<<<<<<< HEAD data = brotli_decompress(data) -======= - data = brotli.decompress(data) ->>>>>>> e94a36a7 (Rebasing onto master) return data return None @@ -259,10 +242,6 @@ def exportToHTML(cache, outpath): # print("unbrotli'ed:%s"%name) except IOError: page.write("Something wrong happened while unzipping") -<<<<<<< HEAD -======= - brotli ->>>>>>> e94a36a7 (Rebasing onto master) else: page.write('%s'%(name , entry.keyToStr().split('/')[-1]))