def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//a[@class="video-card__item"]'):
        titleNoFormatting = searchResult.xpath(
            '//div/div[@class="video-card__title"]')[0].text_content().strip()
        curID = PAutils.Encode(
            searchResult.xpath('//a[@class="video-card__item"]/@href')[0])

        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())

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

    return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + encodedTitle)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//div[contains(@class, "card-simple")]'):
        titleNoFormatting = searchResult.xpath(
            './/a[@class="color-title"]/text()')[0]
        curID = PAutils.Encode(searchResult.xpath('.//a/@href')[0])
        releaseDate = parse(searchDate).strftime(
            '%Y-%m-%d') if searchDate else ''

        score = 100 - Util.LevenshteinDistance(searchTitle.lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #3
0
def search(results, lang, siteNum, search):
    search['encoded'] = search['title'].replace(' ', '+').replace('--',
                                                                  '+').lower()
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + search['encoded'])
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//div[@class="fsp  bor-r relative"]/article'):
        titleNoFormatting = searchResult.xpath(
            './/h4')[0].text_content().strip()
        sceneURL = searchResult.xpath('.//@href')[0]
        curID = PAutils.Encode(sceneURL)

        date = searchResult.xpath(
            './/div[@class="fsdate absolute"]/span')[0].text_content().strip()
        if date:
            releaseDate = parse(date).strftime('%Y-%m-%d')
        else:
            releaseDate = parse(
                search['date']).strftime('%Y-%m-%d') if search['date'] else ''
        releaseDate = parse(date).strftime('%Y-%m-%d')
        displayDate = releaseDate if date else ''

        if search['date'] and displayDate:
            score = 100 - Util.LevenshteinDistance(search['date'], releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(search['title'].lower(),
                                                   titleNoFormatting.lower())

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

    return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    sceneID = searchTitle.split(' ', 1)[0]
    try:
        sceneTitle = searchTitle.split(' ', 1)[1]
    except:
        sceneTitle = ''

    sceneURL = PAsearchSites.getSearchSearchURL(siteNum) + sceneID + '/1'
    req = PAutils.HTTPRequest(sceneURL)
    detailsPageElements = HTML.ElementFromString(req.text)
    titleNoFormatting = detailsPageElements.xpath('//title')[0].text_content().split('|')[1].strip()
    curID = PAutils.Encode(sceneURL)
    releaseDate = parse(searchDate).strftime('%Y-%m-%d') if searchDate else ''

    if sceneTitle:
        score = 100 - Util.LevenshteinDistance(searchTitle.lower(), titleNoFormatting.lower())
    else:
        score = 90

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

    return results
예제 #5
0
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + encodedTitle)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//div[@class="category_listing_wrapper_updates"]'):
        titleNoFormatting = searchResult.xpath('.//h3')[0].text_content().strip()
        if titleNoFormatting[-3:] == ' 4k':
            titleNoFormatting = titleNoFormatting[:-3].strip()
        curID = PAutils.Encode(searchResult.xpath('.//a[@class="ampLink"]/@href')[0])

        try:
            releaseDate = parse(searchResult.xpath('.//div[@class="date-label"]')[0].text_content()[22:].strip()).strftime('%Y-%m-%d')
        except:
            releaseDate = ''

        if searchDate and releaseDate:
            score = 100 - Util.LevenshteinDistance(searchDate, releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchTitle.lower(), titleNoFormatting.lower())

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

    return results
예제 #6
0
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//ul[@id="search_results"]//li[contains(@class, "col-sm-6")]'):
        titleNoFormatting = searchResult.xpath(
            './/div[@class="scene"]//div//h3//a')[0].text_content()
        curID = PAutils.Encode(
            searchResult.xpath('.//div[@class="scene"]//div//h3//a/@href')[0])
        releaseDate = searchData.dateFormat() if searchData.date else ''

        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #7
