bitbybyte / fantiadl

Download posts and media from Fantia
MIT License
303 stars 51 forks source link

Not downloading all images if there's two posts with the same title #58

Closed RndUser0 closed 3 years ago

RndUser0 commented 3 years ago

Command line: fantiadl_v1.7.exe -c [session cookie] -o [output folder] -r -x -t https://fantia.jp/fanclubs/5744/posts

Example URL: https://fantia.jp/posts/658107

On the page above there are two posts with the same title for the paid plan. In this case fantiadl v1.7 only downloads the first set of images for the paid plan and not the second one because files with the same name already exist. To work around this issue I have to pause fantiadl, move the images of the first set to another folder and resume to get the second set.

Command prompt output: ───────────────── Downloading fanclub 5744... Collecting fanclub posts... Collected 98 posts. Downloading post 658107... File: .\かるたも\658107\thumb.png |█████████████████████████| 100% File: .\かるたも\658107\フリープラン\0.png |█████████████████████████| 100% File: .\かるたも\658107\フリープラン\1.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\0.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\1.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\2.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\3.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\4.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\5.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\6.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\7.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\8.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\9.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\10.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\11.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\12.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\13.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\14.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\15.png |█████████████████████████| 100% File: .\かるたも\658107\感謝プラン\0.png |█████████████████████████| 100% Traceback (most recent call last): File "fantiadl.py", line 108, in File "models.py", line 175, in download_fanclub File "models.py", line 387, in download_post File "models.py", line 317, in download_post_content File "models.py", line 298, in download_photo File "models.py", line 286, in perform_download FileExistsError: [WinError 183] Cannot create a file when that file already exists: '.\かるたも\658107\感謝プラン\0.incomplete' -> '.\かるたも\658107\感謝プラン\0.png' [12784] Failed to execute script fantiadl


Note: I shortened the path of the files.

PS: Thanks a lot for coding this tool!

bitbybyte commented 3 years ago

Probably I'll just append a (2) in the directory name, using the post content ID is a bit overkill. Order is preserved in the API response also so no problems there.