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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="container content"]/div[@class="page-header"]/span[@class="title"]'
    )[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="text-desc"]')[0].text_content().strip()

    # Studio
    metadata.studio = 'Pioneer'

    # Tagline
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.collections.clear()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//div[@class="media-body"]/ul[3]/li/a'):
        genreName = genreLink.text_content()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath(
        '//ul[contains(text(), "Models:")]/li/a')
    if len(actors) > 0:
        if 'p**n-movie' not in sceneURL and len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if 'p**n-movie' not in sceneURL and len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if 'p**n-movie' not in sceneURL and len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.text_content().strip()

            actorPageURL = actorLink.get('href')
            req = PAutils.HTTPRequest(actorPageURL)
            actorPage = HTML.ElementFromString(req.text)
            actorPhotoURL = actorPage.xpath(
                '//div[@class="model-box"]/img/@src')[0]

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = [
        '//img[@class="player-preview"]/@src',
        '(//a[@class="fancybox img-album"] | //a[@data-fancybox-group="gallery"])/@href'
    ]

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            art.append(img)

    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
Example #2
0
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1[@class="title--3"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/p')[0].text_content(
        ).strip()

    # Studio
    metadata.studio = 'SinX'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[2]/div[1]/div[3]/div[1]/ul/li[1]')[0].text_content().strip()
    if date:
        date_object = datetime.strptime(date, '%d %b %Y')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div/section[4]/div/p/a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath(
        '//div[2]/div[2]/div[1]/div[2]/div[1]/div[2]/div/figure/figcaption/h4')
    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.text_content().strip()
            actorPhotoURL = ''

            if len(actors) == 1:
                actorPhotoURL = detailsPageElements.xpath(
                    '//div[2]/div[2]/div[1]/div[2]/div[1]/div[2]/div/figure/div/img/@src'
                )[0]

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = ['//div[2]/div[1]/div[1]/a/div[1]/img/@src']
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    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 and idx > 1:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
Example #3
0
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    art = []

    # Title
    metadata.title = detailsPageElements.xpath(
        '//section[@class="downloads"]/strong')[0].text_content().strip()

    # Summary
    all_summary = detailsPageElements.xpath(
        '//div/section[4]/div')[0].text_content().strip()
    tags_summary = detailsPageElements.xpath(
        '//div/section[4]/div/p')[0].text_content().strip()
    summary = all_summary.replace(tags_summary, '')
    summary = summary.split('Show more...')[0].strip()
    metadata.summary = summary

    # Studio
    metadata.studio = 'VIPissy'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div/section[2]/dl/dd[2]')[0].text_content().strip()
    if date:
        date_object = datetime.strptime(date, '%b %d, %Y')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div/section[4]/div/p/a'):
        genreName = genreLink.text_content().strip().lower()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath('//div/section[2]/dl/dd[1]/a')
    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')
        for actorLink in actors:
            actorName = actorLink.text_content().strip()
            actorPhotoURL = ''

            try:
                actorPageURL = actorLink.get('href')
                if 'http' not in actorPageURL:
                    actorPageURL = PAsearchSites.getSearchBaseURL(
                        siteNum) + actorPageURL

                req = PAutils.HTTPRequest(actorPageURL)
                actorPage = HTML.ElementFromString(req.text)
                actorPhotoURL = actorPage.xpath(
                    '//div/section[1]/div/div[1]/img/@src')[0]
                if 'http' not in actorPhotoURL:
                    actorPhotoURL = PAsearchSites.getSearchBaseURL(
                        siteNum) + actorPhotoURL
            except:
                pass

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = [
        '//div[contains(@id, "pics2")]//div//ul//li//div//div//img/@src',
    ]
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    try:
        twitterBG = 'https://media.vipissy.com/videos%scover/l.jpg' % sceneURL.split(
            '/updates')[1]
        art.imsert(0, twitterBG)
    except:
        pass

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneName = metadata_id[0]
    releaseDate = metadata_id[2]
    contentName = metadata_id[3]

    detailsPageElements = getJSONfromPage(
        PAsearchSites.getSearchSearchURL(siteNum) +
        sceneName)[contentName][sceneName]

    # Title
    metadata.title = detailsPageElements['title']

    # Summary
    metadata.summary = detailsPageElements['description']

    # Studio
    metadata.studio = 'Mylf'

    # Tagline and Collection(s)
    metadata.collections.clear()
    if 'site' in detailsPageElements:
        subSite = detailsPageElements['site']['name']
    else:
        subSite = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = subSite
    metadata.collections.add(subSite)

    # Release Date
    if releaseDate:
        date_object = parse(releaseDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements['models']
    for actorLink in actors:
        actorID = actorLink['modelId']
        actorName = actorLink['modelName']
        actorPhotoURL = ''

        actorData = getJSONfromPage(
            '%s/models/%s' %
            (PAsearchSites.getSearchBaseURL(siteNum), actorID))
        if actorData:
            actorPhotoURL = actorData['modelsContent'][actorID]['img']

        movieActors.addActor(actorName, actorPhotoURL)

    # Genres
    movieGenres.clearGenres()
    genres = ["MILF", "Mature"]

    if subSite.lower() == 'MylfBoss'.lower():
        for genreName in ['Office', 'Boss']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'MylfBlows'.lower():
        for genreName in ['B*****b']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Milfty'.lower():
        for genreName in ['Cheating']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Mom Drips'.lower():
        for genreName in ['Creampie']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Milf Body'.lower():
        for genreName in ['Gym', 'Fitness']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Lone Milf'.lower():
        for genreName in ['Solo']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Full Of JOI'.lower():
        for genreName in ['JOI']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'Mylfed'.lower():
        for genreName in ['Lesbian', 'Girl on Girl', 'GG']:
            movieGenres.addGenre(genreName)
    elif subSite.lower() == 'MylfDom'.lower():
        for genreName in ['BDSM']:
            movieGenres.addGenre(genreName)
    if (len(actors) > 1) and subSite != 'Mylfed':
        genres.append('Threesome')

    for genre in genres:
        movieGenres.addGenre(genre)

    # Posters
    art = [detailsPageElements['img']]

    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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    sceneDate = metadata_id[2]
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)
    photosetPageElements = ''

    if sceneURL.endswith('-2/'):
        photosetURL = sceneURL.replace('-2/', '/')
        req = PAutils.HTTPRequest(photosetURL)
        photosetPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//meta[@property="og:title"]/@content')[0].strip()

    # Summary
    if photosetPageElements:
        description = photosetPageElements.xpath(
            '//div[@class="video-embed"]/p')
        if description:
            metadata.summary = description[0].text_content().replace(
                '<a href="/allfinegirls">18OnlyGirls</a>', '').strip()

    # Studio
    metadata.studio = '18OnlyGirls'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//div[@itemprop="keywords"]//a'):
        genreName = genreLink.text_content().replace('Movies', '').strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath('//div[@itemprop="actor"]//a')

    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = str(actorLink.text_content().strip())
            actorPhotoURL = ''

            actorPageURL = 'https://18onlygirls.tv/models/' + actorName.replace(
                ' ', '-')
            req = PAutils.HTTPRequest(actorPageURL)

            try:
                actorPage = HTML.ElementFromString(req.text)
                actorPhotoURL = actorPage.xpath(
                    '//div[@id="mod_info"]/img/@src')[0]
                if 'http' not in actorPhotoURL:
                    actorPhotoURL = PAsearchSites.getSearchBaseURL(
                        siteNum) + actorPhotoURL
            except:
                pass

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = [
        '//div[contains(@id, "gallery")]//@href',
    ]
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    if photosetPageElements:
        for xpath in xpaths:
            for poster in photosetPageElements.xpath(xpath):
                art.append(poster)

    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,
                                            headers={'Referer': sceneURL})
                im = StringIO(image.content)
                resized_image = Image.open(im)
                width, height = resized_image.size
                # Add the image proxy items to the collection
                if width < height:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneID = metadata_id[0]
    sceneType = metadata_id[2]

    token = get_Token(siteNum)
    headers = {
        'Instance': token,
    }
    url = PAsearchSites.getSearchSearchURL(
        siteNum) + '/v2/releases?type=%s&id=%s' % (sceneType, sceneID)
    req = PAutils.HTTPRequest(url, headers=headers)
    detailsPageElements = req.json()['result'][0]

    # Title
    metadata.title = detailsPageElements['title']

    # Summary
    description = None
    if 'description' in detailsPageElements:
        description = detailsPageElements['description']
    elif 'parent' in detailsPageElements:
        if 'description' in detailsPageElements['parent']:
            description = detailsPageElements['parent']['description']

    if description:
        metadata.summary = description

    # Studio
    metadata.studio = detailsPageElements['brand'].title()

    # Tagline and Collection(s)
    metadata.collections.clear()
    seriesNames = []

    if 'collections' in detailsPageElements and detailsPageElements[
            'collections']:
        for collection in detailsPageElements['collections']:
            seriesNames.append(collection['name'])
    if 'parent' in detailsPageElements:
        if 'title' in detailsPageElements['parent']:
            seriesNames.append(detailsPageElements['parent']['title'])

    isInCollection = False
    siteName = PAsearchSites.getSearchSiteName(siteNum).lower().replace(
        ' ', '').replace('\'', '')
    for seriesName in seriesNames:
        if seriesName.lower().replace(' ', '').replace('\'', '') == siteName:
            isInCollection = True
            break

    if not isInCollection:
        seriesNames.insert(0, PAsearchSites.getSearchSiteName(siteNum))

    for seriesName in seriesNames:
        metadata.collections.add(seriesName)

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

    # Genres
    movieGenres.clearGenres()
    genres = detailsPageElements['tags']
    for genreLink in genres:
        genreName = genreLink['name']

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements['actors']
    for actorLink in actors:
        actorPageURL = PAsearchSites.getSearchSearchURL(
            siteNum) + '/v1/actors?id=%d' % actorLink['id']

        req = PAutils.HTTPRequest(actorPageURL, headers=headers)
        actorData = req.json()['result'][0]

        actorName = actorData['name']
        actorPhotoURL = ''
        if actorData['images'] and actorData['images']['profile']:
            actorPhotoURL = actorData['images']['profile'][0]['xs']['url']

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    for imageType in ['poster', 'cover']:
        if imageType in detailsPageElements['images']:
            for image in detailsPageElements['images'][imageType]:
                art.append(image['xx']['url'])

    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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, lang, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    scenePoster = PAutils.Decode(metadata_id[2])
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1[@class="title"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//p[@class="description-truncated"]')[0].text_content().strip(
        ).replace('...', '', 1)

    # Studio
    metadata.studio = 'Playboy Plus'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//p[contains(@class, "date")]')[0].text_content().strip()
    date_object = datetime.strptime(date, '%B %d, %Y')
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    movieGenres.addGenre('Glamour')

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//p[@class="contributorName"]//a'):
        actorName = actorLink.text_content().strip()
        actorPhotoURL = ''

        movieActors.addActor(actorName, '')

    # Photos
    art = [
        scenePoster,
        detailsPageElements.xpath('//img[contains(@class, "image")]/@data-src')
        [0].split('?', 1)[0]
    ]
    for img in detailsPageElements.xpath(
            '//section[@class="gallery"]//img[contains(@class, "image")]/@data-src'
    ):
        art.append(img.split('?', 1)[0])

    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 or height > width) and width < height:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteID, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if len(metadata_id) > 2:
        sceneDate = metadata_id[2]

    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath('//h3/text()[1]')[0].strip()

    # Summary
    metadata.summary = detailsPageElements.xpath('//meta[@name="description"]/@content')[0].strip()

    # Studio
    metadata.studio = 'ExploitedX'

    # Collections / Tagline
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteID)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    if sceneDate:
        try:
            date_object = parse(sceneDate)
            metadata.originally_available_at = date_object
            metadata.year = metadata.originally_available_at.year
        except:
            pass

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//a[starts-with(@href, "/free/keywords")]'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath('//a[starts-with(@href, "/free/girl/")]'):
        actorLink = actorLink.xpath('./@href')[0].strip()
        actorURL = PAsearchSites.getSearchBaseURL(siteID) + actorLink

        req = PAutils.HTTPRequest(actorURL)
        actorPageElements = HTML.ElementFromString(req.text)
        actorName = actorPageElements.xpath('//meta[@name="twitter:description"]/@content')[0].strip()
        actorPhotoURL = actorPageElements.xpath('//meta[@name="twitter:image"]/@content')[0].strip()

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = [
        '//meta[@name="twitter:image"]/@content',
        '//article[@id="hd-clips"]/div/div/div/a/img/@src',
        '//div[@class="videos box-shadow"]//div/div/a/img/@src',
        '//div[contains(@class, "videos box-shadow")]//div/div/a/img/@src'
    ]

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            if not img.startswith('http'):
                img = PAsearchSites.getSearchBaseURL(siteID) + img

            art.append(img)

    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, headers={'Referer': 'http://www.google.com'})
                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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content, sort_order=idx)
            except:
                pass

    return metadata
