mikf / gallery-dl

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

How to exclude accounts/channels from downloading? #4466

Open snwefly opened 11 months ago

snwefly commented 11 months ago

Sometimes people post accounts in reply and gallery-dl starts to download entire accounts/channels.

example https://old.reddit.com/r/test/comments/160qofk/test_playlist/

Is there any way to prevent that?

Thanks

Hrxn commented 11 months ago

You mean like from Instagram or something? There's a "blacklist" and "whitelist" option for that.

For example, simply add this to your config inside the "reddit": block:

            "blacklist": ["twitter", "instagram"]
snwefly commented 11 months ago

Sometimes people link channel on the reply and gallery-dl proceed to download all the uploaded videos from that channel.

I like to download yt single and playlists and skip any accounts example links like to skip

https://www.youtube.com/
https://www.youtube.com/c/dummyname
https://www.youtube.com/@dummyname
https://www.youtube.com/user/dummyname
https://www.youtube.com/channel/UCaabbcc

example links i like to download

https://www.youtube.com/playlist?list=PLxyz
https://www.youtube.com/watch?v=12345678901
https://www.youtube.com/watch?v=abc12345678
https://www.youtube.com/watch?v= ...
https://www.youtube.com/watch?v=xyz12345678

I tried to put paraments on blacklist but it not working as intended

blacklist": ["twitter", "instagram", "youtube:channel", "ytdl:channel","ytdl:youtube","ytdl:user"],
mikf commented 11 months ago

Use a URL with -E/--extractor-info to get the category names for blacklist/whitelist.

$ gallery-dl -E ytdl:https://www.youtube.com/
Category / Subcategory
  "ytdl" / "YoutubeRecommended"
# -> ytdl:YoutubeRecommended

$ gallery-dl -E ytdl:https://www.youtube.com/c/dummyname
Category / Subcategory
  "ytdl" / "YoutubeTab"
# -> ytdl:YoutubeTab

In your case it might be better to use whitelist instead of blacklist and only list the categories you want to download from instead of the ones you don't. (only one of whitelist and blacklist works at a time, combining both is not possible)

snwefly commented 11 months ago
 "reddit":
        {

                        "client-id": "----------------------",
            "user-agent": "----------------------------------",

            "archive-prefix": "",
            "archive": "~/archive/gallery-dl.archive.reddit.db",

            "directory": ["{title} {id}"],
            "parent-directory": true,
            "parent-metadata": "_reddit_",
            "date-format": "%Y-%m-%dT%H:%M:%S",

            "comments": 500,
            "morecomments": false,
            "recursion": 1,
            "videos": "ytdl",
            "sleep-request": [0.6, 0.8],
            "blacklist": ["ytdl:YoutubeTab"],
            "postprocessors": ["nonpicsort"]

        },

It's ignore all ytdlp links, where should i put the blacklist?

mikf commented 11 months ago

Inside reddit, exactly where you put it. Did you actually enable the ytdl extractor?

snwefly commented 11 months ago

above reply contains full reddit part of the config, i put blacklist under

 "sleep-request": [0.6, 0.8],
            "blacklist": ["ytdl:YoutubeTab"],
            "postprocessors": ["nonpicsort"]

ytdl is enabled

 "ytdl":
        {

            "enabled": true,
            "format": null,
            "generic": true,
            "logging": true,
            "module": null,
            "raw-options": null,
            "cmdline-args": "--playlist-end 1",
            "directory": {
                    "'_reddit_' in locals()": [],
                    ""                      : [""]
                            }

        },
mikf commented 11 months ago
{
    "extractor": {
        "reddit": {
            "blacklist": ["ytdl:YoutubeTab"]
        },
        "ytdl": {
            "enabled": true
        }
    }
}
# video
$ gallery-dl -c config.json https://old.reddit.com/r/YoutubeChannelSharing/comments/14yed8q/hi_i_made_this_video_because_i_hit_a_100/
/tmp/_/ytdl/Youtube/100 sub special (content warning!)-nxynb5WWgp8.mkv

# channel
$ gallery-dl -c config.json https://old.reddit.com/r/YoutubeChannelSharing/comments/14xau9s/come_check_out_my_soccer_channel/