summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/imgbb.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2020-04-29 17:42:33 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2020-04-29 17:42:33 -0400
commitd5b96ce44b7809f5ae01e3e9d70a1d58fe21ccf5 (patch)
tree1302b36780656b71ccb4aebda4f7ea1e2c744e52 /gallery_dl/extractor/imgbb.py
parentcf188f30e1c27bdb900fa2623a9ff91b944633b2 (diff)
New upstream version 1.13.5upstream/1.13.5
Diffstat (limited to 'gallery_dl/extractor/imgbb.py')
-rw-r--r--gallery_dl/extractor/imgbb.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/gallery_dl/extractor/imgbb.py b/gallery_dl/extractor/imgbb.py
index d0aa4f2..8d2c937 100644
--- a/gallery_dl/extractor/imgbb.py
+++ b/gallery_dl/extractor/imgbb.py
@@ -28,9 +28,17 @@ class ImgbbExtractor(Extractor):
def items(self):
self.login()
- response = self.request(self.page_url, params={"sort": self.sort})
- if response.history and response.url.startswith(self.root):
- raise exception.NotFoundError(self.subcategory)
+
+ url = self.page_url
+ params = {"sort": self.sort}
+ while True:
+ response = self.request(url, params=params, allow_redirects=False)
+ if response.status_code < 300:
+ break
+ url = response.headers["location"]
+ if url.startswith(self.root):
+ raise exception.NotFoundError(self.subcategory)
+
page = response.text
data = self.metadata(page)
first = True
@@ -151,12 +159,15 @@ class ImgbbAlbumExtractor(ImgbbExtractor):
}
def images(self, page):
+ url = text.extract(page, '"og:url" content="', '"')[0]
+ album_id = url.rpartition("/")[2].partition("?")[0]
+
return self._pagination(page, "https://ibb.co/json", {
"from" : "album",
- "albumid" : self.album_id,
+ "albumid" : album_id,
"params_hidden[list]" : "images",
"params_hidden[from]" : "album",
- "params_hidden[albumid]": self.album_id,
+ "params_hidden[albumid]": album_id,
})