Example #9
0
def update(metadata, siteNum, movieGenres, movieActors):
    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 = HTML.ElementFromString(req.text)

    art = []
    movieGenres.clearGenres()
    movieActors.clearActors()

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="main-info-left"]/h1')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//p[@class="description"]')[0].text_content().strip()

    # Studio
    metadata.studio = 'Love Her Feet'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="date"]')[0].text_content().strip()
    if date:
        date_object = datetime.strptime(date, '%B %d, %Y')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div[@class="video-tags"]/a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)
    movieGenres.addGenre('Foot Sex')

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath('//div[@class="featured"]/a')
    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.text_content().strip()
            actorPhotoURL = ''
            try:
                actorPageURL = actorLink.get('href')
                req = PAutils.HTTPRequest(actorPageURL)
                actorPage = HTML.ElementFromString(req.text)
                actorPhotoURL = actorPage.xpath(
                    '//div[@class="picture"]/img')[0].get("src0_3x")
                if 'http' not in actorPhotoURL:
                    actorPhotoURL = PAsearchSites.getSearchBaseURL(
                        siteNum) + actorPhotoURL
            except:
                pass

            movieActors.addActor(actorName, actorPhotoURL)

    # Photos
    art = []
    xpaths = [
        '//meta[@property="og:image"]/@content',
        '//div[@class="photos"]/a/img/@src'
    ]
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//title')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//span[(contains(@class, "latest_update_description"))]'
    )[0].text_content().strip()

    # Studio
    metadata.studio = 'Evolved Fights Network'

    # Studio/Tagline/Collection
    metadata.collections.clear()
    metadata.tagline = metadata.studio
    if Prefs['collections_addsitename']:
        metadata.collections.add(metadata.studio)

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//span[(contains(@class, "tour_update_tags"))]/a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[(contains(@class, "update_block_info model_update_block_info"))]/span[(contains(@class, "tour_update_models"))]/a'
    ):
        actorName = actorLink.text_content().strip()
        actorPageURL = actorLink.get('href')

        req = PAutils.HTTPRequest(actorPageURL)
        actorPage = HTML.ElementFromString(req.text)
        actorPhotoURL = PAsearchSites.getSearchBaseURL(
            siteNum
        ) + actorPage.xpath(
            '//img[(contains(@class, "model_bio_thumb stdimage thumbs target"))]/@src0_3x'
        )[0]

        movieActors.addActor(actorName, actorPhotoURL)

    # Release Date
    date = detailsPageElements.xpath(
        '//span[@class="update_date"]')[0].text_content().strip()
    date_object = datetime.strptime(date, '%m/%d/%Y')
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Posters/Background
    art = []
    poster = PAsearchSites.getSearchBaseURL(
        siteNum) + '/' + detailsPageElements.xpath(
            '//span[(contains(@class, "model_update_thumb"))]/img/@src0_4x')[0]
    art.append(poster)

    poster2 = poster.replace('0-4x', '1-4x')
    art.append(poster2)

    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 and idx > 1:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
Example #11
0
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    sceneDate = metadata_id[2]
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="description"]//p')[0].text_content().strip()

    # Studio
    metadata.studio = PAsearchSites.getSearchSiteName(siteNum)

    # Collections / Tagline
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    genres = detailsPageElements.xpath('//dd[2]')
    for genreLink in detailsPageElements.xpath('//dd[2]'):
        genreName = genreLink.text_content().strip().lower()

        movieGenres.addGenre(genreName)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Actors
    movieActors.clearActors()

    actors = detailsPageElements.xpath('//dd[1]')
    for actorLink in actors:
        actorName = actorLink.xpath('.//a[1]')[0].text_content().strip()
        actorPhotoURL = actorLink.xpath('.//a[2]//img/@src')[0]

        movieActors.addActor(actorName, actorPhotoURL)

        try:
            actorName = actorLink.xpath('.//a[3]')[0].text_content().strip()
            actorPhotoURL = actorLink.xpath('.//a[4]//img/@src')[0]
            movieActors.addActor(actorName, actorPhotoURL)
        except:
            pass

    # Director
    metadata.directors.clear()
    director = metadata.directors.new()
    director.name = 'Charles Dera'

    # Posters
    art = []
    req = PAutils.HTTPRequest(detailsPageElements.xpath('//dd[1]//a/@href')[0])
    posters = HTML.ElementFromString(req.text)
    for poster in posters.xpath('//a[contains(@href, "%s")]//img/@src' %
                                sceneURL):
        art.append(poster)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, lang, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneID = int(metadata_id[0])
    sceneType = metadata_id[2]
    sceneIDName = 'clip_id' if sceneType == 'scenes' else 'movie_id'
    sceneDate = metadata_id[3]

    apiKEY = getAPIKey(siteNum)

    url = PAsearchSites.getSearchSearchURL(
        siteNum
    ) + '?x-algolia-application-id=TSMKFA364Q&x-algolia-api-key=' + apiKEY
    data = getAlgolia(url, 'all_' + sceneType,
                      'filters=%s=%d' % (sceneIDName, sceneID),
                      PAsearchSites.getSearchBaseURL(siteNum))
    detailsPageElements = data[0]

    data = getAlgolia(url, 'all_scenes',
                      'query=%s' % detailsPageElements['url_title'],
                      PAsearchSites.getSearchBaseURL(siteNum))
    data = sorted(data, key=lambda i: i['clip_id'])
    scenesPagesElements = list(enumerate(data, 1))

    # Title
    title = None
    if sceneType == 'scenes' and len(scenesPagesElements) > 1:
        for idx, scene in scenesPagesElements:
            if scene['clip_id'] == sceneID:
                title = '%s, Scene %d' % (detailsPageElements['title'], idx)
                break
    if not title:
        title = detailsPageElements['title']

    metadata.title = title

    # Summary
    metadata.summary = detailsPageElements['description'].replace(
        '</br>', '\n').replace('<br>', '\n')

    # Studio
    metadata.studio = detailsPageElements['network_name']

    # Tagline and Collection(s)
    metadata.collections.clear()
    for collectionName in ['studio_name', 'serie_name']:
        if collectionName in detailsPageElements:
            metadata.collections.add(detailsPageElements[collectionName])
    if (':' in detailsPageElements['title'] or '#'
            in detailsPageElements['title']) and len(scenesPagesElements) > 1:
        if 'movie_title' in detailsPageElements:
            metadata.collections.add(detailsPageElements['movie_title'])

    # Release Date
    date_object = parse(sceneDate)
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements['categories']:
        genreName = genreLink['name']
        if genreName:
            movieGenres.addGenre(genreName)

    if sceneType == 'movies':
        for idx, scene in scenesPagesElements:
            for genreLink in scene['categories']:
                genreName = genreLink['name']
                if genreName:
                    movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    female = []
    male = []
    for actorLink in detailsPageElements['actors']:
        actorName = actorLink['name']

        actorData = getAlgolia(url, 'all_actors',
                               'filters=actor_id=' + actorLink['actor_id'],
                               PAsearchSites.getSearchBaseURL(siteNum))[0]
        if 'pictures' in actorData and actorData['pictures']:
            max_quality = sorted(actorData['pictures'].keys())[-1]
            actorPhotoURL = 'https://images-fame.gammacdn.com/actors' + actorData[
                'pictures'][max_quality]
        else:
            actorPhotoURL = ''

        if actorLink['gender'] == 'female':
            female.append((actorName, actorPhotoURL))
        else:
            male.append((actorName, actorPhotoURL))

    combined = female + male
    for actor in combined:
        movieActors.addActor(actor[0], actor[1])

    # Posters
    art = []

    if not PAsearchSites.getSearchBaseURL(siteNum).endswith(
        ('girlsway.com', 'puretaboo.com')):
        art.append(
            'https://images-fame.gammacdn.com/movies/{0}/{0}_{1}_front_400x625.jpg'
            .format(detailsPageElements['movie_id'],
                    detailsPageElements['url_title'].lower().replace('-',
                                                                     '_')))
        if 'url_movie_title' in detailsPageElements:
            art.append(
                'https://images-fame.gammacdn.com/movies/{0}/{0}_{1}_front_400x625.jpg'
                .format(
                    detailsPageElements['movie_id'],
                    detailsPageElements['url_movie_title'].lower().replace(
                        '-', '_')))

    if 'pictures' in detailsPageElements and detailsPageElements['pictures']:
        max_quality = detailsPageElements['pictures']['nsfw']['top'].keys()[0]
        pictureURL = 'https://images-fame.gammacdn.com/movies/' + detailsPageElements[
            'pictures'][max_quality]

        if sceneType == 'movies':
            art.append(pictureURL)
        else:
            art.insert(0, pictureURL)

    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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(
            siteNum) + '/fintour/' + sceneURL

    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="title_bar"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="gallery_description"]')[0].text_content().strip()

    # Studio
    metadata.studio = 'Desperate Amateurs'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date_object = parse(
        detailsPageElements.xpath('.//td[@class="date"]')
        [0].text_content().strip()[6:])
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//a[starts-with(@href, "sets")]'):
        actorName = actorLink.text_content().strip()

        actorPageURL = PAsearchSites.getSearchBaseURL(
            siteNum) + '/fintour/' + actorLink.xpath('./@href')[0].strip()
        req = PAutils.HTTPRequest(actorPageURL)
        actorPage = HTML.ElementFromString(req.text)
        actorPhotoURL = PAsearchSites.getSearchBaseURL(
            siteNum) + actorPage.xpath('//img[@class="thumbs"]/@src')[0]

        movieActors.addActor(actorName, actorPhotoURL)

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//a[starts-with(@href, "category")]'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Posters
    art = []
    xpaths = [
        '//div[contains(@class, "gal")]//img/@src',
    ]

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            art.append(img)

    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,
                                            headers={'Referer': sceneURL})
                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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//meta[@property="og:title"]/@content')[0].strip()

    # Summary
    summary = detailsPageElements.xpath(
        '//div[@class="record-description-content record-box-content"]'
    )[0].text_content().strip()
    metadata.summary = summary[:summary.find('Runtime')].strip()

    # Studio
    metadata.studio = 'Hegre'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//span[@class="date"]')[0].text_content().strip()
    date_object = parse(date)
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//a[@class="tag"]'):
        genreName = genreLink.text_content().strip().lower()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath('//a[@class="record-model"]')
    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.get('title').strip()
            actorPhotoURL = actorLink.xpath('.//img/@src')[0].replace(
                '240x', '480x')

            movieActors.addActor(actorName, actorPhotoURL)

    # Director
    director = metadata.directors.new()
    director.name = 'Petter Hegre'
    director.photo = 'https://img.discogs.com/TafxhnwJE2nhLodoB6UktY6m0xM=/fit-in/180x264/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/A-2236724-1305622884.jpeg.jpg'

    # Posters
    art = [
        detailsPageElements.xpath('//meta[@name="twitter:image"]/@content')
        [0].replace('board-image', 'poster-image').replace('1600x', '640x'),
        detailsPageElements.xpath('//meta[@name="twitter:image"]/@content')
        [0].replace('1600x', '1920x')
    ]

    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
def update(metadata, siteID, movieGenres, movieActors):
    Log('******UPDATE CALLED*******')

    url = str(metadata.id).split("|")[0].replace('_', '/').replace('!', '?')
    detailsPageElements = HTML.ElementFromURL(url)
    art = []
    metadata.collections.clear()
    movieGenres.clearGenres()
    movieActors.clearActors()

    # Studio
    metadata.studio = "Porndoe Premium"

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1[@class="no-space transform-none"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//meta[@name="description"]')[0].get('content').replace(
            '&#039;', '\'')

    # Tagline and Collection(s)
    tagline = detailsPageElements.xpath(
        '//div[@class="actors"]/h4/a')[0].text_content()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    genres = detailsPageElements.xpath('//a[@class="inline-links"]')
    if len(genres) > 0:
        for genreLink in genres:
            genreName = genreLink.text_content().strip().lower()
            movieGenres.addGenre(genreName)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="h5 h5-published nowrap color-rgba255-06"]'
    )[0].text_content().strip()
    if len(date) > 0:
        date = date.split('•')[-1].strip()
        date_object = datetime.strptime(date, '%d %B %Y')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Actors
    actors = detailsPageElements.xpath('//span[@class="group inline"]/a')
    if len(actors) > 0:
        for actorLink in actors:
            actorPageURL = actorLink.get("href")
            actorPage = HTML.ElementFromURL(actorPageURL)
            actorName = actorPage.xpath(
                '//div[@data-item="c-13 r-11 m-c-15 / middle"]/h1'
            )[0].text_content().strip()
            try:
                actorPhotoURL = actorPage.xpath(
                    '//div[@class="avatar"]/picture[2]/img')[0].get("data-src")
                if 'http' not in actorPhotoURL:
                    actorPhotoURL = PAsearchSites.getSearchBaseURL(
                        siteID) + actorPhotoURL
            except:
                actorPhotoURL = ""
            movieActors.addActor(actorName, actorPhotoURL)

    ### Posters and artwork ###

    # Video trailer background image
    try:
        twitterBG = detailsPageElements.xpath(
            '//picture[@class="poster"]//img')[0].get('src')
        art.append(twitterBG)
    except:
        pass

    # Photos
    photos = detailsPageElements.xpath('//div[@id="gallery-thumbs"]//img')
    if len(photos) > 0:
        for photoLink in photos:
            photo = photoLink.get('src')
            art.append(photo)

    j = 1
    Log("Artwork found: " + str(len(art)))
    for posterUrl in art:
        if not PAsearchSites.posterAlreadyExists(posterUrl, metadata):
            #Download image file for analysis
            try:
                img_file = urllib.urlopen(posterUrl)
                im = StringIO(img_file.read())
                resized_image = Image.open(im)
                width, height = resized_image.size
                #Add the image proxy items to the collection
                if width > 1 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Preview(HTTP.Request(
                        posterUrl,
                        headers={
                            'Referer': 'http://www.google.com'
                        }).content,
                                                                sort_order=j)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Preview(HTTP.Request(
                        posterUrl,
                        headers={
                            'Referer': 'http://www.google.com'
                        }).content,
                                                            sort_order=j)
                j = j + 1
            except:
                pass

    return metadata
