[imagetwist:gallery] support 'page' URLs (#8826)
This commit is contained in:
@@ -226,9 +226,10 @@ class ImagetwistGalleryExtractor(ImagehostImageExtractor):
|
||||
"""Extractor for galleries from imagetwist.com"""
|
||||
category = "imagetwist"
|
||||
subcategory = "gallery"
|
||||
pattern = (r"(?:https?://)?((?:www\.|phun\.)?"
|
||||
r"image(?:twist|haha)\.com/(p/[^/?#]+/\d+))")
|
||||
example = "https://imagetwist.com/p/USER/12345/NAME"
|
||||
pattern = (r"(?:https?://)?((?:www\.|phun\.)?image(?:twist|haha)\.com/("
|
||||
r"p/[^/?#]+/\d+|"
|
||||
r"\?[^#]*\bfld_id=\d+[^#]*&page=\d+))")
|
||||
example = "https://imagetwist.com/p/USER/12345/TITLE"
|
||||
|
||||
def items(self):
|
||||
url = self.page_url
|
||||
@@ -237,6 +238,7 @@ class ImagetwistGalleryExtractor(ImagehostImageExtractor):
|
||||
|
||||
while True:
|
||||
page = self.request(url).text
|
||||
|
||||
gallery = text.extr(page, 'class="gallerys', "</div")
|
||||
for path in text.extract_iter(gallery, ' href="', '"'):
|
||||
yield Message.Queue, root + path, data
|
||||
|
||||
@@ -75,4 +75,13 @@ __tests__ = (
|
||||
"#count" : 100,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imagetwist.com/?op=user_public&per_page=40&fld_id=806105&usr_login=gdldev&page=2",
|
||||
"#comment" : "'page=' URL (#8826)",
|
||||
"#category": ("imagehost", "imagetwist", "gallery"),
|
||||
"#class" : imagehosts.ImagetwistGalleryExtractor,
|
||||
"#pattern" : imagehosts.ImagetwistImageExtractor.pattern,
|
||||
"#count" : 60,
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user