Skip to content

Commit

Permalink
Update sitePornbox.py
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondpete committed Feb 9, 2024
1 parent 35fa2c8 commit 4a7b813
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Contents/Code/PAsiteList.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
import networkPKJMedia
import networkBellesa
import siteBrandNewAmateurs
import sitePornbox

searchSites = {
0: ('BlackedRaw', 'https://www.blackedraw.com', '/graphql'),
Expand Down Expand Up @@ -1894,6 +1895,7 @@
1798: ('Plants vs Cunts', 'https://plantsvscunts.com', '/?s='),
1799: ('Brand New Amateurs', 'https://brandnewamateurs.com', '/models'),
1800: ('Hot Wives Cheating', 'https://hotwivescheating.com/', '/MemberSceneSearch?q='),
1801: ('Pornbox', 'https://www.pornbox.com', '/autocomplete/'),
}

abbreviations = (
Expand Down Expand Up @@ -2087,6 +2089,7 @@
('^no ', 'NaughtyOffice '),
('^np ', 'NubilesPorn '),
('^nrg ', 'NaughtyRichGirls '),
('^nrx ', 'Pornbox '),
('^nubc ', 'NubilesCasting '),
('^nubet ', 'NubilesET '),
('^nubilef ', 'NubileFilms '),
Expand Down Expand Up @@ -3240,4 +3243,8 @@ def getProviderFromSiteNum(siteNum):
elif siteNum == 1799:
provider = siteBrandNewAmateurs

# Pornbox
elif siteNum == 1801:
provider = sitePornbox

return provider
23 changes: 23 additions & 0 deletions Contents/Code/PAutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,29 @@ def preParseTitle(input):
return output


def cleanSummary(summary):
replace = [(r'“', '\"'), (r'”', '\"'), (r'’', '\''), (r'W/', 'w/'), (r'A\.\sJ\.', 'A.J.'), (r'T\.\sJ\.', 'T.J.'), (r'(?<!\S)AJ(?!\S)', 'A.J.'), ('\xc2\xa0', ' ')]

# Initialize to first word only being capitalized
summary = summary.lower().capitalize()
# Replace common issues
for value in replace:
summary = re.sub(value[0], value[1], summary, flags=re.IGNORECASE)
# Add space after a punctuation if missing
summary = re.sub(r'(?=[\!|\:|\?|\.](?=(\w{1,}))\b)\S(?!(co\b|net\b|com\b|org\b|porn\b|E\d|xxx\b))', lambda m: m.group(0) + ' ', summary, flags=re.IGNORECASE)
# Remove space between word and punctuation
summary = re.sub(r'\s+(?=[.,!:\'\)])', '', summary)
# Remove space between punctuation and word
summary = re.sub(r'(?<=[#\(])\s+', '', summary)
# Override lowercase if word follows a punctuation
summary = re.sub(ur'(?<!vs\.)(?<=!|:|\?|\.)(\s)(\S)', lambda m: m.group(1) + m.group(2).upper(), summary)
# Add period to end of summary if no other punctuation present
if re.search(r'.$(?<=(!|\.|\?))', summary) is None:
summary = summary + '.'

return summary


def manualWordFix(word):
exceptions = (
'im', 'theyll', 'cant', 'ive', 'shes', 'theyre', 'tshirt', 'dont', 'wasnt', 'youre', 'ill', 'whats', 'didnt',
Expand Down
2 changes: 0 additions & 2 deletions Contents/Code/siteAnalVids.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ def search(results, lang, siteNum, searchData):

if sceneID and int(sceneID) == searchResult['source_id']:
score = 100
elif searchData.date:
score = 100 - Util.LevenshteinDistance(searchData.date, releaseDate)
else:
score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

Expand Down
148 changes: 148 additions & 0 deletions Contents/Code/sitePornbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import PAsearchSites
import PAutils


def search(results, lang, siteNum, searchData):
sceneID = None
sourceID = None
parts = searchData.title.split()
if unicode(parts[0], 'UTF-8').isdigit():
sourceID = parts[0]
searchData.title = searchData.title.replace(sourceID, '', 1).strip()

sceneURL = '%s/contents/%s' % (PAsearchSites.getSearchBaseURL(siteNum), sourceID)
curID = PAutils.Encode(sceneURL)

req = PAutils.HTTPRequest(sceneURL)

if req.ok:
scenePageElements = req.json()
titleNoFormatting = PAutils.parseTitle(scenePageElements['scene_name'], siteNum)

date = scenePageElements['publish_date']
if date:
releaseDate = parse(date).strftime('%Y-%m-%d')
else:
releaseDate = searchData.dateFormat() if searchData.date else ''

displayDate = releaseDate if date else ''

score = 100

results.Append(MetadataSearchResult(id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [Pornbox] %s' % (titleNoFormatting, displayDate), score=score, lang=lang))

req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + searchData.title)
searchResults = req.json()

for searchResult in searchResults:
if searchResult['type'] == 'scene':
titleNoFormatting = PAutils.parseTitle(searchResult['name'], siteNum)
match = re.search(r'\w+\d$', titleNoFormatting)
if match:
sceneID = match.group(0)
titleNoFormatting = re.sub(r'\w+\d$', '', titleNoFormatting).strip()
titleNoFormatting = '[%s] %s' % (sceneID, titleNoFormatting)

sceneURL = '%s/contents/%s' % (PAsearchSites.getSearchBaseURL(siteNum), searchResult['source_id'])
curID = PAutils.Encode(sceneURL)

releaseDate = searchData.dateFormat() if searchData.date else ''

if sceneID and sceneID.lower() == searchData.title.lower():
score = 100
elif sourceID and int(sourceID) == searchResult['source_id']:
score = 100
else:
score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

results.Append(MetadataSearchResult(id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [Pornbox]' % (titleNoFormatting), score=score, lang=lang))

return results


def update(metadata, lang, siteNum, movieGenres, movieActors, art):
metadata_id = metadata.id.split('|')
sceneURL = PAutils.Decode(metadata_id[0])
if not sceneURL.startswith('http'):
sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
req = PAutils.HTTPRequest(sceneURL)
detailsPageElements = req.json()

# Title
metadata.title = PAutils.parseTitle(detailsPageElements['scene_name'], siteNum)

# Summary
try:
metadata.summary = PAutils.cleanSummary(detailsPageElements['small_description'])
except:
pass

# Studio
metadata.studio = 'Pornbox'

# Tagline and Collection(s)
tagline = detailsPageElements['studio']
metadata.tagline = tagline
metadata.collections.add(tagline)

# Release Date
date = detailsPageElements['publish_date']
date_object = parse(date)
metadata.originally_available_at = date_object
metadata.year = metadata.originally_available_at.year

# Genres
for genreLink in detailsPageElements['niches']:
genreName = genreLink['niche']

movieGenres.addGenre(genreName)

# Actor(s)
actors = []
if 'models' in detailsPageElements:
actors.extend(detailsPageElements['models'])
if 'male_models' in detailsPageElements:
actors.extend(detailsPageElements['male_models'])
for actorLink in actors:
actorName = actorLink['model_name']
actorPhotoURL = ''

actorPageURL = '%s/model/info/%s' % (PAsearchSites.getSearchBaseURL(siteNum), actorLink['model_id'])
req = PAutils.HTTPRequest(actorPageURL)
actorPageElements = req.json()

if actorPageElements['headshot']:
actorPhotoURL = actorPageElements['headshot']

movieActors.addActor(actorName, actorPhotoURL)

# Posters/Background
art.append(detailsPageElements['player_poster'])

for x in range(1, len(detailsPageElements['screenshots'])):
# Only grab every 10th image for videos with over 50 images
if len(detailsPageElements['screenshots']) > 50 and x % 10 == 0:
art.append(detailsPageElements['screenshots'][x]['xga_size'])
elif len(detailsPageElements['screenshots']) <= 50:
art.append(detailsPageElements['screenshots'][x]['xga_size'])

Log('Artwork found: %d' % len(art))
for idx, posterUrl in enumerate(art, 1):
if not PAsearchSites.posterAlreadyExists(posterUrl, metadata):
# Download image file for analysis
try:
image = PAutils.HTTPRequest(posterUrl)
im = StringIO(image.content)
resized_image = Image.open(im)
width, height = resized_image.size
# Add the image proxy items to the collection
if width > 1:
# Item is a poster
metadata.posters[posterUrl] = Proxy.Media(image.content, sort_order=idx)
if width > 100:
# Item is an art item
metadata.art[posterUrl] = Proxy.Media(image.content, sort_order=idx)
except:
pass

return metadata
2 changes: 2 additions & 0 deletions docs/sitelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ If you're having difficulty finding the SceneID, double-check [PAsiteList.py](..
- Forbidden Fruits Films
- Horny Household
- Hot Wife Fun
- Hot Wives Cheating
- JaysPOV
- Joanna Angel
- Jodi West
Expand Down Expand Up @@ -1048,6 +1049,7 @@ If you're having difficulty finding the SceneID, double-check [PAsiteList.py](..
- SlutsAroundTown
+ #### Playboy Plus | ✅
+ #### PlumperPass | ✅
+ #### Pornbox | ✅
+ #### PornCZ | ✓ - **Title or Actor**
- Amateri Premium
- Amateur From Bohemia
Expand Down

0 comments on commit 4a7b813

Please sign in to comment.