Example #16
0
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="videoDetails clear"]/h3')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="videoDetails clear"]/p')[0].text_content().strip()

    # Studio
    metadata.studio = 'BellaPass'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//div[contains(@class, "inner-area")]/div[5]/ul/li'):
        genreName = genreLink.text_content().replace('Tags:', '').strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath(
        '//div[contains(@class, "inner-area")]/div[4]/ul/li[@class="update_models"]/a'
    )
    if actors:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.text_content().strip()

            actorPageURL = actorLink.get('href')
            if actorPageURL.startswith('//'):
                actorPageURL = 'https:' + actorPageURL
            elif not actorPageURL.startswith('http'):
                actorPageURL = PAsearchSites.getSearchBaseURL(
                    siteNum) + actorPageURL
            req = PAutils.HTTPRequest(actorPageURL)
            actorPage = HTML.ElementFromString(req.text)
            actorPhotoURL = PAsearchSites.getSearchBaseURL(
                siteNum) + actorPage.xpath(
                    '//div[@class="profile-pic"]/img/@src0_3x')[0]

            movieActors.addActor(actorName, actorPhotoURL)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[contains(@class, "videoInfo")]/p')[0].text_content().replace(
            'Date Added:', '').strip()
    date_object = parse(date)
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Posters
    art = []
    setID = detailsPageElements.xpath(
        '//img[contains(@class, "thumbs")]/@id')[0]

    img = detailsPageElements.xpath(
        '//img[contains(@class, "thumbs")]/@src0_3x')
    if img:
        art.append(PAsearchSites.getSearchBaseURL(siteNum) + img[0])

    # Search Page
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) +
        metadata.title.replace(' ', '+'))
    searchPageElements = HTML.ElementFromString(req.text)
    cnt = searchPageElements.xpath('//img[@id="%s"]/@cnt' % setID)
    if cnt:
        for i in range(int(cnt[0])):
            img = searchPageElements.xpath('//img[@id="%s"]/@src%d_3x' %
                                           (setID, i))
            if img:
                art.append(PAsearchSites.getSearchBaseURL(siteNum) + img[0])

    # Photo page
    req = PAutils.HTTPRequest(sceneURL.replace('/trailers/', '/preview/'))
    photoPageElements = HTML.ElementFromString(req.text)
    for image in photoPageElements.xpath('//img[@id="%s"]/@src0_3x' % setID):
        art.append(PAsearchSites.getSearchBaseURL(siteNum) + image)

    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, headers={'Referer': 'http://www.google.com'})
                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
def update(metadata,siteID,movieGenres,movieActors):
    Log('******UPDATE CALLED*******')

    url = str(metadata.id).split("|")[0].replace('_','/').replace('!','?')
    detailsPageElements = HTML.ElementFromURL(url)
    art = []
    metadata.collections.clear()
    movieGenres.clearGenres()
    movieActors.clearActors()

    # Studio
    metadata.studio = 'BellaPass'

    # Title
    metadata.title = detailsPageElements.xpath('//div[@class="videoDetails clear"]/h3')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath('//div[@class="videoDetails clear"]/p')[0].text_content().strip()
    
    #Tagline and Collection(s)
    tagline = PAsearchSites.getSearchSiteName(siteID)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    genres = detailsPageElements.xpath('//div[@class="inner-area clear"]/div[5]/ul/li')
    if len(genres) > 0:
        for genreLink in genres:
            genreName = genreLink.text_content().replace('Tags:','').lower()
            movieGenres.addGenre(genreName)

    # Actors
    actors = detailsPageElements.xpath('//div[@class="inner-area clear"]/div[4]/ul/li')
    if len(actors) > 0:
        if len(actors) == 3:
            movieGenres.addGenre("Threesome")
        if len(actors) == 4:
            movieGenres.addGenre("Foursome")
        if len(actors) > 4:
            movieGenres.addGenre("Orgy")
        for actorLink in actors:
            actorName = str(actorLink.text_content().replace('Featuring:','').strip())
            try:
                actorPageURL = PAsearchSites.getSearchBaseURL(siteID) + actorLink.get("href")
                actorPage = HTML.ElementFromURL(actorPageURL)
                actorPhotoURL = PAsearchSites.getSearchBaseURL(siteID) + actorPage.xpath('//div[@class="profile-pic"]/img')[0].get("src0_3x")
            except:
                actorPhotoURL = ''
            movieActors.addActor(actorName,actorPhotoURL)

    # Release Date
    date = detailsPageElements.xpath('//div[@class="videoInfo clear"]/p')[0].text_content().replace('Date Added:','').strip()
    date_object = parse(date)
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Artwork

    # Video background
    setID = detailsPageElements.xpath('//img[@class="update_thumb thumbs stdimage"]')[0].get('id')

    try:
        art.append(PAsearchSites.getSearchBaseURL(siteID) + detailsPageElements.xpath('//img[@class="update_thumb thumbs stdimage"]')[0].get('src0_3x'))
    except:
        pass

    # Search Page
    try:
        Log('searchPageElements: ' + PAsearchSites.getSearchSearchURL(siteID) + metadata.title.replace(' ','+'))
        searchPageElements = HTML.ElementFromURL(PAsearchSites.getSearchSearchURL(siteID) + metadata.title.replace(' ','+'))
        cnt = int(searchPageElements.xpath('//img[@id="'+setID+'"]')[0].get('cnt'))
        for i in range(cnt):
            Log('i: ' + str(i))
            Log('art.append: '+PAsearchSites.getSearchBaseURL(siteID) + searchPageElements.xpath('//img[@id="'+setID+'"]')[0].get('src'+str(i)+'_3x'))
            art.append(PAsearchSites.getSearchBaseURL(siteID) + searchPageElements.xpath('//img[@id="'+setID+'"]')[0].get('src'+str(i)+'_3x'))
    except:
        pass

    # Photo page
    try:
        photoPageElements = HTML.ElementFromURL(url.replace('/trailers/','/preview/'))
        for image in photoPageElements.xpath('//img[@id="'+setID+'"]'):
            art.append(PAsearchSites.getSearchBaseURL(siteID) + image.get('src0_3x'))
    except:
        pass
    
    j = 1
    Log("Artwork found: " + str(len(art)))
    for posterUrl in art:
        if not PAsearchSites.posterAlreadyExists(posterUrl,metadata):            
            #Download image file for analysis
            try:
                img_file = urllib.urlopen(posterUrl)
                im = StringIO(img_file.read())
                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.Preview(HTTP.Request(posterUrl, headers={'Referer': 'http://www.google.com'}).content, sort_order = j)
                if(width > 100):
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Preview(HTTP.Request(posterUrl, headers={'Referer': 'http://www.google.com'}).content, sort_order = j)
                j = j + 1
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneName = metadata_id[0]
    sceneDate = metadata_id[2]
    sceneType = metadata_id[3]

    dbURL = getDBURL(PAsearchSites.getSearchBaseURL(siteNum))
    detailsPageElements = getDataFromAPI(dbURL, sceneType, sceneName, siteNum)

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

    # Summary
    metadata.summary = detailsPageElements['description']

    # Studio
    metadata.studio = 'TeamSkeet'

    # Collections / Tagline
    siteName = detailsPageElements['site'][
        'name'] if 'site' in detailsPageElements else PAsearchSites.getSearchSiteName(
            siteNum)
    metadata.collections.clear()
    metadata.tagline = siteName
    metadata.collections.add(siteName)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    if 'tags' in detailsPageElements and detailsPageElements['tags']:
        for genreLink in detailsPageElements['tags']:
            genreName = genreLink.strip()

            movieGenres.addGenre(genreName)

    if siteName == 'Sis Loves Me':
        movieGenres.addGenre('Step Sister')
    elif siteName == 'DadCrush' or siteName == 'DaughterSwap':
        movieGenres.addGenre('Step Dad')
        movieGenres.addGenre('Step Daughter')
    elif siteName == 'PervMom':
        movieGenres.addGenre('Step Mom')
    elif siteName == 'Family Strokes':
        movieGenres.addGenre('Taboo Family')
    elif siteName == 'Foster Tapes':
        movieGenres.addGenre('Taboo Sex')
    elif siteName == 'BFFs':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Group Sex')
    elif siteName == 'Shoplyfter':
        movieGenres.addGenre('Strip')
    elif siteName == 'ShoplyfterMylf':
        movieGenres.addGenre('Strip')
        movieGenres.addGenre('MILF')
    elif siteName == 'Exxxtra Small':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Small T**s')
    elif siteName == 'Little Asians':
        movieGenres.addGenre('Asian')
        movieGenres.addGenre('Teen')
    elif siteName == 'TeenJoi':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('JOI')
    elif siteName == 'Black Valley Girls':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Ebony')
    elif siteName == 'Thickumz':
        movieGenres.addGenre('Thick')
    elif siteName == 'Dyked':
        movieGenres.addGenre('Hardcore')
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Lesbian')
    elif siteName == 'Teens Love Black Cocks':
        movieGenres.addGenre('Teens')
        movieGenres.addGenre('BBC')
    elif siteName == 'Teen Curves':
        movieGenres.addGenre('Big Ass')
    elif siteName == 'Titty Attack':
        movieGenres.addGenre('Big T**s')
    elif siteName == 'Teeny Black':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Ebony')
    elif siteName == 'Teens Do P**n':
        movieGenres.addGenre('Teen')
    elif siteName == 'Teen Pies':
        movieGenres.addGenre('Teen')
        movieGenres.addGenre('Creampie')
    elif siteName == 'POV Life':
        movieGenres.addGenre('POV')
    elif siteName == 'Ginger Patch':
        movieGenres.addGenre('Redhead')
    elif siteName == 'Innocent High':
        movieGenres.addGenre('School Girl')
    elif siteName == 'Oye Loca':
        movieGenres.addGenre('Latina')

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements['models']
    for actorLink in actors:
        actorData = getDataFromAPI(dbURL, 'modelscontent',
                                   actorLink['modelId'], siteNum)

        if actorData:
            actorName = actorData['name']
            actorPhotoURL = actorData['img']

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = [detailsPageElements['img']]

    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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    sceneDate = metadata_id[2]
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = PAutils.parseTitle(
        detailsPageElements.xpath('//h1')[0].text_content(), siteNum)

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="vdoDesc"]')[0].text_content().strip()

    # Studio
    metadata.studio = 'Bang Bros'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = detailsPageElements.xpath(
        '//a[contains(@href, "/websites")]')[1].text_content().strip()
    metadata.tagline = tagline
    metadata.collections.add(metadata.tagline)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//div[contains(@class, "vdoTags")]//a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[@class="vdoCast"]//a[contains(@href, "/model")]'):
        actorName = actorLink.text_content().strip()

        actorPageURL = actorLink.get('href')
        req = PAutils.HTTPRequest(
            PAsearchSites.getSearchBaseURL(siteNum) + actorPageURL)
        actorPage = HTML.ElementFromString(req.text)
        actorPhotoURL = 'http:' + actorPage.xpath(
            '//div[@class="profilePic_in"]//img/@src')[0]

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = [
        '//img[contains(@id, "player-overlay-image")]/@src',
        '//div[@class="WdgtPic modal-overlay"]//img/@src'
    ]
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            if not poster.startswith('http'):
                poster = 'http:' + poster
            if 'big' not in poster:
                (poster, filename) = poster.rsplit('/', 1)
                poster = poster + '/big' + filename

            art.append(poster)

    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
def update(metadata, siteNum, movieGenres, movieActors):
    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 = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h2[@class="section-title"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="update-info-block"]')[1].text_content().replace(
            'Description:', '', 1).strip()

    # Studio
    metadata.studio = 'Interracial Pass'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="update-info-row"]')[0].text_content().replace(
            'Released:', '', 1).strip()
    if date:
        date_object = parse(date)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//ul[@class="tags"]//li//a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[contains(@class, "models-list-thumbs")]//li'):
        actorName = actorLink.xpath('.//span/text()')[0]
        actorPhotoURL = actorLink.xpath('.//img//@src0_3x')[0]
        if not actorPhotoURL.startswith('http'):
            actorPhotoURL = PAsearchSites.getSearchBaseURL(
                siteNum) + actorPhotoURL

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = ['//div[@class="player-thumb"]//img/@src0_1x']

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            if not img.startswith('http'):
                img = PAsearchSites.getSearchBaseURL(siteNum) + img
            art.append(img)

    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, headers={'Referer': 'http://www.google.com'})
                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
Example #21
0
def update(metadata, siteID, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteID) + sceneURL
    sceneDate = metadata_id[2]
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Studio
    metadata.studio = PAsearchSites.getSearchSiteName(siteID)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="col-xs-12 video-title"]//h3')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="col-sm-6 col-md-6 vidpage-info"]/text()')[4].strip()

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteID).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath(
            '//div[@class="videopage-tags"]/a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[@class="col-xs-6 col-sm-4 col-md-3"]'):
        actorName = actorLink.xpath(
            './/div[@class="vidpage-mobilePad"]//a//strong/text()')[0].strip()
        actorPhotoURL = ''

        try:
            actorPhotoURL = actorLink.xpath(
                './/img[@class="img-responsive imgHover"]/@src')[0]
        except:
            pass

        movieActors.addActor(actorName, actorPhotoURL)

    # Photos
    art = []
    try:
        posterURL = detailsPageElements.xpath(
            '//div[@class="col-xs-12 col-sm-6 col-md-6 vidCover"]//img/@src'
        )[0]
        art.append(posterURL)
    except:
        pass

    for photo in detailsPageElements.xpath(
            '//div[@class="vid-flex-container"]//span'):
        photoLink = photo.xpath('.//img/@src')[0].replace('_thumb', '')
        art.append(photoLink)

    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, headers={'Referer': 'http://www.google.com'})
                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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
def update(metadata, siteID, movieGenres, movieActors):
    temp = str(metadata.id).split("|")[0]
    art = []

    url = PAsearchSites.getSearchSearchURL(siteID) + temp
    Log('scene url: ' + url)
    detailsPageElements = HTML.ElementFromURL(url)

    metadata.studio = "P**n Pros"

    # Collections / Tagline
    siteName = PAsearchSites.getSearchSiteName(siteID)
    metadata.collections.clear()
    metadata.tagline = siteName
    metadata.collections.add(siteName)

    # Summary
    try:
        if siteName.lower() == "Cum4K".lower():

            summaryurl = "https://cum4k.tube/" + temp
            Log(summaryurl)
            summaryPageElements = HTML.ElementFromURL(summaryurl)
            metadata.summary = summaryPageElements.xpath(
                '//p[@class="more"]/text()')[0].strip()
    except:
        Log("did not pull tube summary")
        pass

    # Actors
    movieActors.clearActors()
    titleActors = ""
    actors = detailsPageElements.xpath(
        '//div[@class="details col-sm-6 col-md-3 order-md-2 mb-2"]//div[@class="row"]//div[@class="col-6 col-md-12"]//a'
    )
    if len(actors) > 0:
        for actorLink in actors:
            actorName = actorLink.text_content()
            actorPhotoURL = PAactors.actorDBfinder(actorName)
            titleActors = titleActors + actorName + " & "
            Log("actorPhoto: " + actorPhotoURL)
            movieActors.addActor(actorName, actorPhotoURL)
        titleActors = titleActors[:-3]

    # Genres
    movieGenres.clearGenres()
    # Based on site
    if siteName.lower() == "Lubed".lower():
        for genreName in ['Lube', 'Raw', 'Wet']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "Holed".lower():
        for genreName in ['Anal', 'Ass']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "POVD".lower():
        for genreName in ['Gonzo', 'POV']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "MassageCreep".lower():
        for genreName in ['Massage', 'Oil']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "DeepThroatLove".lower():
        for genreName in ['B*****b', 'Deep Throat']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "PureMature".lower():
        for genreName in ['MILF', 'Mature']:
            movieGenres.addGenre(genreName)
    elif siteName.lower() == "Cum4K".lower():
        for genreName in ['Creampie']:
            movieGenres.addGenre(genreName)
    # Based on number of actors
    if len(actors) == 3:
        movieGenres.addGenre('Threesome')
    if len(actors) == 4:
        movieGenres.addGenre('Foursome')
    if len(actors) > 4:
        movieGenres.addGenre('Orgy')

    # Posters
    background = "http:" + detailsPageElements.xpath(
        '//video[@id="player"]')[0].get('poster')
    Log("BG DL: " + background)
    metadata.art[background] = Proxy.Preview(HTTP.Request(
        background, headers={
            'Referer': 'http://www.google.com'
        }).content,
                                             sort_order=1)
    metadata.posters[background] = Proxy.Preview(HTTP.Request(
        background, headers={
            'Referer': 'http://www.google.com'
        }).content,
                                                 sort_order=1)

    # Date
    date = detailsPageElements.xpath(
        '//div[contains(@class,"details")]//p')[0].text_content().strip()
    Log('Date: ' + date)
    date_object = datetime.strptime(date, '%B %d, %Y')
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[contains(@class,"details")]//h1')[0].text_content().strip()

    #Extra Posters
    import random

    if siteName.lower() == "Holed".lower():
        fanSite = PAextras.getFanArt("AnalPornFan.com", art, actors, actorName,
                                     metadata.title)
    elif siteName.lower() == "SpyFam".lower():
        fanSite = PAextras.getFanArt("SpyFams.com", art, actors, actorName,
                                     metadata.title)
    elif siteName.lower() == "Lubed".lower():
        fanSite = PAextras.getFanArt("LubedFan.com", art, actors, actorName,
                                     metadata.title)
    elif siteName.lower() == "PassionHD".lower():
        for site in ["PassionHDFan.com", "HQSluts.com"]:
            fanSite = PAextras.getFanArt(site, art, actors, actorName,
                                         metadata.title)
    else:
        fanSite = PAextras.getFanArt("HQSluts.com", art, actors, actorName,
                                     metadata.title)

    summary = fanSite[1]
    match = fanSite[2]

    try:
        if len(metadata.summary) < len(summary):
            metadata.summary = summary
    except:
        metadata.summary = summary

    if match is 1:
        # Return, first, last and randóm selection of images
        # If you want more or less posters edít the value in random.sample below or refresh metadata to get a different sample.
        sample = [art[0], art[1], art[2], art[3], art[-1]] + random.sample(
            art, 4)
        art = sample
        Log("Selecting first 5, last and random 4 images from set")

        j = 1

        for posterUrl in art:
            Log("Trying next Image")
            if not PAsearchSites.posterAlreadyExists(posterUrl, metadata):
                #Download image file for analysis
                try:
                    img_file = urllib.urlopen(posterUrl)
                    im = StringIO(img_file.read())
                    resized_image = Image.open(im)
                    width, height = resized_image.size
                    #Add the image proxy items to the collection
                    if width > 1 or height > width:
                        # Item is a poster
                        metadata.posters[posterUrl] = Proxy.Preview(
                            HTTP.Request(posterUrl,
                                         headers={
                                             'Referer': 'http://www.google.com'
                                         }).content,
                            sort_order=j)
                    if width > 100 and width > height:
                        # Item is an art item
                        metadata.art[posterUrl] = Proxy.Preview(HTTP.Request(
                            posterUrl,
                            headers={
                                'Referer': 'http://www.google.com'
                            }).content,
                                                                sort_order=j)
                    j = j + 1
                except:
                    Log("there was an issue")

    return metadata
