You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Selecting only a certain type/volume/etc of manga chapters has been asked about a couple of times (#25, #11 (comment)) and using metadata, which is usually only used to build filenames, to select/filter images or image-groups seems like a generally useful feature.
The foundation for this has already been put into place with 9b21d3f and 0dedbe7, which add the --filter and --chapter-filter cmdline options. These allow users to specify their own Python expressions to filter out images for which the expression evaluates to False. The available variable/keyword names for a specific URL can be looked up using -K or -j.
For example, to only download chapter 3 to 5 in English: gallery-dl --chapter-filter "lang == 'en' and 3 <= chapter <= 5" https://bato.to/comic/_/comics/fury-r12548
These user-specified Python expression are currently evaluated using the builtin eval function, which is generally considered unsafe for input from untrusted sources (Eval really is dangerous), but that shouldn't be an issue for this particular use-case (unless someone has a good argument against using it). On the plus side: eval is a lot faster and more powerful then for example youtube-dl's --match-filter, but there are probably good reasons why youtube-dl doesn't use eval for their filter implementation.
Todo:
Implement --filter and --chapter-filter
Provide manga-chapter metadata
Decide on sensible globals for filter expressions
The text was updated successfully, but these errors were encountered:
Selecting only a certain type/volume/etc of manga chapters has been asked about a couple of times (#25, #11 (comment)) and using metadata, which is usually only used to build filenames, to select/filter images or image-groups seems like a generally useful feature.
The foundation for this has already been put into place with 9b21d3f and 0dedbe7, which add the
--filter
and--chapter-filter
cmdline options. These allow users to specify their own Python expressions to filter out images for which the expression evaluates toFalse
. The available variable/keyword names for a specific URL can be looked up using-K
or-j
.For example, to only download chapter 3 to 5 in English:
gallery-dl --chapter-filter "lang == 'en' and 3 <= chapter <= 5" https://bato.to/comic/_/comics/fury-r12548
These user-specified Python expression are currently evaluated using the builtin eval function, which is generally considered unsafe for input from untrusted sources (Eval really is dangerous), but that shouldn't be an issue for this particular use-case (unless someone has a good argument against using it). On the plus side:
eval
is a lot faster and more powerful then for example youtube-dl's--match-filter
, but there are probably good reasons why youtube-dl doesn't useeval
for their filter implementation.Todo:
--filter
and--chapter-filter
globals
for filter expressionsThe text was updated successfully, but these errors were encountered: