[chevereto] combine 'image' & 'video' extractors into a 'file' extractor
This commit is contained in:
@@ -1360,19 +1360,19 @@ Consider all listed sites to potentially be NSFW.
|
||||
<tr id="jpgfish" title="jpgfish">
|
||||
<td>JPG Fish</td>
|
||||
<td>https://jpg7.cr/</td>
|
||||
<td>Albums, Categories, individual Images, User Profiles, Videos</td>
|
||||
<td>Albums, Categories, Files, User Profiles</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="imagepond" title="imagepond">
|
||||
<td>ImagePond</td>
|
||||
<td>https://imagepond.net/</td>
|
||||
<td>Albums, Categories, individual Images, User Profiles, Videos</td>
|
||||
<td>Albums, Categories, Files, User Profiles</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="imglike" title="imglike">
|
||||
<td>Nude Celeb</td>
|
||||
<td>https://imglike.com/</td>
|
||||
<td>Albums, Categories, individual Images, User Profiles, Videos</td>
|
||||
<td>Albums, Categories, Files, User Profiles</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -98,10 +98,10 @@ BASE_PATTERN = CheveretoExtractor.update({
|
||||
})
|
||||
|
||||
|
||||
class CheveretoImageExtractor(CheveretoExtractor):
|
||||
"""Extractor for chevereto images"""
|
||||
subcategory = "image"
|
||||
pattern = BASE_PATTERN + r"(/im(?:g|age)/[^/?#]+)"
|
||||
class CheveretoFileExtractor(CheveretoExtractor):
|
||||
"""Extractor for chevereto files"""
|
||||
subcategory = "file"
|
||||
pattern = BASE_PATTERN + r"(/(?:im(?:g|age)|video)/[^/?#]+)"
|
||||
example = "https://jpg7.cr/img/TITLE.ID"
|
||||
|
||||
def items(self):
|
||||
@@ -109,76 +109,67 @@ class CheveretoImageExtractor(CheveretoExtractor):
|
||||
page = self.request(url).text
|
||||
extr = text.extract_from(page)
|
||||
|
||||
type = text.extr(page, 'property="og:type" content="', '"')
|
||||
title = extr('property="og:title" content="', '"')
|
||||
url = (extr('<meta property="og:image" content="', '"') or
|
||||
extr('url: "', '"'))
|
||||
if not url or url.endswith("/loading.svg"):
|
||||
pos = page.find(" download=")
|
||||
url = text.rextr(page, 'href="', '"', pos)
|
||||
if not url.startswith("https://"):
|
||||
url = util.decrypt_xor(
|
||||
url, b"seltilovessimpcity@simpcityhatesscrapers",
|
||||
fromhex=True)
|
||||
|
||||
album_url, _, album_name = extr("Added to <a", "</a>").rpartition(">")
|
||||
file = {
|
||||
"id" : self.path.rpartition("/")[2].rpartition(".")[2],
|
||||
"url" : url,
|
||||
"title": text.unescape(title),
|
||||
"album": text.remove_html(album_name),
|
||||
"date" : self.parse_datetime_iso(extr('<span title="', '"')),
|
||||
"user" : extr('username: "', '"'),
|
||||
}
|
||||
if type == "video":
|
||||
file = {
|
||||
"id" : self.path.rpartition(".")[2],
|
||||
"type" : "video",
|
||||
"title" : text.unescape(extr(
|
||||
'property="og:title" content="', '"')),
|
||||
"thumbnail": extr(
|
||||
'property="og:image" content="', '"'),
|
||||
"url" : extr(
|
||||
'property="og:video" content="', '"'),
|
||||
"width" : text.parse_int(extr(
|
||||
'property="video:width" content="', '"')),
|
||||
"height" : text.parse_int(extr(
|
||||
'property="video:height" content="', '"')),
|
||||
"duration" : extr(
|
||||
'class="far fa-clock"></i>', "—"),
|
||||
"album" : extr(
|
||||
"Added to <a", "</a>"),
|
||||
"date" : self.parse_datetime_iso(extr(
|
||||
'<span title="', '"')),
|
||||
"user" : extr('username: "', '"'),
|
||||
}
|
||||
|
||||
file["album_slug"], _, file["album_id"] = text.rextr(
|
||||
album_url, "/", '"').rpartition(".")
|
||||
album_url, _, album_name = file["album"].rpartition(">")
|
||||
file["album"] = text.remove_html(album_name)
|
||||
file["album_slug"], _, file["album_id"] = text.rextr(
|
||||
album_url, "/", '"').rpartition(".")
|
||||
|
||||
text.nameext_from_url(file["url"], file)
|
||||
yield Message.Directory, "", file
|
||||
yield Message.Url, file["url"], file
|
||||
try:
|
||||
min, _, sec = file["duration"].partition(":")
|
||||
file["duration"] = int(min) * 60 + int(sec)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
url = (extr('<meta property="og:image" content="', '"') or
|
||||
extr('url: "', '"'))
|
||||
if not url or url.endswith("/loading.svg"):
|
||||
pos = page.find(" download=")
|
||||
url = text.rextr(page, 'href="', '"', pos)
|
||||
if not url.startswith("https://"):
|
||||
url = util.decrypt_xor(
|
||||
url, b"seltilovessimpcity@simpcityhatesscrapers",
|
||||
fromhex=True)
|
||||
|
||||
album_url, _, album_name = extr(
|
||||
"Added to <a", "</a>").rpartition(">")
|
||||
file = {
|
||||
"id" : self.path.rpartition("/")[2].rpartition(".")[2],
|
||||
"url" : url,
|
||||
"type" : type,
|
||||
"title": text.unescape(title),
|
||||
"album": text.remove_html(album_name),
|
||||
"date" : self.parse_datetime_iso(extr('<span title="', '"')),
|
||||
"user" : extr('username: "', '"'),
|
||||
}
|
||||
|
||||
class CheveretoVideoExtractor(CheveretoExtractor):
|
||||
"""Extractor for chevereto videos"""
|
||||
subcategory = "video"
|
||||
pattern = BASE_PATTERN + r"(/video/[^/?#]+)"
|
||||
example = "https://imagepond.net/video/TITLE.ID"
|
||||
|
||||
def items(self):
|
||||
url = self.root + self.path
|
||||
page = self.request(url).text
|
||||
extr = text.extract_from(page)
|
||||
|
||||
file = {
|
||||
"id" : self.path.rpartition(".")[2],
|
||||
"title" : text.unescape(extr(
|
||||
'property="og:title" content="', '"')),
|
||||
"thumbnail": extr(
|
||||
'property="og:image" content="', '"'),
|
||||
"url" : extr(
|
||||
'property="og:video" content="', '"'),
|
||||
"width" : text.parse_int(extr(
|
||||
'property="video:width" content="', '"')),
|
||||
"height" : text.parse_int(extr(
|
||||
'property="video:height" content="', '"')),
|
||||
"duration" : extr(
|
||||
'class="far fa-clock"></i>', "—"),
|
||||
"album" : extr(
|
||||
"Added to <a", "</a>"),
|
||||
"date" : self.parse_datetime_iso(extr('<span title="', '"')),
|
||||
"user" : extr('username: "', '"'),
|
||||
}
|
||||
|
||||
album_url, _, album_name = file["album"].rpartition(">")
|
||||
file["album"] = text.remove_html(album_name)
|
||||
file["album_slug"], _, file["album_id"] = text.rextr(
|
||||
album_url, "/", '"').rpartition(".")
|
||||
|
||||
try:
|
||||
min, _, sec = file["duration"].partition(":")
|
||||
file["duration"] = int(min) * 60 + int(sec)
|
||||
except Exception:
|
||||
pass
|
||||
file["album_slug"], _, file["album_id"] = text.rextr(
|
||||
album_url, "/", '"').rpartition(".")
|
||||
|
||||
text.nameext_from_url(file["url"], file)
|
||||
yield Message.Directory, "", file
|
||||
@@ -193,19 +184,16 @@ class CheveretoAlbumExtractor(CheveretoExtractor):
|
||||
|
||||
def items(self):
|
||||
url = self.root + self.path
|
||||
data_image = {"_extractor": CheveretoImageExtractor}
|
||||
data_video = {"_extractor": CheveretoVideoExtractor}
|
||||
data = {"_extractor": CheveretoFileExtractor}
|
||||
|
||||
if self.path.endswith("/sub"):
|
||||
albums = self._pagination(url)
|
||||
else:
|
||||
albums = (url,)
|
||||
|
||||
kwdict = self.kwdict
|
||||
for album in albums:
|
||||
for kwdict["num"], item_url in enumerate(self._pagination(
|
||||
for self.kwdict["num"], item_url in enumerate(self._pagination(
|
||||
album, self._extract_metadata_album), 1):
|
||||
data = data_video if "/video/" in item_url else data_image
|
||||
yield Message.Queue, item_url, data
|
||||
|
||||
def _extract_metadata_album(self, page):
|
||||
@@ -229,7 +217,7 @@ class CheveretoCategoryExtractor(CheveretoExtractor):
|
||||
example = "https://imglike.com/category/TITLE"
|
||||
|
||||
def items(self):
|
||||
data = {"_extractor": CheveretoImageExtractor}
|
||||
data = {"_extractor": CheveretoFileExtractor}
|
||||
for image in self._pagination(self.root + self.path):
|
||||
yield Message.Queue, image, data
|
||||
|
||||
@@ -241,11 +229,8 @@ class CheveretoUserExtractor(CheveretoExtractor):
|
||||
example = "https://jpg7.cr/USER"
|
||||
|
||||
def items(self):
|
||||
data_image = {"_extractor": CheveretoImageExtractor}
|
||||
data_video = {"_extractor": CheveretoVideoExtractor}
|
||||
data_file = {"_extractor": CheveretoFileExtractor}
|
||||
data_album = {"_extractor": CheveretoAlbumExtractor}
|
||||
for url in self._pagination(self.root + self.path):
|
||||
data = (data_album if "/album/" in url else
|
||||
data_video if "/video/" in url else
|
||||
data_image)
|
||||
data = data_album if "/album/" in url else data_file
|
||||
yield Message.Queue, url, data
|
||||
|
||||
@@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto
|
||||
__tests__ = (
|
||||
{
|
||||
"#url" : "https://imagepond.net/image/IMG-20250217-160622.TJNphg",
|
||||
"#category": ("chevereto", "imagepond", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "imagepond", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://media.imagepond.net/media/IMG_20250217_1606226b345a5dbd0e8971.jpg",
|
||||
"#sha1_content": "ec7fac6b427f7af01038619208cd69478e91ddef",
|
||||
|
||||
@@ -20,20 +20,22 @@ __tests__ = (
|
||||
"extension": "jpg",
|
||||
"filename" : "IMG_20250217_1606226b345a5dbd0e8971",
|
||||
"id" : "TJNphg",
|
||||
"title" : "IMG_20250217_160622.jpg",
|
||||
"type" : "image",
|
||||
"url" : "https://media.imagepond.net/media/IMG_20250217_1606226b345a5dbd0e8971.jpg",
|
||||
"user" : "dariusbbb24",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.imagepond.net/image/IMG-20250217-160622.TJNphg",
|
||||
"#category": ("chevereto", "imagepond", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "imagepond", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imagepond.net/video/1000423939.zb8Fxy",
|
||||
"#category": ("chevereto", "imagepond", "video"),
|
||||
"#class" : chevereto.CheveretoVideoExtractor,
|
||||
"#category": ("chevereto", "imagepond", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.mp4",
|
||||
|
||||
"album" : "",
|
||||
@@ -47,6 +49,7 @@ __tests__ = (
|
||||
"id" : "zb8Fxy",
|
||||
"thumbnail": "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.fr.jpeg",
|
||||
"title" : "1000423939",
|
||||
"type" : "video",
|
||||
"url" : "https://media.imagepond.net/media/100042393993a6bfa75fc505e9.mp4",
|
||||
"user" : "christiankita",
|
||||
"width" : 720,
|
||||
|
||||
@@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto
|
||||
__tests__ = (
|
||||
{
|
||||
"#url" : "https://imglike.com/image/EMT-Skills-Verification-by-EMSA.Lx6dT",
|
||||
"#category": ("chevereto", "imglike", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "imglike", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://imglike.com/images/2022/08/12/EMT-Skills-Verification-by-EMSA.gif",
|
||||
|
||||
"album" : "",
|
||||
@@ -25,8 +25,8 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://www.imglike.com/image/EMT-Skills-Verification-by-EMSA.Lx6dT",
|
||||
"#category": ("chevereto", "imglike", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "imglike", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
@@ -59,7 +59,7 @@ __tests__ = (
|
||||
"#url" : "https://imglike.com/category/Bursting-boobs",
|
||||
"#category": ("chevereto", "imglike", "category"),
|
||||
"#class" : chevereto.CheveretoCategoryExtractor,
|
||||
"#pattern" : chevereto.CheveretoImageExtractor.pattern,
|
||||
"#pattern" : chevereto.CheveretoFileExtractor.pattern,
|
||||
"#range" : "1-100",
|
||||
"#count" : 100,
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ from gallery_dl.extractor import chevereto
|
||||
__tests__ = (
|
||||
{
|
||||
"#url" : "https://jpg7.cr/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg",
|
||||
"#sha1_content": "098e5e9b17ad634358426e0ffd1c93871474d13c",
|
||||
|
||||
@@ -23,14 +23,15 @@ __tests__ = (
|
||||
"filename" : "funnymeme",
|
||||
"id" : "LecXGS",
|
||||
"title" : "funnymeme",
|
||||
"type" : "article",
|
||||
"url" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg",
|
||||
"user" : "exearco",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg4.su/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg",
|
||||
|
||||
"album" : "",
|
||||
@@ -45,8 +46,8 @@ __tests__ = (
|
||||
{
|
||||
"#url" : "https://jpg6.su/img/LecXGS/",
|
||||
"#comment" : "image ID without name (#8307)",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://simp3.selti-delivery.ru/images/funnymeme.jpg",
|
||||
"#sha1_content": "098e5e9b17ad634358426e0ffd1c93871474d13c",
|
||||
|
||||
@@ -61,8 +62,8 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://jpg.church/img/auCruA",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://simp2.selti-delivery.ru/hannahowo_00457.jpg",
|
||||
|
||||
"album" : "401-500",
|
||||
@@ -74,50 +75,50 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://jpg1.su/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpeg.pet/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg.pet/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg.fishing/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg.fish/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg.church/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.jpg6.su/img/funnymeme.LecXGS",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://jpg6.su/img/test.NLqFQHc",
|
||||
"#category": ("chevereto", "jpgfish", "image"),
|
||||
"#class" : chevereto.CheveretoImageExtractor,
|
||||
"#category": ("chevereto", "jpgfish", "file"),
|
||||
"#class" : chevereto.CheveretoFileExtractor,
|
||||
"#results" : "https://simp6.selti-delivery.ru/images3/test--2219f2531862b749d5.png",
|
||||
|
||||
"album" : "",
|
||||
|
||||
Reference in New Issue
Block a user