def update(metadata, lang, siteNum, movieGenres, movieActors):
    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 = HTML.ElementFromString(req.text)

    metadata.directors.clear()
    director = metadata.directors.new()

    if siteNum == 278 or (siteNum >= 285 and siteNum <= 287) or siteNum == 843:
        metadata.studio = 'XEmpire'
        director.name = 'Mason'
    elif siteNum == 329 or (siteNum >= 351
                            and siteNum <= 354) or siteNum == 861:
        metadata.studio = 'Blowpass'
    elif siteNum == 331 or (siteNum >= 355
                            and siteNum <= 360) or siteNum == 750:
        metadata.studio = 'Fantasy Massage'
    elif (siteNum >= 365
          and siteNum <= 372) or siteNum == 466 or siteNum == 690:
        metadata.studio = '21Sextury'
    elif siteNum == 183 or (siteNum >= 373 and siteNum <= 374):
        metadata.studio = '21Naturals'
    elif siteNum >= 383 and siteNum <= 386:
        metadata.studio = 'Fame Digital'
    elif siteNum >= 387 and siteNum <= 392:
        metadata.studio = 'Open Life Network'
    elif siteNum == 281:
        metadata.studio = 'Pure Taboo'
    elif siteNum == 381:
        metadata.studio = 'Burning Angel'
    elif siteNum == 382:
        metadata.studio = 'Pretty Dirty'
    elif siteNum >= 460 and siteNum <= 466:
        metadata.studio = '21Sextreme'

    art = []

    # Summary
    try:
        paragraph = detailsPageElements.xpath(
            '//meta[@name="twitter:description"]/@content')[0].strip()
    except:
        paragraph = ''

    if not paragraph:
        try:
            paragraph = detailsPageElements.xpath(
                '//div[@class="sceneDesc bioToRight showMore"]'
            )[0].text_content().strip()
            paragraph = paragraph[20:]
        except:
            try:
                paragraph = detailsPageElements.xpath(
                    '//div[@class="sceneDescText"]')[0].text_content().strip()
            except:
                try:
                    paragraph = detailsPageElements.xpath(
                        '//p[@class="descriptionText"]')[0].text_content(
                        ).strip()
                except:
                    paragraph = ''
    metadata.summary = paragraph.replace('</br>',
                                         '\n').replace('<br>', '\n').replace(
                                             '<br/>', '\n').strip()
    metadata.collections.clear()

    # Tagline
    try:
        tagline = detailsPageElements.xpath(
            '//div[@class="studioLink"]')[0].text_content().strip()
    except:
        tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Title DVD
    try:
        dvdTitle = detailsPageElements.xpath(
            '//a[contains(@class, "dvdLink")][1]/@title')[0].strip()
        metadata.collections.add(dvdTitle.replace('#0', '').replace('#', ''))
    except:
        try:
            dvdTitleScript = detailsPageElements.xpath(
                '//script[contains(text(), "dvdName")]')[0].text_content()
            alpha = dvdTitleScript.find('"dvdName"') + 11
            omega = dvdTitleScript.find('"', alpha)
            dvdTitle = dvdTitleScript[alpha:omega]
            if dvdTitle:
                metadata.collections.add(
                    dvdTitle.replace('#0', '').replace('#', ''))
        except:
            try:
                dvdTitle = detailsPageElements.xpath(
                    '//h1[@class="sceneTitle"]')[0].text_content().strip()
                dvdTitle = dvdTitle.replace('BONUS-',
                                            '').replace('BONUS - ', '')
                dvdTitle = dvdTitle.replace('BONUS', '')
                dvdTitle = dvdTitle.replace('BTS-', '').replace('BTS - ', '')
                dvdTitle = dvdTitle.replace('BTS', '')
                metadata.collections.add(
                    dvdTitle.replace('#0', '').replace('#', ''))
            except:
                dvdTitle = 'This is some damn nonsense that should never match the scene title'

    # Director
    try:
        directors = detailsPageElements.xpath(
            '//div[@class="sceneCol sceneColDirectors"]//a | //ul[@class="directedBy"]/li/a'
        )
        for dirname in directors:
            director.name = dirname.text_content().strip()
    except:
        pass

    # Genres
    movieGenres.clearGenres()
    genres = detailsPageElements.xpath(
        '//div[@class="sceneCol sceneColCategories"]//a | //div[@class="sceneCategories"]//a | //p[@class="dvdCol"]/a'
    )
    for genreLink in genres:
        genreName = genreLink.text_content().strip('\n').lower()

        movieGenres.addGenre(genreName)

    # Release Date
    try:
        date = detailsPageElements.xpath(
            '//*[@class="updatedDate"]')[0].text_content().replace('|',
                                                                   '').strip()
        if date:
            date_object = parse(date)
            metadata.originally_available_at = date_object
            metadata.year = metadata.originally_available_at.year
    except:
        try:
            date = detailsPageElements.xpath(
                '//*[@class="updatedOn"]')[0].text_content().strip()
            date = date[8:].strip()
            if date:
                date_object = parse(date)
                metadata.originally_available_at = date_object
                metadata.year = metadata.originally_available_at.year
        except:
            try:
                datePublished = detailsPageElements.xpath(
                    '//script[contains(text(), "datePublished")]'
                )[0].text_content()
                alpha = datePublished.find('"datePublished"') + 17
                omega = datePublished.find('"', alpha)
                date = datePublished[alpha:omega]
                if date:
                    date_object = parse(date)
                    metadata.originally_available_at = date_object
                    metadata.year = metadata.originally_available_at.year
            except:
                pass

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath(
        '//div[@class="sceneCol sceneColActors"]//a | //div[@class="sceneCol sceneActors"]//a | //div[@class="pornstarNameBox"]/a[@class="pornstarName"] | //div[@id="slick_DVDInfoActorCarousel"]//a | //div[@id="slick_sceneInfoPlayerActorCarousel"]//a'
    )
    if metadata.title == 'Kennedy Leigh' and metadata.tagline == 'Only Teen Blowjobs':
        movieActors.addActor(
            'Kennedy Leigh',
            'https://imgs1cdn.adultempire.com/actors/649607h.jpg')

    if not actors:  # Try pulling the mobile site
        try:
            req = PAutils.HTTPRequest(
                url.replace('www', 'm'),
                headers={
                    'User-Agent':
                    'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'
                })
            mobilePageElements = HTML.ElementFromString(req.text)
            actors = mobilePageElements.xpath(
                '//a[@class="pornstarName"] | //a[@class="pornstarImageLink"]')

        except:
            pass
    if actors:
        for actorLink in actors:
            actorName = actorLink.text_content().strip()
            actorPhotoURL = ''

            actorPageURL = actorLink.get('href')
            req = PAutils.HTTPRequest(
                PAsearchSites.getSearchBaseURL(siteNum) + actorPageURL)
            actorPage = HTML.ElementFromString(req.text)
            actorPhotoURL = actorPage.xpath(
                '//img[@class="actorPicture"]/@src | //span[@class="removeAvatarParent"]/img/@src'
            )[0]

            movieActors.addActor(actorName, actorPhotoURL)
    else:
        try:
            dataLayer = detailsPageElements.xpath(
                '//script[contains(text(), "dataLayer")]')[0].text_content()
            alpha = dataLayer.find('"sceneActors"') + 14
            omega = dataLayer.find(']', alpha)
            sceneActors = dataLayer[alpha:omega]
            i = 1
            while i <= int(sceneActors.count('actorId')):
                alpha = sceneActors.find('"actorId"', omega) + 11
                omega = sceneActors.find('"', alpha)
                actorId = sceneActors[alpha:omega]
                alpha = sceneActors.find('"actorName"', omega) + 13
                omega = sceneActors.find('"', alpha)
                actorName = sceneActors[alpha:omega]
                # Search for the actor to get their page (then photo) or hardcode the URL pattern if feeling frisky
                actorPageURL = '/en/pornstar/' + actorName.replace(
                    ' ', '-') + '/' + actorId
                req = PAutils.HTTPRequest(
                    (PAsearchSites.getSearchBaseURL(siteNum) + actorPageURL))
                actorPage = HTML.ElementFromString(req.text)
                actorPhotoURL = actorPage.xpath(
                    '//img[@class="actorPicture"]/@src | //span[@class="removeAvatarParent"]/img/@src'
                )[0]
                movieActors.addActor(actorName, actorPhotoURL)
                i += 1
        except:
            pass

    # Title
    try:
        title = detailsPageElements.xpath(
            '//meta[@name="twitter:title"]/@content')[0].strip()
    except:
        try:
            # Title DVD
            title = detailsPageElements.xpath(
                '//h3[@class="dvdTitle"]')[0].text_content().strip()
        except:
            try:
                # Title Scene
                title = detailsPageElements.xpath(
                    '//h1[@class="sceneTitle"]')[0].text_content().strip()
            except:
                try:
                    title = detailsPageElements.xpath(
                        '//h1')[0].text_content().strip()
                except:
                    title = 'I couldn\'t find the title, please report this on github: https://github.com/PAhelper/PhoenixAdult.bundle/issues'

    if 'Scene #' in detailsPageElements.xpath(
            '//title')[0].text_content().strip() and "Scene #" not in title:
        pageTitle = detailsPageElements.xpath(
            '//title')[0].text_content().strip()
        alpha = pageTitle.find('Scene') + 6
        omega = pageTitle.find(' ', alpha)
        title = '%s - Scene %s' % (title,
                                   pageTitle[alpha:omega].strip()).replace(
                                       '#0', '').replace('#', '')

    if 'BONUS' in title or 'BTS' in title:
        if actors:
            actorTitle = ' - '
            for actorLink in actors:
                actorName = actorLink.text_content().strip()
                if 'Rocco Siffredi' not in actorName and 'Peter North' not in actorName:
                    actorTitle = actorTitle + actorName + ', '

            title = title + actorTitle
            title = title.strip()
            title = title.strip(',')

    title = title.replace('BONUS-', 'BONUS - ').replace('BTS-', 'BTS - ')

    metadata.title = title

    # Posters

    # Video trailer background image
    try:
        twitterBG = detailsPageElements.xpath(
            '//meta[@name="twitter:image"]/@content')[0]
        art.append(twitterBG)
    except:
        pass

    try:
        picScript = detailsPageElements.xpath(
            '//script[contains(text(), "picPreview")]')[0].text_content()
        alpha = picScript.find('"picPreview":"') + 14
        omega = picScript.find('"', alpha)
        art.append(picScript[alpha:omega].replace('\\', ''))
    except:
        pass

    try:
        sceneImg = detailsPageElements.xpath(
            '//img[@class="sceneImage"]/@src')[0]
        art.append(sceneImg)
    except:
        pass

    # Scene photos page
    try:
        photoPageUrl = PAsearchSites.getSearchBaseURL(
            siteNum
        ) + detailsPageElements.xpath(
            '//a[@class="controlButton GA_Track GA_Track_Action_Pictures GA_Track_Category_Player GA GA_Click GA_Id_ScenePlayer_Pictures"]'
        )[0].get('href')
        req = PAutils.HTTPRequest(photoPageUrl)
        photoPage = HTML.ElementFromString(req.text)
        unlockedPhotoImg = photoPage.xpath(
            '//div[@class="previewImage"]/img/@src')[0]
        art.append(unlockedPhotoImg)
        unlockedPhotos = photoPage.xpath(
            '//a[@class="imgLink"]/@href | //a[@class="imgLink pgUnlocked"]/@href'
        )
        for unlockedPhoto in unlockedPhotos:
            art.append(unlockedPhoto)
    except:
        photoPageUrl = sceneURL

    # DVD Covers
    if '/movie/' in sceneURL:
        try:
            dvdFrontCover = detailsPageElements.xpath(
                '//a[@class="frontCoverImg"]/@href')[0]
            art.append(dvdFrontCover)

            dvdBackCover = detailsPageElements.xpath(
                '//a[@class="backCoverImg"]/@href')[0]
            art.append(dvdBackCover)
        except:
            pass

        # DVD scene images
        try:
            sceneImgs = detailsPageElements.xpath(
                '//img[@class="tlcImageItem img"]/@src')
            for sceneImg in sceneImgs:
                art.append(sceneImg)
        except:
            pass

        try:
            sceneImgs = detailsPageElements.xpath(
                '//img[@class="img lazy"]/@data-original')
            for sceneImg in sceneImgs:
                art.append(sceneImg)
        except:
            pass

    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
