Skip to content

Commit

Permalink
[bbc] add 'width' option (#1706)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 29, 2021
1 parent c37c281 commit a316e44
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,19 @@ Description
* ``false``: Get posts from "Latest Updates" pages


extractor.bbc.width
-------------------
Type
``int``
Default
``1920``
Description
Specifies the requested image width.

This value must be divisble by 16 and gets rounded down otherwise.
The maximum possible value appears to be ``1920``.


extractor.blogger.videos
------------------------
Type
Expand Down
3 changes: 3 additions & 0 deletions docs/gallery-dl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"password": null,
"recursive": true
},
"bbc": {
"width": 1920
},
"blogger":
{
"videos": true
Expand Down
6 changes: 5 additions & 1 deletion gallery_dl/extractor/bbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ def metadata(self, page):
}

def images(self, page):
width = self.config("width")
width = width - width % 16 if width else 1920
dimensions = "/{}xn/".format(width)

return [
(src.replace("/320x180_b/", "/1920xn/"), None)
(src.replace("/320x180_b/", dimensions), None)
for src in text.extract_iter(page, 'data-image-src="', '"')
]

Expand Down

0 comments on commit a316e44

Please sign in to comment.