0
def search(results, lang, siteNum, searchData):
    sceneURL = PAsearchSites.getSearchSearchURL(
        siteNum) + searchData.encoded.replace('and', '&')
    req = PAutils.HTTPRequest(sceneURL)
    searchPageElements = HTML.ElementFromString(req.text)
    searchResults = searchPageElements.xpath('//article')
    for searchResult in searchResults:
        titleNoFormatting = searchResult.xpath('./h2/a/text()')[0].strip()
        curID = PAutils.Encode(searchResult.xpath('./h2/a/@href')[0])
        date = searchResult.xpath('./p/span[1]/text()')[0].strip()
        releaseDate = parse(date).strftime('%b %d, %Y')
        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())
        results.Append(
            MetadataSearchResult(id='%s|%d|%d' % (curID, siteNum, 0),
                                 name='%s [FamilyTherapy] %s' %
                                 (titleNoFormatting, releaseDate),
                                 score=score,
                                 lang=lang))

    if len(searchResults) == 0:
        Log("Using Clips4Sale")
        parts = searchData.title.split()
        if len(parts) > 2:
            title = (' ').join(parts[2:])
            actress = (' ').join(parts[:2])
        searchData.title = "81593 " + actress
        matches = siteClips4Sale.search(FakeResults(), lang, 760, searchData)
        for match in matches.list:
            match.name = clean(match.name)
            match.score = 100 - Util.LevenshteinDistance(
                title.lower(),
                re.search(r'.*(?=\[)', match.name.lower()).group().strip())
            match.id = ('|').join(
                [match.id.split('|')[0],
                 str(siteNum), str(1)])
            results.Append(match)

    return results
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//a[contains(@class, "movies")]'):
        titleNoFormatting = searchResult.xpath('.//img/@alt')[0].strip()
        curID = PAutils.Encode(searchResult.get('href'))

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

        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #9
0
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    sceneID = searchTitle.split(' ', 1)[0]
    try:
        sceneTitle = searchTitle.split(' ', 1)[1]
    except:
        sceneTitle = ''

    url = PAsearchSites.getSearchSearchURL(siteNum) + sceneID + '/1'
    req = PAutils.HTTPRequest(url)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//div[@class="wxt7nk-0 JqBNK"]//div[1]/h2'):
        titleNoFormatting = searchResult.xpath('//div[1]/h2')[0].text_content().replace('Trailer', '').strip()
        curID = PAutils.Encode(url)

        if sceneTitle:
            score = 100 - Util.LevenshteinDistance(sceneTitle.lower(), titleNoFormatting.lower())
        else:
            score = 90

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

    return results
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//div[@class="list-page-grid-container"]//div[@class="grid-item"]'
    ):
        titleNoFormatting = searchResult.xpath(
            './/span[@class="overlay-inner"]')[0].text_content().strip()
        curID = PAutils.Encode(
            searchResult.xpath('.//a[@class="boxcover"]/@href')[0])

        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #11
