Skip to content

Commit 0426bb4

Browse files
committed
fix: update HTML structure
From //div[@Class='album-photo my-2'] to //div[contains(@Class,"album-photo")]
1 parent 8e8a313 commit 0426bb4

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

v2dl/scraper/core.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ async def process_page_links(
8484
class ImageScraper(BaseScraper[ImageResult]):
8585
"""Strategy for scraping album image pages."""
8686

87-
XPATH_ALBUM = '//div[@class="album-photo my-2"]/img/@data-src'
88-
XPATH_ALTS = '//div[@class="album-photo my-2"]/img/@alt'
87+
XPATH_ALBUM = '//div[contains(@class,"album-photo")]/img/@data-src'
88+
XPATH_ALTS = '//div[contains(@class,"album-photo")]/img/@alt'
8989
XPATH_VIP = ""
9090

9191
def __init__(self, config: Config, album_tracker: AlbumTracker) -> None:
@@ -209,11 +209,5 @@ async def process_page_links(
209209
)
210210

211211
def get_available_images(self, tree: html.HtmlElement) -> list[bool]:
212-
album_photos = tree.xpath("//div[@class='album-photo my-2']")
213-
image_status = [False] * len(album_photos)
214-
215-
for i, photo in enumerate(album_photos):
216-
if photo.xpath(".//img[@data-src]"):
217-
image_status[i] = True
218-
219-
return image_status
212+
album_photos = tree.xpath('//div[contains(@class,"album-photo")][.//img[@data-src]]')
213+
return [True] * len(album_photos)

0 commit comments

Comments
 (0)