Skip to content

Commit 991fe0f

Browse files
vorsatilemikf
andauthored
[aryion] add 'search' extractor (#8567)
* [aryion] Implement search extractor. * [aryion] Update capabilities. * [aryion] Adjust example. * fix flake8 errors * update & simplify - use existing '_pagination_next()' - remove '_pagination_search()' - update 'search[…]' metadata * add tests --------- Co-authored-by: Mike Fährmann <[email protected]>
1 parent e60007a commit 991fe0f

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

docs/supportedsites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Consider all listed sites to potentially be NSFW.
280280
<tr id="aryion" title="aryion">
281281
<td>Eka's Portal</td>
282282
<td>https://aryion.com/</td>
283-
<td>Favorites, Galleries, Posts, Tag Searches</td>
283+
<td>Favorites, Galleries, Posts, Search Results, Tag Searches</td>
284284
<td>Supported</td>
285285
</tr>
286286
<tr id="erome" title="erome">

gallery_dl/extractor/aryion.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,31 @@ def posts(self):
234234
return self._pagination_params(url, self.params)
235235

236236

237+
class AryionSearchExtractor(AryionExtractor):
238+
"""Extractor for searches on eka's portal"""
239+
subcategory = "search"
240+
directory_fmt = ("{category}", "searches", "{search[prefix]:?/_/}"
241+
"{search[q]|search[tags]|search[user]}")
242+
archive_fmt = ("s_{search[prefix]:?/_/}"
243+
"{search[q]|search[tags]|search[user]}_{id}")
244+
pattern = rf"{BASE_PATTERN}/search\.php\?([^#]+)"
245+
example = "https://aryion.com/g4/search.php?q=TEXT&tags=TAGS&user=USER"
246+
247+
def metadata(self):
248+
self.params = params = text.parse_query(self.user)
249+
250+
return {"search": {
251+
**params,
252+
"prefix": ("" if params.get("q") else
253+
"t" if params.get("tags") else
254+
"u" if params.get("user") else ""),
255+
}}
256+
257+
def posts(self):
258+
url = f"{self.root}/g4/search.php?{text.build_query(self.params)}"
259+
return self._pagination_next(url)
260+
261+
237262
class AryionPostExtractor(AryionExtractor):
238263
"""Extractor for individual posts on eka's portal"""
239264
subcategory = "post"

test/results/aryion.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,44 @@
9494
"#count" : 2,
9595
},
9696

97+
{
98+
"#url" : "https://aryion.com/g4/search.php?q=forest1",
99+
"#class" : aryion.AryionSearchExtractor,
100+
"#results" : (
101+
"https://aryion.com/g4/data.php?id=165068",
102+
"https://aryion.com/g4/data.php?id=165069",
103+
"https://aryion.com/g4/data.php?id=165070",
104+
"https://aryion.com/g4/data.php?id=165071",
105+
"https://aryion.com/g4/data.php?id=165064",
106+
),
107+
108+
"search" : {
109+
"prefix": "",
110+
"q" : "forest1",
111+
},
112+
},
113+
114+
{
115+
"#url" : "https://aryion.com/g4/search.php?q=&tags=water%2C+&type_search=&user=&from_date=04%2F01%2F2025&to_date=07%2F01%2F2025&sort=view_count&p=2",
116+
"#class" : aryion.AryionSearchExtractor,
117+
"#range" : "1-3",
118+
"#results" : (
119+
"https://aryion.com/g4/data.php?id=1134439",
120+
"https://aryion.com/g4/data.php?id=1124899",
121+
"https://aryion.com/g4/data.php?id=1133691",
122+
),
123+
124+
"search" : {
125+
"from_date" : "04/01/2025",
126+
"p" : "2",
127+
"prefix" : "t",
128+
"q" : "",
129+
"sort" : "view_count",
130+
"tags" : "water, ",
131+
"to_date" : "07/01/2025",
132+
"type_search": "",
133+
"user" : "",
134+
},
135+
},
136+
97137
)

0 commit comments

Comments
 (0)