FurryCoders / FALocalRepo

Pure Python program to download submissions, journals, and user folders from the FurAffinity forum in an easily handled database.
European Union Public License 1.2
21 stars 2 forks source link

[Bug]: Crash when attempting to download a journal #5

Closed NSFWOrangeCat closed 2 years ago

NSFWOrangeCat commented 2 years ago

Version

4.3.0

What happened?

Program crashes when attempting to download a journal.

OS used: Win10 21H2 + Python 3.10.4; Ubuntu 22.04 LTS + Python 3.10.4

How to reproduce the bug?

falocalrepo download users -u lizardlars -f journals

falocalrepo download journals 10105696

Relevant log output

Traceback (most recent call last):
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\__main__.py", line 45, in main
    exit(app.main(standalone_mode=False) or 0)
  File "D:\Program Files\Python\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "D:\Program Files\Python\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\Program Files\Python\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\Program Files\Python\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\Program Files\Python\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "D:\Program Files\Python\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\console\download.py", line 179, in download_users
    downloader.download_users(list(users), list(folders))
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\downloader.py", line 686, in download_users
    self._download_users([(u, folders) for u in users])
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\downloader.py", line 656, in _download_users
    err = self.download_user_journals(user, stop, stop == 1)
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\downloader.py", line 491, in download_user_journals
    err, [entries_added, entries_modified, entries_errors] = self.download_user_folder(
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\downloader.py", line 412, in download_user_folder
    result, err = download_catch(downloader_entries, user, page)
  File "D:\Program Files\Python\lib\site-packages\falocalrepo\downloader.py", line 104, in download_catch
    return func(*args, **kwargs), 0
  File "D:\Program Files\Python\lib\site-packages\faapi\base.py", line 281, in journals
    for j in (journals := list(map(JournalPartial, info_parsed["sections"]))):
  File "D:\Program Files\Python\lib\site-packages\faapi\journal.py", line 110, in __init__
    self.parse()
  File "D:\Program Files\Python\lib\site-packages\faapi\journal.py", line 125, in parse
    parsed: dict = parse_journal_section(self.journal_tag)
  File "D:\Program Files\Python\lib\site-packages\faapi\parse.py", line 88, in parse_journal_section
    date: datetime = parse_date((t[0] if isinstance(t := tag_date["title"], list) else t).strip())
  File "D:\Program Files\Python\lib\site-packages\dateutil\parser\_parser.py", line 1368, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "D:\Program Files\Python\lib\site-packages\dateutil\parser\_parser.py", line 643, in parse
    raise ParserError("Unknown string format: %s", timestr)
dateutil.parser._parser.ParserError: Unknown string format: 4 months ago
MatteoCampinoti94 commented 2 years ago

It's a faapi bug.

The error was caused by the date format: when set to "full" on Fur Affinity's site settings the "title" attribute of the date tag switches to the fuzzy format.

I had actually fixed the problem for submissions but missed it when I rewrote the parser for version 3.

The new FAAPI version v3.7.3 is online, you can update it with falocalrepo updates --shell :)

I'll also be pushing out a patch for falocalrepo to use the new patch and actively fix the incorrect submission files extensions on Unix systems.

MatteoCampinoti94 commented 2 years ago

The new falocalrepo version v4.3.1 is out :)