def update(metadata, lang, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1')[0].text_content().strip()

    # Summary
    description = detailsPageElements.xpath(
        '//div[@data-id="description" and @class="hidden"]')
    if description:
        metadata.summary = description[0].text_content().strip().replace(
            'Read less', '')

    # Studio
    metadata.studio = 'DarkRoomVR'

    # Tagline and Collection
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = (detailsPageElements.xpath('//div[@class="video-info__time"]')
            [0].text_content().strip()).split(' • ')[1]
    if date:
        date_object = parse(date)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div/a[@class="tags__item"]'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[@class="video-info__text"]/a'):
        actorName = actorLink.text_content().strip()

        actorPageURL = actorLink.get('href')
        req = PAutils.HTTPRequest(actorPageURL)
        actorPage = HTML.ElementFromString(req.text)
        actorPhotoURL = actorPage.xpath(
            '//img[contains(@class, "pornstar-detail__picture")]/@src')[0]

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    art = []
    xpaths = ['//div[@class="video-detail__gallery-item"]/a/@href']

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            art.append(img)

    # Get More Posters
    # imagestring = (detailsPageElements.xpath('//div[@class="video-detail__gallery-item"]/a/@href')[0]).split('img_')[0]
    # for i in range(100):
    #     img = imagestring+'img_'+str(i).rjust(3, '0')+'.jpg'
    #     art.append(img)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Studio
    metadata.studio = 'Pornstar Platinum'

    # Title
    metadata.title = PAutils.Decode(metadata_id[2]).strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="panel-content"]/p')[0].text_content().strip()

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div[@class="tagcloud"]/a'):
        genreName = genreLink.text_content().strip()
        movieGenres.addGenre(genreName)

    # Release Date
    date_object = parse(PAutils.Decode(metadata_id[3]))
    metadata.originally_available_at = date_object
    metadata.year = metadata.originally_available_at.year

    # Actors
    movieActors.clearActors()
    actorName = PAutils.Decode(metadata_id[5])
    actorPhotoURL = ''

    movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    if posterURL:
        art.append(posterURL)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1[@class="font-cond"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="descripton"]')[0].text_content().strip()

    # Studio
    metadata.studio = 'Joymii'

    # Release Date
    if sceneDate:
        date_object = parse(sceneDate)
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = 'Step Secrets'
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Genres
    movieGenres.clearGenres()
    for genreLink in ['European', 'Taboo', 'Glamcore']:
        genreName = genreLink

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath('//p[@class="mb-2"]//a'):
        actorPageURL = PAsearchSites.getSearchBaseURL(siteNum) + actorLink.get(
            'href')
        req = PAutils.HTTPRequest(actorPageURL)
        actorPage = HTML.ElementFromString(req.text)

        actorName = actorPage.xpath(
            '//h1[contains(@class, "font-cond")]')[0].text_content().strip()
        actorPhotoURL = actorPage.xpath(
            '//div[contains(@class, "model-about")]//img/@src')[0].split(
                '?')[0]

        movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    xpaths = ['//video/@poster', '//div[@id="photoCarousel"]//img/@src']
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    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 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//div[@class="fltWrap"]/h1/span')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//p[@class="description"]')[0].text_content().replace(
            'Description:', '').strip()

    # Studio
    metadata.studio = 'ClubFilly'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="fltRight"]')[0].text_content().replace(
            'Release Date :', '').strip()
    if date:
        date_object = datetime.strptime(date, '%Y-%m-%d')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    movieGenres.addGenre('Lesbian')

    # Actors
    movieActors.clearActors()
    actorText = detailsPageElements.xpath(
        '//p[@class="starring"]')[0].text_content().replace('Starring:',
                                                            '').strip()
    actors = actorText.split(',')
    if len(actors) > 0:
        if len(actors) == 3:
            movieGenres.addGenre('Threesome')
        if len(actors) == 4:
            movieGenres.addGenre('Foursome')
        if len(actors) > 4:
            movieGenres.addGenre('Orgy')

        for actorLink in actors:
            actorName = actorLink.strip()
            actorPhotoURL = ''

            movieActors.addActor(actorName, actorPhotoURL)

    # Posters
    xpaths = ['//ul[@id="lstSceneFocus"]/li/img/@src']

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            art.append(img)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
Example #28
0
def update(metadata, siteNum, movieGenres, movieActors):
    metadata_id = str(metadata.id).split('|')
    sceneURL = PAutils.Decode(metadata_id[0])
    if not sceneURL.startswith('http'):
        sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)

    # Title
    try:
        metadata.title = detailsPageElements.xpath(
            '//a[@class="title"]')[0].text_content().strip()
    except:
        metadata.title = detailsPageElements.xpath(
            '//meta[@property="og:title"]')[0].text_content().strip()

    # Summary
    metadata.summary = detailsPageElements.xpath(
        '//div[@class="entry_content"]/p')[0].text_content().strip()

    # Studio
    metadata.studio = 'MomPOV'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum)
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="date_holder"]')[0].text_content().strip()
    if date:
        date_object = datetime.strptime(date, '%b %Y %d')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    movieGenres.addGenre('MILF')

    # Actors
    movieActors.clearActors()

    # Posters
    art = []
    xpaths = ['//div[@id="inner_content"]/div[1]/a/img/@src']
    for xpath in xpaths:
        for poster in detailsPageElements.xpath(xpath):
            art.append(poster)

    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, headers={'Referer': 'http://www.google.com'})
                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 and height >= width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

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

    # Title
    metadata.title = detailsPageElements.xpath(
        '//h1[@class="description"]')[0].text_content().strip()

    # Summary
    try:
        metadata.summary = detailsPageElements.xpath(
            '//div[@class="synopsis"]/p')[0].text_content().strip()
    except:
        pass

    # Studio
    metadata.studio = 'Elegant Angel'

    # Tagline and Collection(s)
    metadata.collections.clear()
    tagline = PAsearchSites.getSearchSiteName(siteNum).strip()
    metadata.tagline = tagline
    metadata.collections.add(tagline)

    # Release Date
    date = detailsPageElements.xpath(
        '//div[@class="release-date"]')[0].text_content().replace(
            'Released:', '').strip()
    if date:
        date_object = datetime.strptime(date, '%b %d, %Y')
        metadata.originally_available_at = date_object
        metadata.year = metadata.originally_available_at.year

    # Genres
    movieGenres.clearGenres()
    for genreLink in detailsPageElements.xpath('//div[@class="categories"]/a'):
        genreName = genreLink.text_content().strip()

        movieGenres.addGenre(genreName)

    # Actors
    movieActors.clearActors()
    for actorLink in detailsPageElements.xpath(
            '//div[@class="scene-cast-list"]/a | //div[@class="video-performer"]/a'
    ):
        actorName = actorLink.text_content().strip()
        actorPhotoURL = ''

        actorPageURL = PAsearchSites.getSearchBaseURL(siteNum) + actorLink.get(
            'href')
        req = PAutils.HTTPRequest(actorPageURL)
        actorPage = HTML.ElementFromString(req.text)
        img = actorPage.xpath('//div[@class="container-fluid px-0"]//img/@src')
        if img:
            actorPhotoURL = img[0]
            if 'http' not in actorPhotoURL:
                actorPhotoURL = PAsearchSites.getSearchBaseURL(
                    siteNum) + actorPhotoURL

        movieActors.addActor(actorName, actorPhotoURL)

    # Director
    director = metadata.directors.new()
    try:
        directors = detailsPageElements.xpath('//div[@class="director"]/a')
        for dirname in directors:
            director.name = dirname.text_content().strip()
    except:
        pass

    # Posters
    xpaths = ['//div[@class="carousel-item active"]/img/@data-src']

    for xpath in xpaths:
        for img in detailsPageElements.xpath(xpath):
            art.append(img)

    # Scene photos page
    try:
        photoPageUrl = PAsearchSites.getSearchBaseURL(
            siteNum) + detailsPageElements.xpath(
                '//div[@class="user-actions"]/a[2]')[0].get('href')
        req = PAutils.HTTPRequest(photoPageUrl)
        photoPage = HTML.ElementFromString(req.text)
        unlockedPhotos = photoPage.xpath(
            '//div[@class="item-grid item-grid-gallery"]//img/@data-src')
        for unlockedPhoto in unlockedPhotos:
            if 'http' not in unlockedPhoto:
                art.append(
                    PAsearchSites.getSearchBaseURL(siteNum) + unlockedPhoto)
            else:
                art.append(unlockedPhoto)
    except:
        photos = detailsPageElements.xpath(
            '//div[@class="item-grid item-grid-scene"]//img[@class="img-full-fluid"]/@data-src'
        )
        for photoLink in photos:
            art.append(photoLink)

    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 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Media(image.content,
                                                              sort_order=idx)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Media(image.content,
                                                          sort_order=idx)
            except:
                pass

    return metadata
