[imagetwist:gallery] support 'page' URLs (#8826)
This commit is contained in:
@@ -226,9 +226,10 @@ class ImagetwistGalleryExtractor(ImagehostImageExtractor):
|
|||||||
"""Extractor for galleries from imagetwist.com"""
|
"""Extractor for galleries from imagetwist.com"""
|
||||||
category = "imagetwist"
|
category = "imagetwist"
|
||||||
subcategory = "gallery"
|
subcategory = "gallery"
|
||||||
pattern = (r"(?:https?://)?((?:www\.|phun\.)?"
|
pattern = (r"(?:https?://)?((?:www\.|phun\.)?image(?:twist|haha)\.com/("
|
||||||
r"image(?:twist|haha)\.com/(p/[^/?#]+/\d+))")
|
r"p/[^/?#]+/\d+|"
|
||||||
example = "https://imagetwist.com/p/USER/12345/NAME"
|
r"\?[^#]*\bfld_id=\d+[^#]*&page=\d+))")
|
||||||
|
example = "https://imagetwist.com/p/USER/12345/TITLE"
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
url = self.page_url
|
url = self.page_url
|
||||||
@@ -237,6 +238,7 @@ class ImagetwistGalleryExtractor(ImagehostImageExtractor):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
page = self.request(url).text
|
page = self.request(url).text
|
||||||
|
|
||||||
gallery = text.extr(page, 'class="gallerys', "</div")
|
gallery = text.extr(page, 'class="gallerys', "</div")
|
||||||
for path in text.extract_iter(gallery, ' href="', '"'):
|
for path in text.extract_iter(gallery, ' href="', '"'):
|
||||||
yield Message.Queue, root + path, data
|
yield Message.Queue, root + path, data
|
||||||
|
|||||||
@@ -75,4 +75,13 @@ __tests__ = (
|
|||||||
"#count" : 100,
|
"#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