Skip to content

Support negative indices with --range and --chapter-range (#5402) - #7605

Open
thatDudo wants to merge 6636 commits into
mikf:masterfrom
thatDudo:negative_indices
Open

Support negative indices with --range and --chapter-range (#5402)#7605
thatDudo wants to merge 6636 commits into
mikf:masterfrom
thatDudo:negative_indices

Conversation

@thatDudo

Copy link
Copy Markdown
Contributor

It seems it wasnt possible to download just the last pages of each chapter.
I have looked through the code and the main difficulty is that _kwdict["count"] is not always defined if the chapter extractor is returning an iterator rather than a list.
If that is the case, it will treat -n:-m as (0,sys.maxsize).

If you want I can cache some of the results rather than recalculating them on each call.

Fixes #5402

mikf and others added 30 commits March 12, 2025 17:07
rename 'tag_names' to 'tags'
allow legacy domains by default
* [arca.live] Add extractor skeleton

* [arcalive] update names and formatting

* [arcalive] implement initial file extraction code

* [arcalive] improve '_extract_media()' performance

compile and cache regex on demand

* [arcalive] improve image extraction

- extract 'data-originalurl' URLs if available
- replace URL query strings with 'type=orig'
- ignore emoticons by default

* [arcalive] update defaults

- include 'title' in filenames
- use 0.5-1.5s delay between requests

* [arcalive] use ext from 'data-orig' if available

* [arcalive] update docs/supportedsites

* [arcalive] add tests

* [arcalive] update 'board' extractor pattern

so it doesn't also match 'post' URLs

---------

Co-authored-by: Mike Fährmann <mike_faehrmann@web.de>
follow redirect instead of rewriting them to deviantart.com/stash/…
…f links

[tiktok] Move avatar download to the user extractor, which results in more accurate metadata output (it would previously write the metadata of the video which the avatar was scraped from)
[tiktok] Fix tests and remove redundant user profile test
[DeviantArt] Adding support for sub-folders
add 'archives' option for additional data
mikf and others added 24 commits May 24, 2025 22:12
to prevent "403 Forbidden" errors when downloading
don't use a hardcoded '.part' filename extension

fixes regression introduced in 29d315e
Make Extractor.request(…, fatal=False) actually non-fatal
by returning an empty response instead of raising an exception
when a request fails due to connection issues.
category changes:

- kemonoparty -> kemono
- coomerparty -> coomer
- koharu      -> schalenetwork

also wanted to rename '2chan' -> 'sturdychan',
but the site's main page is still titled '2chen'
primarily to achieve some form of backwards compatibility for
922c296
@thatDudo

Copy link
Copy Markdown
Contributor Author

I suppose it might have been possible to do this with filter predicates by using page and count.

@mikf

mikf commented Jun 2, 2025

Copy link
Copy Markdown
Owner

Another problem is that count does not always represent the total number of files. For other sites, e.g. Twitter / Instagram / anything with posts, it is used for the number of files per post.

It also doesn't work for --chapter-range, as it might represent the count value of the current chapter and not the total number of chapters.

We should introduce a new field that either holds the total number of files / items (total, count_total ?) or a boolean value indicating if count can be used as total number of items.

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

Successfully merging this pull request may close these issues.

Support negative indexes in --range slices