Skip to content

Commit

Permalink
Fix JavDatabase Actor Search
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondpete committed Sep 19, 2023
1 parent b1e5b7c commit b134f66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Contents/Code/PAactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,16 @@ def getFromJAVDatabase(actorName, actorEncoded, metadata):
req = PAutils.HTTPRequest('https://www.javdatabase.com/?wpessid=391488&s=' + actorEncoded)

actorSearch = HTML.ElementFromString(req.text)
results = actorSearch.xpath('//div[@id="content"]//div[@class="row"]/div')
results = actorSearch.xpath('//div[@class="idol-thumb"]//img[@class]')
lastScore = 100
for actor in results:
actorSeachName = actor.xpath('.//h2/a')[0].text_content().strip().split('(')[0]
actorSeachName = actor.xpath('./@alt')[0].strip()

score = Util.LevenshteinDistance(actorName, actorSeachName)

if score < lastScore or not actorPhotoURL:
lastScore = score
actorPhotoURL = actor.xpath('.//@src')[0]
actorPhotoURL = actor.xpath('./@data-src')[0]

req = PAutils.HTTPRequest(actorPhotoURL)
if 'unknown.' in req.url:
Expand Down

0 comments on commit b134f66

Please sign in to comment.