0
def search(results, lang, siteNum, search):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + search['encoded'])
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//div[contains(@class, "item-video")]'):
        titleNoFormatting = searchResult.xpath('./div[1]/a/@title')[0].strip()
        curID = PAutils.Encode('http:' +
                               searchResult.xpath('./div[1]/a/@href')[0])

        score = 100 - Util.LevenshteinDistance(search['title'].lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #12
0
def search(results, lang, siteNum, searchData):
    url = PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded

    headers = {}
    if lang in supported_lang:
        url = url.replace('://en.', '://%s.' % lang, 1)
        headers['Accept-Language'] = lang

    req = PAutils.HTTPRequest(url, headers=headers)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath(
            '//div[@id="search-results"]//li[contains(@class, "video-panel-item")]'
    ):
        sceneURL = searchResult.xpath('.//a/@href')[0]
        titleNoFormatting = searchResult.xpath(
            './/h4')[0].text_content().strip()

        curID = PAutils.Encode(sceneURL)

        date = searchResult.xpath(
            '//i[contains(@class, "fa-calendar")]/parent::dd')[0].text_content(
            ).strip()
        releaseDate = parse(date).strftime('%Y-%m-%d')

        if searchData.date and releaseDate:
            score = 100 - Util.LevenshteinDistance(searchData.date,
                                                   releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                                   titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    searchData.encoded = searchData.title.lower().replace(' ', '-')
    directURL = PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded + '.html'

    searchResults = [directURL]
    googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum)
    for sceneURL in googleResults:
        if '/trailers/' in sceneURL and sceneURL not in searchResults:
            searchResults.append(sceneURL)

    for sceneURL in searchResults:
        req = PAutils.HTTPRequest(sceneURL)
        detailsPageElements = HTML.ElementFromString(req.text)

        titleNoFormatting = detailsPageElements.xpath('//h1')[0].text_content().strip()
        curID = PAutils.Encode(sceneURL)

        score = 100 - Util.LevenshteinDistance(searchData.title, titleNoFormatting)

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

    return results
예제 #14
0
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded, cookies={'nats': 'MC4wLjMuNTguMC4wLjAuMC4w'})
    searchResults = HTML.ElementFromString(req.json()['html'])
    for searchResult in searchResults.xpath('//div[@class="card episode"]'):
        titleNoFormatting = searchResult.xpath('.//a[@class="text-km"] | .//a[@class="text-pf"] | .//a[@class="text-tf"]')[0].text_content().strip()

        sceneURL = searchResult.xpath('.//a[@class="text-km"] | .//a[@class="text-pf"] | .//a[@class="text-tf"]')[0].get('href')
        curID = PAutils.Encode(sceneURL)

        releaseDate = searchResult.xpath('.//span[@class="card-footer-item"]')[0].text_content().strip()
        if ', 20' not in releaseDate:
            releaseDate = releaseDate + ', ' + str(datetime.now().year)
        releaseDate = parse(releaseDate).strftime('%Y-%m-%d')

        if searchData.date:
            score = 100 - Util.LevenshteinDistance(searchData.date, releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    for searchPageNum in range(1, 3):
        req = PAutils.HTTPRequest(
            PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded +
            "/" + str(searchPageNum))
        searchResults = HTML.ElementFromString(req.text)

        for searchResult in searchResults.xpath(
                '//div[@class="thumbsHolder elipsTxt"]/div[1]/div[@class="echThumb"]'
        ):
            if searchResult.xpath('.//a[contains(@href, "/video")]'):
                titleNoFormatting = PAutils.parseTitle(
                    searchResult.xpath(
                        './/a[contains(@href, "/video")]/@title')[0], siteNum)
                curID = PAutils.Encode(
                    searchResult.xpath(
                        './/a[contains(@href, "/video")]//@href')[0])
                subSite = searchResult.xpath(
                    './/span[@class="faTxt"]')[0].text_content().strip()
                releaseDate = parse(
                    searchResult.xpath('.//span[@class="faTxt"]')
                    [1].text_content().strip()).strftime('%Y-%m-%d')

                if searchData.date:
                    score = 100 - Util.LevenshteinDistance(
                        searchData.date, releaseDate)
                else:
                    score = 100 - Util.LevenshteinDistance(
                        searchData.title.lower(), titleNoFormatting.lower())

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

    return results
예제 #16
0
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + encodedTitle)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//div[@class="item"]'):
        titleNoFormatting = searchResult.xpath(
            './/h4//a')[0].text_content().strip()
        curID = PAutils.Encode('https:' + searchResult.xpath('.//a/@href')[0])
        actors = searchResult.xpath('.//div[@class="item-featured"]//a')
        firstActor = actors[0].text_content().strip().title()

        score = 100 - Util.LevenshteinDistance(searchTitle.lower(),
                                               titleNoFormatting.lower())

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

    return results
예제 #17
0
def search(results, lang, siteNum, searchData):
    directURL = PAsearchSites.getSearchSearchURL(siteNum) + searchData.title.replace(' ', '-').lower() + '.html'

    searchResults = [directURL]
    googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum)
    for sceneURL in googleResults:
        if ('/video/' in sceneURL and sceneURL not in searchResults):
            searchResults.append(sceneURL)

    for sceneURL in searchResults:
        req = PAutils.HTTPRequest(sceneURL)
        if req.ok:
            detailsPageElements = HTML.ElementFromString(req.text)

            curID = PAutils.Encode(sceneURL)
            titleNoFormatting = detailsPageElements.xpath('//meta[@property="og:title"]/@content')[0].strip()

            score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

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

    return results
