Skip to content

Commit e60007a

Browse files
committed
[xasiat] fix 'IndexError' for albums without category (#8569)
1 parent 0e0f446 commit e60007a

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

gallery_dl/extractor/xasiat.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _pagination(self, path, pnum=1):
3838
"block_id": "list_albums_common_albums_list",
3939
"sort_by": "post_date",
4040
"from": pnum,
41-
"_": int(time.time() * 1000)
41+
"_": int(time.time() * 1000),
4242
}
4343

4444
page = self.request(url, params=params).text
@@ -66,15 +66,14 @@ def items(self):
6666
images = extr('class="images"', "</div>")
6767

6868
urls = list(text.extract_iter(images, 'href="', '"'))
69-
69+
categories = text.re(r'categories/[^"]+\">\s*(.+)\s*</a').findall(info)
7070
data = {
7171
"title": text.unescape(title),
7272
"model": text.re(
7373
r'top_models1"></i>\s*(.+)\s*</span').findall(info),
7474
"tags": text.re(
7575
r'tags/[^"]+\">\s*(.+)\s*</a').findall(info),
76-
"album_category": text.re(
77-
r'categories/[^"]+\">\s*(.+)\s*</a').findall(info)[0],
76+
"album_category": categories[0] if categories else "",
7877
"album_url": response.url,
7978
"album_id": text.parse_int(album_id),
8079
"count": len(urls),

test/results/xasiat.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@
5858
],
5959
},
6060

61+
{
62+
"#url" : "https://www.xasiat.com/albums/30478/gekkan-young-magazine-2025-no-11/",
63+
"#comment" : "no 'album_category' (#8569)",
64+
"#class" : xasiat.XasiatAlbumExtractor,
65+
"#pattern" : r"https://www\.xasiat\.com/get_image/\d+/\w+",
66+
"#count" : 13,
67+
68+
"album_category": "",
69+
"album_id" : 30478,
70+
"album_url" : "https://www.xasiat.com/albums/30478/gekkan-young-magazine-2025-no-11/",
71+
"count" : 13,
72+
"extension" : "jpg",
73+
"model" : [],
74+
"title" : "[Gekkan Young Magazine] 2025 No.11",
75+
"tags" : [
76+
"Young Magazine",
77+
"Teen",
78+
],
79+
},
80+
6181
{
6282
"#url" : "https://www.xasiat.com/albums/categories/gravure-idols/",
6383
"#class" : xasiat.XasiatCategoryExtractor,

0 commit comments

Comments
 (0)