Nandaka / PixivUtil2

Download images from Pixiv and more!
http://nandaka.devnull.zone/
BSD 2-Clause "Simplified" License
2.4k stars 254 forks source link

Non-interactive new illust from bookmarked members doesn't work without explicit count limit #1348

Closed Hamuko closed 1 month ago

Hamuko commented 4 months ago

Prerequisites

Description

Non-interactive bookmark downloading (option 8) is broken in 20240703 as it tries to run len() on an integer, most likely len(-1) as that seems to be the default for --bcl / --bookmark_count_limit, which is not a valid operation in Python.

This can be worked around by adding the bookmark count limit explicitly (for example --bcl=-1), as that will supply the value as a string instead, but there's really no way to figure it out without reading the source code.

Most likely broken by #1324.

Steps to Reproduce

  1. Run PixivUtil2 with -s 8 --ep=3 -x arguments.

Expected behavior:

Three first bookmarked pages are downloaded.

Login successful.
My User Id: xxxxxxx.
Premium User: False.
End Page = 3
Processing New Illust from bookmark
Page #1
Image #1
Processing Image Id: xxxxxxxxx
[...]
Limit or last page reached.
Done.

Actual behavior:

PixivUtil2 crashes immediately after login.

Login successful.
My User Id: xxxxxxx.
Premium User: False.
End Page = 3
Traceback (most recent call last):
  File "/PixivUtil2.py", line 1745, in main
    np_is_valid, op_is_valid, selection = main_loop(ewd, op_is_valid, selection, np_is_valid, args, options)
  File "/PixivUtil2.py", line 1422, in main_loop
    menu_download_new_illust_from_bookmark(op_is_valid, args, options)
  File "/PixivUtil2.py", line 648, in menu_download_new_illust_from_bookmark
    if bookmark_count is not None and len(bookmark_count) > 0:
TypeError: object of type 'int' has no len()
Unknown Error, please check the log file: (<class 'TypeError'>, TypeError("object of type 'int' has no len()"), <traceback object at 0x7f22113ff080>)

Versions

Broken in 20240703. Worked in 20230105.

I am running PixivUtil2 using my own Docker container, but it shouldn't really affect anything.

Butterfly-Dragon commented 4 months ago
2024-07-11 11:59:27,320 - PixivUtil20240703 - INFO - ###############################################################
2024-07-11 11:59:27,320 - PixivUtil20240703 - INFO - Starting with argument: [PixivUtil2.exe -s 5 -p y --ep 1 -x].
2024-07-11 11:59:27,320 - PixivUtil20240703 - INFO - Setting log level to: DEBUG
2024-07-11 11:59:27,320 - PixivUtil20240703 - INFO - No default cookie jar available, creating... 
2024-07-11 11:59:27,889 - PixivUtil20240703 - INFO - Using default DB Path: D:\Downloads\Downloader\!downloader\PixivUtil2\db.sqlite
2024-07-11 11:59:27,905 - PixivUtil20240703 - INFO - Only process members where the last update is >= 99999999999 days ago
2024-07-11 11:59:28,162 - PixivUtil20240703 - INFO - Using local timezone: +01:00
2024-07-11 11:59:28,162 - PixivUtil20240703 - INFO - Trying to log in with saved cookie
2024-07-11 11:59:29,608 - PixivUtil20240703 - INFO - Logging in, return url: https://www.pixiv.net/en/
2024-07-11 11:59:29,608 - PixivUtil20240703 - INFO - Login successful.
2024-07-11 11:59:29,608 - PixivUtil20240703 - INFO - Logged in using cookie
2024-07-11 11:59:29,609 - PixivUtil20240703 - INFO - My User Id: [REDACTED].
2024-07-11 11:59:29,610 - PixivUtil20240703 - INFO - Premium User: False.
2024-07-11 11:59:29,610 - PixivUtil20240703 - INFO - Locale = /en
2024-07-11 11:59:29,610 - PixivUtil20240703 - INFO - User Bookmarked Artist mode (5).
2024-07-11 11:59:29,611 - PixivUtil20240703 - ERROR - Unknown Error: object of type 'int' has no len()
Traceback (most recent call last):
  File "PixivUtil2.py", line 1745, in main
  File "PixivUtil2.py", line 1416, in main_loop
  File "PixivUtil2.py", line 531, in menu_download_from_online_user_bookmark
TypeError: object of type 'int' has no len()
2024-07-11 11:59:29,612 - PixivUtil20240703 - ERROR - Unknown Error, please check the log file: (<class 'TypeError'>, TypeError("object of type 'int' has no len()"), <traceback object at 0x0000016C8B0E8400>)
2024-07-11 11:59:29,613 - PixivUtil20240703 - INFO - EXIT: -1
2024-07-11 11:59:29,613 - PixivUtil20240703 - INFO - ###############################################################

i'm having this problem too, for option 5 instead of 8

Nandaka commented 4 months ago

pass it using --bookmark_count_limit

image

Butterfly-Dragon commented 4 months ago

pass it using --bookmark_count_limit

currently i followed the original poster's advice by adding --bcl=-1