[bbc] add 'width' option (#1706)
This commit is contained in:
parent
c37c2818fb
commit
a316e44f8e
@ -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
|
||||
|
@ -41,6 +41,9 @@
|
||||
"password": null,
|
||||
"recursive": true
|
||||
},
|
||||
"bbc": {
|
||||
"width": 1920
|
||||
},
|
||||
"blogger":
|
||||
{
|
||||
"videos": true
|
||||
|
@ -49,8 +49,12 @@ class BbcGalleryExtractor(GalleryExtractor):
|
||||
}
|
||||
|
||||
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="', '"')
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user