예제 #18
0
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//div[@class="episode__title"]'):
        titleNoFormatting = searchResult.xpath(
            './a/h2')[0].text_content().strip()
        curID = PAutils.Encode(searchResult.xpath('./a/@href')[0])
        subSite = searchResult.xpath('//head/title')[0].text_content().strip()
        releaseDate = searchData.dateFormat() if searchData.date else ''

        score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                               titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    searchData.encoded = searchData.title.replace(' ',
                                                  '+').replace('--',
                                                               '+').lower()
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)

    for searchResult in searchResults.xpath('//ul[@class="slides"]/li'):
        titleNoFormatting = PAutils.parseTitle(
            searchResult.xpath('.//h5')[0].text_content().strip(), siteNum)
        sceneURL = searchResult.xpath('.//@href')[0]
        curID = PAutils.Encode(sceneURL)

        date = searchResult.xpath('.//p/strong')[0].text_content().strip()
        if date:
            releaseDate = parse(date).strftime('%Y-%m-%d')
        else:
            releaseDate = searchData.dateFormat() if searchData.date else ''
        releaseDate = parse(date).strftime('%Y-%m-%d')
        displayDate = releaseDate if date else ''

        if searchData.date and displayDate:
            score = 100 - Util.LevenshteinDistance(searchData.date,
                                                   releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                                   titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    searchData.encoded = searchData.title.lower().replace(' ', '-')
    directURL = PAsearchSites.getSearchSearchURL(
        siteNum) + searchData.encoded + '.html'

    searchResults = [directURL]
    googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum)
    for sceneURL in googleResults:
        if '/trailers/' in sceneURL and sceneURL not in searchResults:
            searchResults.append(sceneURL)

    for sceneURL in searchResults:
        req = PAutils.HTTPRequest(sceneURL)
        if not req.text == 'Page not found':
            detailsPageElements = HTML.ElementFromString(req.text)
            titleNoFormatting = detailsPageElements.xpath(
                '//meta[@name="twitter:title"]/@content')[0].strip()
            curID = PAutils.Encode(sceneURL)

            date = detailsPageElements.xpath(
                '//div[@class="trailer topSpace"]/div[2]/p')[0].text_content(
                ).split('\\')[1].strip()
            releaseDate = parse(date).strftime('%Y-%m-%d')

            if searchData.date:
                score = 100 - Util.LevenshteinDistance(searchData.date,
                                                       releaseDate)
            else:
                score = 100 - Util.LevenshteinDistance(searchData.title,
                                                       titleNoFormatting)

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

    return results
