[subscribestar] add 'user-tag' extractor (#8737)

This commit is contained in:
Mike Fährmann
2025-12-21 22:10:17 +01:00
parent 375ab4084b
commit 609e19273d
3 changed files with 54 additions and 17 deletions

View File

@@ -1042,7 +1042,7 @@ Consider all listed sites to potentially be NSFW.
<tr id="subscribestar" title="subscribestar">
<td>SubscribeStar</td>
<td>https://www.subscribestar.com/</td>
<td>Posts, User Profiles</td>
<td>Posts, User Profiles, User Tags</td>
<td>Supported</td>
</tr>
<tr id="sxypix" title="sxypix">

View File

@@ -27,12 +27,12 @@ class SubscribestarExtractor(Extractor):
_warning = True
def __init__(self, match):
tld, self.item = match.groups()
if tld == "adult":
if match[1] == "adult":
self.root = "https://subscribestar.adult"
self.cookies_domain = ".subscribestar.adult"
self.subcategory += "-adult"
Extractor.__init__(self, match)
self.item = match[2]
def items(self):
self.login()
@@ -148,6 +148,21 @@ class SubscribestarExtractor(Extractor):
for cookie in response.cookies
}
def _pagination(self, url, params=None):
needle_next_page = 'data-role="infinite_scroll-next_page" href="'
page = self.request(url, params=params).text
while True:
posts = page.split('<div class="post ')[1:]
if not posts:
return
yield from posts
url = text.extr(posts[-1], needle_next_page, '"')
if not url:
return
page = self.request_json(self.root + text.unescape(url))["html"]
def _media_from_post(self, html):
media = []
@@ -218,6 +233,20 @@ class SubscribestarExtractor(Extractor):
self._warn_preview = util.noop
class SubscribestarUserTagExtractor(SubscribestarExtractor):
"""Extractor for a subscribestar user's tagged posts"""
subcategory = "user-tag"
pattern = rf"{BASE_PATTERN}/(?!posts/)([^/?#]+)\?tag=([^#]+)"
example = "https://www.subscribestar.com/USER?tag=TAG"
def posts(self):
_, user, tag = self.groups
self.kwdict["search_tags"] = tag = text.unquote(tag)
url = f"{self.root}/{user}"
params = {"tag": tag}
return self._pagination(url, params)
class SubscribestarUserExtractor(SubscribestarExtractor):
"""Extractor for media from a subscribestar user"""
subcategory = "user"
@@ -225,19 +254,7 @@ class SubscribestarUserExtractor(SubscribestarExtractor):
example = "https://www.subscribestar.com/USER"
def posts(self):
needle_next_page = 'data-role="infinite_scroll-next_page" href="'
page = self.request(f"{self.root}/{self.item}").text
while True:
posts = page.split('<div class="post ')[1:]
if not posts:
return
yield from posts
url = text.extr(posts[-1], needle_next_page, '"')
if not url:
return
page = self.request_json(self.root + text.unescape(url))["html"]
return self._pagination(f"{self.root}/{self.item}")
class SubscribestarPostExtractor(SubscribestarExtractor):

View File

@@ -13,7 +13,7 @@ __tests__ = (
"#category": ("", "subscribestar", "user"),
"#class" : subscribestar.SubscribestarUserExtractor,
"#pattern" : r"https://(www\.subscribestar\.com/uploads\?payload=.+|(ss-uploads-prod\.b-cdn|\w+\.cloudfront)\.net/uploads(_v2)?/users/11/)",
"#count" : range(15, 25),
"#count" : range(20, 50),
"author_id" : 11,
"author_name": "subscribestar",
@@ -123,4 +123,24 @@ __tests__ = (
"date": "dt:2019-04-28 07:32:00",
},
{
"#url" : "https://www.subscribestar.com/subscribestar?tag=Security",
"#class" : subscribestar.SubscribestarUserTagExtractor,
"#count" : 0,
"#metadata": "post",
"author_id" : 11,
"author_name": "subscribestar",
"author_nick": "SubscribeStar",
"content" : "\n<h1>Enhance Your Account Security with OTP</h1>\n<div>In addition to our existing email-based Two-Factor Authentication (2FA), we encourage everyone to use a more secure and convenient method: One-Time Password (OTP) 2FA using authentication apps like 1Password, Google Authenticator etc. To get started:</div>\n<ol>\n<li>Navigate to <strong>Menu → Account Settings</strong>, scroll down to the Authenticator Apps (OTP 2FA) section.</li>\n<li>Click the \"<strong>Set up OTP</strong>\" button and follow the instructions.<br><br>\n</li>\n</ol>\n<div>The entire process should take less than 5 minutes. You can opt out of using email 2FA then.</div>\n<div><br></div>\n<div><strong>Why Choose OTP 2FA Over Email 2FA?</strong></div>\n<div>\n<strong>Stronger Security</strong>: While email 2FA adds an extra layer of protection, OTP 2FA generates codes directly on your mobile device, reducing the risk associated with email interception or unauthorized access.</div>\n<div>\n<strong>Instant Access</strong>: Authentication apps provide time-sensitive codes without the need for an internet connection or waiting for an email to arrive.</div>\n<div>\n<strong>Enhanced Protection Against Phishing</strong>: OTP codes from authentication apps are less susceptible to phishing attacks compared to email-based codes.</div>\n\n",
"date" : "dt:2024-09-30 20:46:00",
"post_id" : 1320999,
"search_tags": "Security",
"title" : "Enhance Your Account Security with OTP",
"tags" : [
"Security",
"PlatformUpdates",
],
},
)