Example #30
0
def update(metadata, siteID, movieGenres, movieActors):
    art = []
    Log('******UPDATE CALLED*******')
    detailsPageElements = HTML.ElementFromURL(
        str(metadata.id).split("|")[0].replace('_', '/'))
    Log("urlName: " + detailsPageElements.xpath('//video[@id="preview"]')
        [0].get("poster").split('/')[5])
    urlName = detailsPageElements.xpath('//video[@id="preview"]')[0].get(
        "poster").split('/')[5]

    # Summary
    metadata.studio = "TeamSkeet"
    metadata.summary = detailsPageElements.xpath(
        '(//div[@class="vid-desc-mobile"]/span)[not(position()=1)][not(position()=last())]'
    )[0].text_content()
    metadata.title = detailsPageElements.xpath(
        '//div[@class="red_big"]/text()')[0].strip()
    #    releaseDate = detailsPageElements.xpath

    # Collections / Tagline
    siteName = PAsearchSites.getSearchSiteName(siteID)
    metadata.collections.clear()
    metadata.tagline = siteName
    metadata.collections.add(siteName)

    # Actors
    movieActors.clearActors()
    actors = detailsPageElements.xpath(
        '//div[@class="red_big"]/span/text()')[0].split(" and ")
    if len(actors) > 0:
        for actor in actors:
            actorName = actor
            actorPhotoURL = "http://cdn.teamskeetimages.com/design/tour/slm/tour/pics/" + urlName + "/" + urlName + ".jpg"
            Log("actorPhoto: " + actorPhotoURL)
            movieActors.addActor(actorName, actorPhotoURL)

    # Posters/Background
    try:
        art.append("http:" + detailsPageElements.xpath(
            '//video[@id="preview"]')[0].get("poster"))
    except:
        pass

    try:
        art.append(
            "http://cdn1.teamskeetimages.com/design/tour/slm/tour/pics/" +
            urlName + "/v2.jpg")
    except:
        pass

    try:
        art.append(
            "https://cdn.teamskeetimages.com/design/tour/slm/tour/pics/" +
            urlName + "/bio_small.jpg")
    except:
        pass

    try:
        art.append(
            "https://cdn.teamskeetimages.com/design/tour/slm/tour/pics/" +
            urlName + "/bio_small2.jpg")
    except:
        pass

    try:
        art.append(
            "https://cdn.teamskeetimages.com/design/tour/slm/tour/pics/" +
            urlName + "/bio_big.jpg")
    except:
        pass

    try:
        art.append("http://cdn.teamskeetimages.com/teamskeet/slm/" + urlName +
                   "/shared/low.jpg")
    except:
        pass

    try:
        art.append("http://cdn.teamskeetimages.com/teamskeet/slm/" + urlName +
                   "/shared/med.jpg")
    except:
        pass

    try:
        art.append("http://cdn.teamskeetimages.com/teamskeet/slm/" + urlName +
                   "/shared/hi.jpg")
    except:
        pass

    #Extra Posters
    import random
    from googlesearch import search

    # Check first X google results. Set Stop = X to search more
    urls = search('site:teamskeetfans.com" ' + actorName + ' ' +
                  metadata.title,
                  stop=2)

    match = 0
    for url in urls:
        if match is 0:
            googleSearchURL = url
            fanPageElements = HTML.ElementFromURL(googleSearchURL)

            try:
                try:
                    nameinheader = fanPageElements.xpath(
                        '//span[@itemprop="articleSection"]')[0].text_content(
                        )
                    Log("Actress name in header: " + nameinheader)
                except:
                    Log("No Actress found in the fansite header")
                    pass

                if actorName.lower() in nameinheader.lower():
                    Log(siteName + " Fansite Match Found")
                    match = 1
                else:
                    # When there are multiple actors listed we need to check all of them.
                    try:
                        for actor in actors:
                            for name in nameinheader:
                                if actor.lower() == name.lower():
                                    Log(siteName + " Fansite Match Found")
                                    match = 1
                    except:
                        Log("No Match")
                        pass

                if match is 1:
                    # Summary
                    try:
                        paragraphs = fanPageElements.xpath(
                            '//div[@class="entry-content g1-typography-xl"]'
                        )[0].text_content().split('\n')
                        Log(len(paragraphs))
                        if len(paragraphs) > 13:
                            summary = ""
                            for paragraph in paragraphs:
                                summary = (
                                    summary + '\n\n' + paragraph
                                ).replace(
                                    "LinkEmbedCopy and paste this HTML code into your webpage to embed.",
                                    ''
                                ).replace(
                                    "--> Click Here for More Sis Loves Me! <--",
                                    '').strip()
                            if len(metadata.summary) < len(summary):
                                metadata.summary = summary.strip()
                        else:
                            summary = fanPageElements.xpath(
                                '(//div[@class="entry-content g1-typography-xl"]//p)[position()=1]'
                            )[0].text_content()
                        if len(metadata.summary) < len(summary):
                            metadata.summary = summary.strip()
                    except:
                        Log("Error grabbing fansite summary")
                        pass

                    # Posters
                    try:
                        Log("Searching Fan site")
                        for posterURL in fanPageElements.xpath(
                                '//div[contains(@class, "tiled-gallery")]//a/img'
                        ):
                            art.append(posterURL.get('data-orig-file'))
                    except:
                        Log("No fansite images found")
                        pass
            except:
                pass

    if match is 1 and len(art) >= 10:
        Log("Artwork found: " + str(len(art)))
        # Return, first, last and randóm selection of images
        # If you want more or less posters edít the value in random.sample below or refresh metadata to get a different sample.
        sample = [art[0], art[-1]] + random.sample(art, 4)
        art = sample
        Log("Selecting first, last and random 4 images from set")

    j = 1

    for posterUrl in art:
        Log("Trying next Image")
        if not PAsearchSites.posterAlreadyExists(posterUrl, metadata):
            #Download image file for analysis
            try:
                img_file = urllib.urlopen(posterUrl)
                im = StringIO(img_file.read())
                resized_image = Image.open(im)
                width, height = resized_image.size
                #Add the image proxy items to the collection
                if width > 1 or height > width:
                    # Item is a poster
                    metadata.posters[posterUrl] = Proxy.Preview(HTTP.Request(
                        posterUrl,
                        headers={
                            'Referer': 'http://www.google.com'
                        }).content,
                                                                sort_order=j)
                if width > 100 and width > height:
                    # Item is an art item
                    metadata.art[posterUrl] = Proxy.Preview(HTTP.Request(
                        posterUrl,
                        headers={
                            'Referer': 'http://www.google.com'
                        }).content,
                                                            sort_order=j)
                j = j + 1
            except:
                Log("there was an issue")
                pass

    return metadata