예제 #21
0
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//div[@class="video-item"]'):
        titleNoFormatting = searchResult.xpath('.//div[@class="video-title"]//a')[0].text_content()
        sceneUrl = searchResult.xpath('.//a[contains(@class, "play")]/@href')[0]
        curID = PAutils.Encode(sceneUrl)
        releaseDate = parse(searchResult.xpath('.//div[@class="info"]')[0].text_content()[-30:].strip()).strftime('%Y-%m-%d')

        actorList = []
        for actor in searchResult.xpath('.//div[@class="info"]//a'):
            actorList.append(actor.text_content())
        actors = ', '.join(actorList)

        if searchData.date:
            score = 100 - Util.LevenshteinDistance(searchData.date, releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

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

    return results
예제 #22
0
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    searchTitle = searchTitle.replace(' AND ', ' and ').replace(
        ' And ', ' and ').replace(' In ', ' in ').replace(' At ', ' at ')
    parse_siteName = searchTitle.rsplit(' at ', 1)
    if len(parse_siteName) > 1:
        siteName = parse_siteName[1].strip()
    else:
        siteName = ''

    parse_sceneName = parse_siteName[0].split(' in ', 1)
    if len(parse_sceneName) > 1:
        sceneName = parse_sceneName[1].strip().title()
    else:
        sceneName = ''

    actors = parse_sceneName[0].split(' and ')
    actorsFormatted = []
    for actor in actors:
        actorsFormatted.append(actor.strip().title())
    displayName = ', '.join(actorsFormatted)
    curID = PAutils.Encode(displayName)

    if searchDate:
        releaseDate = parse(searchDate).strftime('%Y-%m-%d')
    else:
        releaseDate = ''

    score = 100

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

    return results
def search(results, lang, siteNum, searchData):
    searchJAVID = None
    splitSearchTitle = searchData.title.split()
    if len(splitSearchTitle) > 1:
        if unicode(splitSearchTitle[1], 'UTF-8').isdigit():
            searchJAVID = '%s%%2B%s' % (splitSearchTitle[0], splitSearchTitle[1])

    if searchJAVID:
        searchData.encoded = searchJAVID

    searchTypes = [
        'Censored',
        'Uncensored'
    ]

    for searchType in searchTypes:
        if searchType == 'Uncensored':
            sceneURL = PAsearchSites.getSearchSearchURL(siteNum) + 'uncensored/search/' + searchData.encoded
        elif searchType == 'Censored':
            sceneURL = PAsearchSites.getSearchSearchURL(siteNum) + 'search/' + searchData.encoded

        req = PAutils.HTTPRequest(sceneURL)
        searchResults = HTML.ElementFromString(req.text)
        for searchResult in searchResults.xpath('//a[@class="movie-box"]'):
            titleNoFormatting = searchResult.xpath('.//span[1]')[0].text_content().replace('\t', '').replace('\r\n', '').strip()
            JAVID = searchResult.xpath('.//date[1]')[0].text_content().strip()

            sceneURL = searchResult.xpath('./@href')[0]
            curID = PAutils.Encode(sceneURL)

            if searchJAVID:
                score = 100 - Util.LevenshteinDistance(searchJAVID.lower(), JAVID.lower())
            else:
                score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    directURL = PAsearchSites.getSearchSearchURL(
        siteNum) + searchData.title.replace(' ', '-').lower()

    searchResults = [directURL]
    googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum)
    for sceneURL in googleResults:
        if ('/scenes/' in sceneURL and sceneURL not in searchResults):
            searchResults.append(sceneURL)

    for sceneURL in searchResults:
        req = PAutils.HTTPRequest(sceneURL)
        if req.ok:
            detailsPageElements = HTML.ElementFromString(req.text)
            curID = PAutils.Encode(sceneURL)
            titleNoFormatting = detailsPageElements.xpath(
                '//h1')[0].text_content().strip()
            releaseDate = parse(
                detailsPageElements.xpath('//time/@datetime')[0]).strftime(
                    '%Y-%m-%d')

            if searchData.date:
                score = 100 - Util.LevenshteinDistance(searchData.date,
                                                       releaseDate)
            else:
                score = 100 - Util.LevenshteinDistance(
                    searchData.title.lower(), titleNoFormatting.lower())

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

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

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

    for searchResult in searchResults['terms']:
        if searchResult['type'] == 'scene':
            titleNoFormatting = PAutils.parseTitle(searchResult['name'],
                                                   siteNum)

            sceneURL = searchResult['url']
            curID = PAutils.Encode(sceneURL)

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

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

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

    return results
예제 #26
0
def search(results, lang, siteNum, searchData):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    pattern = re.compile(r'(?<=scene\/)(.*?)(?=\/)')
    for searchResult in searchResults.xpath(
            '//div[contains(@class, "scene")]'):
        titleNoFormatting = searchResult.xpath(
            './/h3[@itemprop="name"]')[0].text_content()
        curID = PAutils.Encode(searchResult.xpath('.//a/@href')[0])
        releaseDate = searchData.dateFormat() if searchData.date else ''

        subSite = pattern.search(
            searchResult.xpath('.//div[@class="card-footer"]//a/@href')
            [0].strip()).group(0)
        subSiteNum = PAsearchSites.getSiteNumByFilter(subSite)
        if subSiteNum == siteNum:
            siteScore = 10
        else:
            siteScore = 0

        score = siteScore + 90 - Util.LevenshteinDistance(
            searchData.title.lower(), titleNoFormatting.lower())

        if subSiteNum:
            subSiteName = PAsearchSites.getSearchSiteName(
                PAsearchSites.getSiteNumByFilter(subSite))
        else:
            subSiteName = ''

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

    return results
