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

[pixiv] How to write downloaded file information into a single txt file and assign aliases to user IDs? #6526

Open
1223334444abc opened this issue Nov 25, 2024 · 0 comments

Comments

@1223334444abc
Copy link

1223334444abc commented Nov 25, 2024

I would like to save the information of the downloaded files. How can I achieve this?

For example, when running gallery-dl.exe https://www.pixiv.net/users/1234567, I want to write the information of all the downloaded image files into a txt file named with the current date (e.g., Pixiv/ABC/24.11.25.txt) located in the "Pixiv", "{user[name]}" folder.

The format of the information in the file should be:

↲[{date:D%Y-%m-%d}](pid-{id}){title}.{extension}【{caption}】{tags!S}
One file per line, similar to:

↲[2021-1-2](pid-12345677)はぴにゅい.png【コメントとか返信できてないけど全部見てます!ありがたやー??<br />今年もよろしくお願いします!】少年,サンバイザー
↲[2023-10-21](pid-12345678)花束💐.jpg【】VOCALOID,鏡音レン,プロセカ
↲[2024-8-30](pid-92382211)今月色々_p0.jpg【最近すごい肩が痛い、やだね<br /><br />全部fanboxに差分あります<br />(三枚目はPixivボーナスです)<br /><br />pixivFANBOX】R-18,男の子,ボクサーパンツ,ボクサーブリーフ
↲[2024-8-30](pid-92382211)今月色々_p1.jpg【最近すごい肩が痛い、やだね<br /><br />全部fanboxに差分あります<br />(三枚目はPixivボーナスです)<br /><br />pixivFANBOX】R-18,男の子,ボクサーパンツ,ボクサーブリーフ
...

Additionally, since {user[name]} often changes, I have created a mapping table for {user[id]} and folder names. How can I make gallery-dl save files to the corresponding folder under the Pixiv folder based on {user[id]}? I have a txt file similar to this:

123456|ABC
123232|CBA
123333|LLL

Here is my current download configuration, which seems to have some errors and does not achieve the desired result:

        "pixiv":
        {
            "#": "override global archive path for pixiv",
            "archive": "~/gallery-dl/archive-pixiv.sqlite3",

            "#": "set custom directory and filename format strings for all pixiv downloads",
            "proxy": "http://127.0.0.1:1080",
            "filename":
            {
                "type == 'ugoira'": "{id}_p{num}_delay{frames[0]['delay']}ms.{extension}",
                "num > 0"         : "(pid-{id}){title}_p{num}.{extension}",
                ""                : "(pid-{id}){title}.{extension}"
            },
            "directory":
            {
                "type == 'ugoira'": ["Pixiv", "{user[name]}", "OX163", "(pid-{id}){title}"],
                ""                : ["Pixiv", "{user[name]}", "OX163"]
            },
            "refresh-token": "*",
            "cookies": {
                "PHPSESSID": "*"
            },

            "#": "transform ugoira into lossless MKVs",
            "ugoira": true,
            "postprocessors": ["ugoira-copy"],

            "path-restrict": {"\\": "_", "/": "_", ":": ";", "?": "", "*": "", "<": "", ">": "", "|": ""},
            
            "postprocessors": [
            {
                "name": "metadata",
                "event": "post",
                "filename": "{_now:%y.%m.%d}.txt",
                "open": "a",
                "directory": ["Pixiv", "{user[name]}"],
                "refresh-token": "*",

                "format":[
                    "type == 'ugoira'": "[{date:D%Y-%m-%d}](pid-{id}){title}_p{num}_delay{frames[0]['delay']}ms.{extension}【{caption}】{tags!S}",
                    "num > 0"         : "[{date:D%Y-%m-%d}](pid-{id}){title}_p{num}.{extension}【{caption}】{tags!S}",
                    ""                : "[{date:D%Y-%m-%d}](pid-{id}){title}.{extension}【{caption}】{tags!S}"
                ]
            }
    ]
        },
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

1 participant