Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Subscribestar] adding date to folder path #2642

Closed
PowerWasher9000 opened this issue May 31, 2022 · 10 comments
Closed

[Subscribestar] adding date to folder path #2642

PowerWasher9000 opened this issue May 31, 2022 · 10 comments

Comments

@PowerWasher9000
Copy link

I remember using ["{date:%Y}", "{date:%Y-%m}"] with success in the past, but it just started giving me invalid format errors recently
I use the same format with other sites like patreon and fanbox, and it works without any problems
Does the subscribestar extractor use different strings for this?

@mikf
Copy link
Owner

mikf commented May 31, 2022

The way to format date fields is the same for all extractors,
and your directory settings work fine when trying them myself:

$ gallery-dl -o 'directory=["{date:%Y}", "{date:%Y-%m}"]' https://www.subscribestar.com/subscribestar
/tmp/2022/2022-05/474066_1196842.jpg
/tmp/2021/2021-07/369914_712672.png
/tmp/2021/2021-07/369914_712674.png

What is the exact error you are getting and format strings your are using?

@PowerWasher9000
Copy link
Author

PowerWasher9000 commented May 31, 2022

Format

"directory": ["{category}", "{author_name}", "{date:%Y}", "{date:%Y-%m}"],
"filename": "{post_id}_{num:>03}.{filename}.{extension}"

Error
[subscribestar][error] DirectoryFormatError: Applying directory format string failed (ValueError: Invalid format specifier)

I use the same/similar format for patreon and fanbox, and they work fine
"directory": ["{category}", "{creatorId}", "{date:%Y}", "{date:%Y-%m}"],

The weird part is that it used to work

@mikf
Copy link
Owner

mikf commented Jun 1, 2022

What I think is happening is that gallery-dl fails to parse the date/time information of a post into a datetime object, just returns the unparsable string value, and fails to apply a datetime format string to it.

I haven't been able to find a post where this happens myself, so could you do a run with -j and post the last date field of its output here?

@Hrxn
Copy link
Contributor

Hrxn commented Jun 1, 2022

Plausible on the event of a site change..

@PowerWasher9000
Copy link
Author

This? "date": "2020-11-22 12:02:00",
Also after a little bit of testing, I've found out that it only happens for the adult side with cookies.txt enabled, but works otherwise. Result seems to be consistent whether I'm subscribed to a user or not.

@mikf
Copy link
Owner

mikf commented Jun 1, 2022

That's what I meant, but this looks very much like a valid datetime object that does not cause any errors when applying a date format string to it.

The format on subscribestar that gallery-dl tries to parse looks like "Apr 03, 2022 07:06 AM",
which then becomes "2022-04-03 07:06:00" when properly parsed.
The second form is also format-able.

I tried it with cookies on subscribestar.adult and any date there gets successfully parsed:

$ gallery-dl --cookies cookies-subscribestar-adult.txt -j --range 0 https://subscribestar.adult/NitropunkArts
...
      "date": "2022-04-03 10:06:00",

$ gallery-dl --cookies cookies-subscribestar-adult.txt -j --range 0 https://subscribestar.adult/innoxia
...
      "date": "2022-03-22 21:18:00",

Does this only happen with specific accounts? If so, please post them so I can see what's different for them and adapt the code accordingly.
Do you have any special account settings that might cause the datetime info on subscribestar to be formatted differently? I haven't found any option like that in my own settings, but who knows?

@PowerWasher9000
Copy link
Author

PowerWasher9000 commented Jun 1, 2022

This is all I have in my config for substar

        "subscribestar":
        {
        "cookies": "./cookies/cookies-subscribestar-adult.txt",
        "directory": ["{category}", "{author_name}", "{date:%Y}", "{date:%Y-%m}"],
        "filename": "{post_id}_{num:>03}.{filename}.{extension}"
        },

This one gives me a format error
https://subscribestar.adult/KelvinHiu

This one works perfectly, cookies or not
https://subscribestar.adult/cheunart

Perhaps it's the pinned post?

@mikf
Copy link
Owner

mikf commented Jun 3, 2022

$ cat config.json 
{
    "cookies": "/tmp/cookies-subscribestar-adult.txt",
    "directory": ["{category}", "{author_name}", "{date:%Y}", "{date:%Y-%m}"],
    "filename": "{post_id}_{num:>03}.{filename}.{extension}"
}

$ gallery-dl --ignore-config  -c config.json https://subscribestar.adult/KelvinHiu
./gallery-dl/subscribestar/KelvinHiu/2022/2022-04/568238_001.q-9g5PVYM5EVpVujRR4UG1kwYAS_Dsf5rWR9kfVk-UqobjufXnBR8PbWkeeGtZCK7CMko-Da11fnlOvvYyVLbA==.jpg
./gallery-dl/subscribestar/KelvinHiu/2022/2022-04/568238_002.egMIX-akhoaSvFLRFqHD7N0_juqVbqvb8F1s7nx0OHHMeDQkCuR33NeoTEyebBAqOiH7SPa3ZZ2b7t35YQ99dg==.jpg
./gallery-dl/subscribestar/KelvinHiu/2022/2022-04/568238_003.ZWbU_rFq4E5R6HUQ_aqB5qahUHyHUpyV2E1yD0vDuc_n8Ax0jBhLIZ_GBZhxI7SQRaKe5indP7mz-QJDcIrydQ==.jpg
./gallery-dl/subscribestar/KelvinHiu/2022/2022-04/568238_004.BmAP7e8i8I1SfgMkEwHzp4WY3qEXDO7HHQ4qMEUsvjvzkVmq8dz6mjQCWKlLAn6iJHKGOwamMhfgKoVAXtKaoA==.jpg
./gallery-dl/subscribestar/KelvinHiu/2022/2022-04/568238_005.zkj0f5-MYPC4jAEhbB01npuD8Y3-YI90UnslcFNCtFUD14qBvJKveMa341J6JLKOr384h-lfpk-Q2QOHU5CA5g==.jpg
...

I also do not see a pinned post for this profile. Maybe it's only visible to subscribers?

As a last effort, you could run a failing URL with --write-pages and upload the last generated .dump file here.

And as a workaround, conditional directory names:

    "directory": {
        "type(date) == datetime": ["{category}", "{author_name}", "{date:%Y}", "{date:%Y-%m}"],
        ""                      : ["{category}", "{author_name}", "no valid date ({date})"]
    },

@PowerWasher9000
Copy link
Author

Dump
01_https_subscribestar.adult_somescrub.dump.txt

Using two different accounts, it appears that some posts, albeit blurred, are still visible to unsubscribed users, weird. My past sub history to this creator might have something to do with it.

The workaround works, though two posts were saved in folders outside the target directory, both were pinned posts
folder name no valid date (Updated on Jun 01, 2022 08_59 PM)

urls:
https://subscribestar.adult/posts/619217
https://subscribestar.adult/posts/621196

mikf added a commit that referenced this issue Jun 4, 2022
Handle instances where the actual datetime information
is preceded by "Updated on "
@mikf
Copy link
Owner

mikf commented Jun 7, 2022

Thanks for sticking around and helping me identify the problem.

The old date-parsing code had a problem with the "Updated on" in front of the actual date.
This is now fixed in v1.22.1 (541a61d).

@mikf mikf closed this as completed Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants