Skip to content

Commit

Permalink
merge #6328: [vk] add 'offset' option
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 17, 2024
2 parents 4667833 + 0e4e40c commit 9751b71
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4698,6 +4698,16 @@ Description
or `cookies <extractor.*.cookies_>`__


extractor.vk.offset
-------------------
Type
``integer``
Default
``0``
Description
Custom ``offset`` starting value when paginating over image results.


extractor.vsco.include
----------------------
Type
Expand Down
9 changes: 8 additions & 1 deletion gallery_dl/extractor/vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class VkExtractor(Extractor):
root = "https://vk.com"
request_interval = (0.5, 1.5)

def _init(self):
self.offset = text.parse_int(self.config("offset"))

def skip(self, num):
self.offset += num
return num

def items(self):
sub = re.compile(r"/imp[fg]/").sub
sizes = "wzyxrqpo"
Expand Down Expand Up @@ -75,7 +82,7 @@ def _pagination(self, photos_id):
"al" : "1",
"direction": "1",
"list" : photos_id,
"offset" : 0,
"offset" : self.offset,
}

while True:
Expand Down

0 comments on commit 9751b71

Please sign in to comment.