Skip to content

Commit

Permalink
Update regex piles, disable ffnet for now
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTyton committed Apr 2, 2024
1 parent 23aa240 commit cfd8a61
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion release-versions/latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.04.01
2024.04.01-1
26 changes: 14 additions & 12 deletions root/app/fanficdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ def touch(fname, times=None):
utime(fname, times)


url_parsers = [(re.compile('(fanfiction.net/s/\d*/?).*'), "www."), #ffnet
(re.compile('(archiveofourown.org/works/\d*)/?.*'), ""), #ao3
(re.compile('(fictionpress.com/s/\d*)/?.*'), ""), #fictionpress
(re.compile('(royalroad.com/fiction/\d*)/?.*'), ""), #royalroad
(re.compile('https?://(.*)'), "")] #other sites
story_name = re.compile('(.*)-.*')

equal_chapters = re.compile('.* already contains \d* chapters.')
url_parsers = [(re.compile(r'(fanfiction.net/s/\d*/?).*'), "www."), #ffnet
(re.compile(r'(archiveofourown.org/works/\d*)/?.*'), ""), #ao3
(re.compile(r'(fictionpress.com/s/\d*)/?.*'), ""), #fictionpress
(re.compile(r'(royalroad.com/fiction/\d*)/?.*'), ""), #royalroad
(re.compile(r'https?://(.*)'), "")] #other sites
story_name = re.compile(r'(.*)-.*')

equal_chapters = re.compile(r'.* already contains \d* chapters.')
chapter_difference = re.compile(
'.* contains \d* chapters, more than source: \d*.')
r'.* contains \d* chapters, more than source: \d*.')
bad_chapters = re.compile(
".* doesn't contain any recognizable chapters, probably from a different source. Not updating.")
no_url = re.compile('No story URL found in epub to update.')
r".* doesn't contain any recognizable chapters, probably from a different source. Not updating.")
no_url = re.compile(r'No story URL found in epub to update.')
more_chapters = re.compile(
".*File\(.*\.epub\) Updated\(.*\) more recently than Story\(.*\) - Skipping")
r".*File\(.*\.epub\) Updated\(.*\) more recently than Story\(.*\) - Skipping")


def parse_url(url):
Expand Down Expand Up @@ -127,6 +127,8 @@ def downloader(args):
loc = mkdtemp()
output = ""
output += log("Working with url {}".format(url), 'HEADER', live)
if 'fanfiction.net' in url:
output += log("Skipping FFNET for now due to flaresolverr bug.", 'WARNING', live)
storyId = None
try:
if path:
Expand Down
2 changes: 1 addition & 1 deletion root/app/runner_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def main(options):
res = res.decode('utf-8')
print(res)
buf = StringIO(res)
regex = re.compile("Added (?:.*/)?(.*)-.* to library with id \d*")
regex = re.compile(r"Added (?:.*/)?(.*)-.* to library with id \d*")
searcher = regex.search
stripper = False
for line in buf.readlines():
Expand Down

0 comments on commit cfd8a61

Please sign in to comment.