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 downloading submission without category #9

Closed solipsis-project closed 1 year ago

solipsis-project commented 1 year ago

Version

4.4.4

What happened?

A very small number of submissions don't contain a category

Two examples are https://www.furaffinity.net/view/17027451/ and https://www.furaffinity.net/view/18605987/

Attempting to download either of these submissions results in the error below. This happens because the parsed info_spans object is assumed to have matched at least four spans, but on these submissions there are only three.

How to reproduce the bug?

falocalrepo download submissions 17027451

Relevant log output

tag_category1: Optional[Tag] = tag_info.select_one("span.category-name")
  tag_category2: Optional[Tag] = tag_info.select_one("span.type-name")
  tag_species: Optional[Tag] = (info_spans := tag_info.select("span"))[2]
> tag_gender: Optional[Tag] = info_spans[3]
  tag_description: Optional[Tag] = sub_page.select_one("div.submission-description")
  tag_folder: Optional[Tag] = sub_page.select_one("a.button[href^='/scraps/'],a.button[href^='/gallery/']")

tag_info: <section class="info text">
<div><strong class="highlight">Species</strong> <span>Unspecified / Any</... [283]tag_category1: None
tag_category2: None
tag_species: <span>962 x 604</span>
info_spans: [<span>Unspecified / Any</span>, <span>Multiple characters</span>, <span>962 x 604</span>]
sub_page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xht... [44920]IndexError:
list index out of range
MatteoCampinoti94 commented 1 year ago

The bug was in the FAAPI library. I have just pushed an updated to it and a new patch 4.4.5 for FALocalRepo :)