Skip to content

Commit 63f82c8

Browse files
slr
1 parent 59aa802 commit 63f82c8

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Contents/Code/siteSexLikeReal.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,51 @@ def update(metadata, lang, siteNum, movieGenres, movieActors, movieCollections,
4545
metadata.title = detailsPageElements.xpath('//h1')[0].text_content().strip()
4646

4747
# Summary
48-
maybeSummary = detailsPageElements.xpath('//div[contains(@class, "u-lh--opt u-fs--fo u-wh")]')
49-
if maybeSummary and len(maybeSummary) == 1:
50-
metadata.summary = maybeSummary[0].text_content().strip()
48+
maybeSummary = detailsPageElements.xpath('//p[contains(@class, "_s1jg1wcd75")]')
49+
if maybeSummary and len(maybeSummary) > 0:
50+
summary = []
51+
for summaryPart in maybeSummary:
52+
summaryText = summaryPart.text_content().strip()
53+
if 'Video specifications' not in summaryText:
54+
summary.append(summaryText)
55+
metadata.summary = '\n'.join(summary)
5156

5257
# Studio
53-
metadata.studio = detailsPageElements.xpath('//div[contains(@class, "u-inline-block u-align-y--m u-relative u-fw--bold")]')[0].text_content().strip()
58+
metadata.studio = detailsPageElements.xpath('//a[contains(@class, "_euacs6n160")]')[0].text_content().strip()
5459

5560
# Tagline and Collection(s)
5661
movieCollections.addCollection(metadata.studio)
5762

5863
# Release Date
59-
maybeDate = detailsPageElements.xpath('//div[contains(@class, "u-flex u-flex-wrap u-align-i--center u-fs--fo u-dw u-mt--three u-flex-grow--one desktop:u-mt--four desktop:u-fs--si")]/time/@datetime')[0]
64+
maybeDate = detailsPageElements.xpath('//p[contains(@class, "_38471wcd31")]/time/@datetime')[0]
6065
if maybeDate:
6166
date_object = parse(maybeDate)
6267
metadata.originally_available_at = date_object
6368
metadata.year = metadata.originally_available_at.year
64-
else:
65-
date = detailsPageElements.xpath('//time[contains(@class, "u-inline-block u-align-y--m")]/@datetime')[0]
66-
date_object = parse(date)
67-
metadata.originally_available_at = date_object
68-
metadata.year = metadata.originally_available_at.year
6969

7070
# Genres
71-
for genreName in detailsPageElements.xpath('//meta[@property="video:tag"]/@content'):
72-
movieGenres.addGenre(genreName)
71+
for genreName in detailsPageElements.xpath('//a[contains(@class, "_1xdu1wcd88 ")]/span'):
72+
movieGenres.addGenre(genreName.text_content().strip())
7373

7474
# Actor(s)
75-
actors = detailsPageElements.xpath('//meta[@property="video:actor"]/@content')
76-
for actorName in actors:
77-
actorLink = '/pornstars/' + actorName.replace(' ', '-').lower()
75+
actors = detailsPageElements.xpath('//a[contains(@class, "_n7wm1ua719")]')
76+
for actor in actors:
77+
actorName = actor.text_content().strip()
78+
actorLink = actor.xpath('./@href')[0]
7879
actorPageURL = PAsearchSites.getSearchBaseURL(siteNum) + actorLink
7980

8081
req = PAutils.HTTPRequest(actorPageURL)
8182
actorPage = HTML.ElementFromString(req.text)
82-
actorPhotoURL = actorPage.xpath('//div[@class="u-ratio u-ratio--top u-ratio--model u-radius--two u-mb--four"]/img/@src')[0]
83-
83+
actorPhotoURL = ''
84+
maybeActorPhotoURL = actorPage.xpath('//div[contains(@class, "_z763mqyu24 avatar avatar-size-32 outlined")]/img/@src')
85+
if len(maybeActorPhotoURL) > 0:
86+
actorPhotoURL = maybeActorPhotoURL[0]
8487
movieActors.addActor(actorName, actorPhotoURL)
8588

8689
# Posters/Background
8790
xpaths = [
8891
'//meta[@property="og:image"]/@content',
89-
'//a[contains(@class, "u-ratio--lightbox")]/@href',
92+
'//img[contains(@class, "_30hk1wta22")]/@src',
9093
]
9194

9295
for xpath in xpaths:
@@ -98,7 +101,7 @@ def update(metadata, lang, siteNum, movieGenres, movieActors, movieCollections,
98101
if not PAsearchSites.posterAlreadyExists(posterUrl, metadata):
99102
# Download image file for analysis
100103
try:
101-
image = PAutils.HTTPRequest(posterUrl)
104+
image = PAutils.HTTPRequest(posterUrl.replace('.webp', '.jpg'))
102105
im = StringIO(image.content)
103106
resized_image = Image.open(im)
104107
width, height = resized_image.size

0 commit comments

Comments
 (0)