예제 #27
0
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate):
    req = PAutils.HTTPRequest(
        PAsearchSites.getSearchSearchURL(siteNum) + encodedTitle)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//section[@role="main"]/article'):
        titleNoFormatting = searchResult.xpath(
            './/h2[@itemprop="name"]')[0].text_content().strip()
        sceneURL = searchResult.xpath('./a/@href')[0]
        if not sceneURL.startswith('http'):
            sceneURL = PAsearchSites.getSearchBaseURL(siteNum) + sceneURL
        curID = PAutils.Encode(sceneURL)

        date = searchResult.xpath(
            './/td/h2[not(@class)]')[0].text_content().replace(
                'PUBLISHED:', '').replace('&nbsp', ' ').strip()
        if date:
            releaseDate = parse(date).strftime('%Y-%m-%d')
        else:
            releaseDate = parse(searchDate).strftime(
                '%Y-%m-%d') if searchDate else ''
        displayDate = releaseDate if date else ''

        if searchDate and displayDate:
            score = 100 - Util.LevenshteinDistance(searchDate, releaseDate)
        else:
            score = 100 - Util.LevenshteinDistance(searchTitle.lower(),
                                                   titleNoFormatting.lower())

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

    return results
예제 #28
0
def search(results, lang, siteNum, search):
    searchResults = []

    directURL = PAsearchSites.getSearchSearchURL(
        siteNum) + search['title'].lower().replace(' ', '-')
    if unicode(directURL[-1], 'UTF-8').isdigit() and directURL[-2] == '-':
        directURL = '%s-%s' % (directURL[:-1], directURL[-1])
    searchResults.append(directURL)

    googleResults = PAutils.getFromGoogleSearch(search['title'], siteNum)
    for sceneURL in googleResults:
        if ('/video/' in sceneURL and sceneURL not in searchResults):
            searchResults.append(sceneURL)

    for sceneURL in searchResults:
        req = PAutils.HTTPRequest(sceneURL)
        if 'signup.' not in req.url:
            detailsPageElements = HTML.ElementFromString(req.text)
            titleNoFormatting = detailsPageElements.xpath(
                '//h1')[0].text_content().strip()
            curID = PAutils.Encode(sceneURL)

            releaseDate = parse(
                search['date']).strftime('%Y-%m-%d') if search['date'] else ''

            score = 100 - Util.LevenshteinDistance(search['title'].lower(),
                                                   titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    searchData.encoded = searchData.title.replace(' a ', ' ')

    req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded)
    searchResults = HTML.ElementFromString(req.text)
    for searchResult in searchResults.xpath('//a[contains(@class, "thumbnail")]'):
        titleNoFormatting = searchResult.xpath('.//h3[@class="scene-title"]')[0].text_content().strip()
        curID = PAutils.Encode(searchResult.get('href').split('?')[0])
        releaseDate = searchData.dateFormat() if searchData.date else ''
        fullSubSite = searchResult.xpath('.//div/p[@class="help-block"]')[0].text_content().strip()

        if 'BehindTheScenes' in fullSubSite and 'BTS' not in titleNoFormatting:
            titleNoFormatting = titleNoFormatting + ' BTS'
        subSite = fullSubSite.split('.com')[0]

        if subSite == PAsearchSites.getSearchSiteName(siteNum):
            score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())
        else:
            score = 60 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower())

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

    return results
def search(results, lang, siteNum, searchData):
    url = PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded
    searchResults = getSiteData(url)
    for searchResult in searchResults.xpath(
            '//div[contains(@class, "items")]/a[contains(@class, "scene")]'):
        sceneURL = searchResult.xpath('./@href')[0]
        if not sceneURL.startswith('http'):
            titleNoFormatting = searchResult.xpath('./img/@alt')[0]
            curID = PAutils.Encode(sceneURL)

            score = 100 - Util.LevenshteinDistance(searchData.title.lower(),
                                                   titleNoFormatting.lower())

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

    return results