mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.87k stars 976 forks source link

config file issues with it's format #3611

Open ashes-xda opened 1 year ago

ashes-xda commented 1 year ago

After spending quite some time on Gallery-DL configuration I'm still getting errors after errors..... I don't know the exact options applicable for my desired output (mostly for instagram) which should be something like this: **1. FOLDERS : Parent Folder "Username(UserID)" --> Sub-Folder with Posts and separate folders for Highlights, Reels & stories

  1. OUTPUT File name : username_postID_resolution.extension
  2. Archive File and cookies (.txt file) for logins**

I'm not familiar with JSON neither I code.... that's why I would really appreciate any help to know what should be the proper format for my configs or any custom command..... current this is the config file (https://github.com/mikf/gallery-dl/blob/master/docs/gallery-dl.conf) and command I'm using as of now: gallery-dl --download-archive "M:/path/insta.sqlite3" --cookies "M:/path/insta_cookies.txt" "https://www.instagram.com/xyz" and also I'm getting this error Failed to open download archive at '‪M:/path/insta.sqlite3' ('OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '\u202aM:'') whenever I add "archive" & "cookies" options in config file..... and no error when I put the same options separately in command.. also tried inter changing "/ "\" in file paths without any success

rautamiekka commented 1 year ago

Use https://jsonlint.com/ to check your JSON code.

'\u202aM:'' looks like there's a non-printing char' prepended to the drive letter, so try Backspacing starting from the right side of the colon in M: until the dash in download-archive (--download-archive "M:/ -> --download-/), then manually type those back in.

^ I ain't sure why/how that non-printing is there, so you'll need to give more info (your OS version, your terminal app name) if doing this doesn't help.

enduser420 commented 1 year ago
{
    "extractor": {
        "instagram": {
            "archive": "M:/path/insta.sqlite3",
            "cookies": "M:/path/insta_cookies.txt",
            "include": ["posts", "stories", "highlights", "reels"],
            "directory": ["{username}({owner_id})", "{subcategory!c}"],
            "filename": "{username}_{post_id}_{width}x{height}.{extension}"
        }
    }
}
$ gdl https://www.instagram.com/instagram/ --no-download -vc cfg.json
[gallery-dl][debug] Version 1.25.0-dev - Git HEAD: 78d3960a
[gallery-dl][debug] Python 3.11.1 - Windows-10-10.0.19045-SP0
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.13
[gallery-dl][debug] Configuration Files ['%APPDATA%\\gallery-dl\\config.json', 'cfg.json']
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/instagram/'
[instagram][debug] Using InstagramUserExtractor for 'https://www.instagram.com/instagram/'
[instagram][debug] Using InstagramPostsExtractor for 'https://www.instagram.com/instagram/posts/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=instagram HTTP/1.1" 302 0
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=instagram HTTP/1.1" 200 63538
[instagram][debug] Sleeping 6.97 seconds (request)
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/feed/user/25025320/?count=30 HTTP/1.1" 200 127212
* .\gallery-dl\instagram(25025320)\Posts\instagram_3030163526806445173_720x1280.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3027986318461652452_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3027258396759055524_1349x1687.jpg
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025793201002764689_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025152843029811144_720x1280.mp4 
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025086841153162241_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3022196053190769632_720x1280.mp4 
* .\gallery-dl\instagram(25025320)\Posts\instagram_3020739827755300866_900x900.jpg
...
ashes-xda commented 1 year ago
{
    "extractor": {
        "instagram": {
            "archive": "M:/path/insta.sqlite3",
            "cookies": "M:/path/insta_cookies.txt",
            "include": ["posts", "stories", "highlights", "reels"],
            "directory": ["{username}({owner_id})", "{subcategory!c}"],
            "filename": "{username}_{post_id}_{width}x{height}.{extension}"
        }
    }
}
$ gdl https://www.instagram.com/instagram/ --no-download -vc cfg.json
[gallery-dl][debug] Version 1.25.0-dev - Git HEAD: 78d3960a
[gallery-dl][debug] Python 3.11.1 - Windows-10-10.0.19045-SP0
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.13
[gallery-dl][debug] Configuration Files ['%APPDATA%\\gallery-dl\\config.json', 'cfg.json']
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/instagram/'
[instagram][debug] Using InstagramUserExtractor for 'https://www.instagram.com/instagram/'
[instagram][debug] Using InstagramPostsExtractor for 'https://www.instagram.com/instagram/posts/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=instagram HTTP/1.1" 302 0
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=instagram HTTP/1.1" 200 63538
[instagram][debug] Sleeping 6.97 seconds (request)
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/feed/user/25025320/?count=30 HTTP/1.1" 200 127212
* .\gallery-dl\instagram(25025320)\Posts\instagram_3030163526806445173_720x1280.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3027986318461652452_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3027258396759055524_1349x1687.jpg
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025793201002764689_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025152843029811144_720x1280.mp4 
* .\gallery-dl\instagram(25025320)\Posts\instagram_3025086841153162241_1080x1920.mp4
* .\gallery-dl\instagram(25025320)\Posts\instagram_3022196053190769632_720x1280.mp4 
* .\gallery-dl\instagram(25025320)\Posts\instagram_3020739827755300866_900x900.jpg
...

Wow Thankyou so much worked just fine.... few more things

  1. it saves all downloaded file to it's default directory so how do I change that to my desired path?
  2. I don't want separate folder for "posts"... instead just want them in parent folder
ashes-xda commented 1 year ago

yeah I saw somewhere to manually type path back in again because I copy pasted it and that's really weird reason for an error because that's the same path i use for ytdlp configs too... nevermind thankyou

rautamiekka commented 1 year ago
  1. it saves all downloaded file to it's default directory so how do I change that to my desired path?

base-directory:

{
    "extractor": {
        "base-directory": "M:/path/",

        "instagram": {
            ...
        }
    }
}
enduser420 commented 1 year ago
{
    "extractor": {
        "instagram": {
            "base-directory": "M:/path/",
            "archive": "M:/path/insta.sqlite3",
            "cookies": "M:/path/insta_cookies.txt",
            "include": ["posts", "stories", "highlights", "reels"],
            "directory": ["{username}({owner_id})", "{subcategory!c}"],
            "filename": "{username}_{post_id}_{width}x{height}.{extension}",
            "posts": {
                "directory": ["{username}({owner_id})"]
            }
        }
    }
}

Posts

$ gdl https://www.instagram.com/instagram/ --no-download -c cfg.json
* M:\path\instagram(25025320)\instagram_3030163526806445173_720x1280.mp4
* M:\path\instagram(25025320)\instagram_3027986318461652452_1080x1920.mp4
* M:\path\instagram(25025320)\instagram_3027258396759055524_1349x1687.jpg
* M:\path\instagram(25025320)\instagram_3025793201002764689_1080x1920.mp4
* M:\path\instagram(25025320)\instagram_3025152843029811144_720x1280.mp4 
* M:\path\instagram(25025320)\instagram_3025086841153162241_1080x1920.mp4
* M:\path\instagram(25025320)\instagram_3022196053190769632_720x1280.mp4 
* M:\path\instagram(25025320)\instagram_3020739827755300866_900x900.jpg
...

Highlights, etc

$ gdl https://www.instagram.com/instagram/highlights --no-download -c cfg.json
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4 
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4 
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4 
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_1170x2080.jpg
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_1170x2080.jpg
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4 
* M:\path\instagram(25025320)\Highlights\instagram_17914256252161608_720x1280.mp4 
...