def search(results, lang, siteNum, searchData): searchResultsURLs = [] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) if searchData.title.count(' ') > 1: directSearch = searchData.title.replace(' ', '-').lower() else: directSearch = searchData.title.replace(' ', '') searchResultsURLs.append( '%s/models/%s.html' % (PAsearchSites.getSearchBaseURL(siteNum), directSearch)) for searchResultURL in googleResults: if searchResultURL not in searchResultsURLs: if '/models/' in searchResultURL: searchResultsURLs.append(searchResultURL) for modelURL in searchResultsURLs: req = PAutils.HTTPRequest(modelURL) pageElements = HTML.ElementFromString(req.text) for sceneResult in pageElements.xpath( '//div[contains(@class, "latest-updates")]//div[@data-setid]'): sceneLink = sceneResult.xpath( './/div[contains(@class, "text-info")]//a[contains(@class, "text-sm")]' )[0] curID = PAutils.Encode(sceneLink.xpath('./@href')[0]) titleNoFormatting = sceneLink.text_content().strip() poster = PAutils.Encode( sceneResult.xpath('.//a[@class="updateimg"]//img/@src0_3x')[0]) releaseDate = sceneResult.xpath( './/div[contains(@class, "video-data")]/span[2]' )[0].text_content() score = 100 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower()) results.Append( MetadataSearchResult( id='%s|%d|%s|%s' % (curID, siteNum, releaseDate, poster), name='%s [FPN/%s] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): sceneID = None splited = searchTitle.split(' ') searchResults = [] if unicode(splited[0], 'UTF-8').isdigit(): sceneID = splited[0] searchTitle = searchTitle.replace(sceneID, '', 1).strip() directURL = PAsearchSites.getSearchSearchURL( siteNum) + sceneID + '.html' searchResults.append(directURL) googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: if ('/update/' in sceneURL) and sceneURL not in searchResults: searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) curID = PAutils.Encode(sceneURL) titleDate = detailsPageElements.xpath( '//title')[0].text_content().split('Released') titleNoFormatting = titleDate[0].strip() date = titleDate[-1].replace('!', '').strip() releaseDate = parse(date).strftime('%Y-%m-%d') if searchDate: 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 [%s] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): directURL = PAsearchSites.getSearchSearchURL( siteNum) + searchData.title.lower().replace(' ', '-').replace( '\'', '-') searchResults = [directURL] if unicode(directURL[-1], 'UTF-8').isdigit() and directURL[-2] == '-': directURL = '%s-%s' % (directURL[:-1], directURL[-1]) searchResults.append(directURL) googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if ('/video/' in sceneURL and sceneURL not in searchResults): searchResults.append(sceneURL) searchResults = list( dict.fromkeys( [sceneURL.replace('www.', '', 1) for sceneURL in searchResults])) for sceneURL in searchResults: if sceneURL == directURL.replace('www.', '', 1): for original, new in plurals.items(): sceneURL = sceneURL.replace(original, new) 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 = 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] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchResults = [] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if ('/search/' not in sceneURL and '/page/' not in sceneURL and '/tag/' not 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) if detailsPageElements.xpath('//meta[@property="og:type"]/@content' )[0].strip() == 'video': titleNoFormatting = detailsPageElements.xpath( '//meta[@property="og:title"]/@content')[0].strip() curID = PAutils.Encode(sceneURL) date = detailsPageElements.xpath( '//div[@class="post_date"]')[0].text_content().strip() if date: releaseDate = parse(date).strftime('%Y-%m-%d') else: releaseDate = searchData.dateFormat( ) if searchData.date else '' 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.replace(' ', '-') searchResultsURLs = [ PAsearchSites.getSearchSearchURL(siteNum) + 'updates/' + searchData.encoded + '.html', PAsearchSites.getSearchSearchURL(siteNum) + 'updates/' + searchData.encoded + '-.html', PAsearchSites.getSearchSearchURL(siteNum) + 'updates/' + searchData.encoded + '-4k.html', PAsearchSites.getSearchSearchURL(siteNum) + 'dvds/' + searchData.encoded + '.html' ] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if sceneURL not in searchResultsURLs: if (('/updates/' in sceneURL or '/dvds/' in sceneURL or '/scenes/' in sceneURL) and '/tour_ns/' in sceneURL) and sceneURL not in searchResultsURLs: searchResultsURLs.append(sceneURL) for sceneURL in searchResultsURLs: req = PAutils.HTTPRequest(sceneURL) if req.ok: try: searchResult = HTML.ElementFromString(req.text) titleNoFormatting = searchResult.xpath( '(//div[@class="indScene"] | //div[@class="indSceneDVD"])/h1' )[0].text_content().strip() curID = PAutils.Encode(sceneURL) score = 100 - Util.LevenshteinDistance( searchData.title.lower(), titleNoFormatting.lower()) results.Append( MetadataSearchResult(id='%s|%d' % (curID, siteNum), name='%s [New Sensations]' % titleNoFormatting, score=score, lang=lang)) except: pass return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): sceneID = searchTitle.split(' ', 1)[0] if unicode(sceneID, 'UTF-8').isdigit(): searchTitle = searchTitle.replace(sceneID, '', 1).strip() else: sceneID = None directURL = PAsearchSites.getSearchSearchURL(siteNum) + sceneID searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: if ('/videos/' in sceneURL and sceneURL not in searchResults): searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) if req.ok: searchResults = HTML.ElementFromString(req.text) titleNoFormatting = searchResults.xpath( '//h1[@class="customhcolor"]')[0].text_content() curID = PAutils.Encode( PAsearchSites.getSearchSearchURL(siteNum) + sceneID) releaseDate = '' date = searchResults.xpath( '//div[@class="date"]')[0].text_content().strip() if date: releaseDate = parse(date).strftime('%Y-%m-%d') 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] %s %s' % (PAsearchSites.getSearchSiteName(siteNum), titleNoFormatting, releaseDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchResults = [] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: sceneURL = sceneURL.replace('/cn/', '/').replace('/de/', '/').replace('/jp/', '/').replace('/ja/', '/').replace('/en/', '/') if '/nude_girl/' not in sceneURL and '/shoots/' not in sceneURL and '/fetish/' not in sceneURL and '/updates/' not in sceneURL and sceneURL not in searchResults: searchResults.append(sceneURL) prevModelURL = '' for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) titleNoFormatting = PAutils.parseTitle(detailsPageElements.xpath('//title')[0].text_content().split(':')[-1].split('|')[0].strip(), siteNum) subSite = PAutils.parseTitle(detailsPageElements.xpath('//div[@id="shoot-featured-image"]//h4')[0].text_content().strip(), siteNum) curID = PAutils.Encode(sceneURL) modelURL = detailsPageElements.xpath('//tr[contains(.,"Scene")]//a/@href')[0] if not modelURL == prevModelURL: req = PAutils.HTTPRequest(modelURL) actorPageElements = HTML.ElementFromString(req.text) prevModelURL = modelURL date = '' for scene in actorPageElements.xpath('//article[@class="card card-shoot"]'): if titleNoFormatting.lower() == scene.xpath('.//h2')[0].text_content().strip().lower() and subSite.lower() == scene.xpath('.//h3/text()')[0].strip().lower(): date = scene.xpath('.//span')[0].text_content().strip() break if date: releaseDate = parse(date).strftime('%Y-%m-%d') else: releaseDate = searchData.dateFormat() if searchData.date else '' 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 [Abby Winters/%s] %s' % (titleNoFormatting, subSite, displayDate), score=score, lang=lang)) return results
def search(results, encodedTitle, title, searchTitle, siteNum, lang, searchDate): directURL = PAsearchSites.getSearchSearchURL( siteNum) + searchTitle.replace(' ', '-').lower() + '/' searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: if ('/video/' in sceneURL and sceneURL not in searchResults): searchResults.append(sceneURL) for sceneURL in searchResults: detailsPageElements = None try: detailsPageElements = HTML.ElementFromURL(sceneURL) except: pass if detailsPageElements: curID = PAutils.Encode(sceneURL) titleNoFormatting = detailsPageElements.xpath( '//div[@class="single-part-details"]//h2')[0].text_content( ).strip() date = detailsPageElements.xpath( '//div[@class="video-info-left-icon"]//span[3]/text()' )[0].strip() releaseDate = datetime.strptime(date, '%d%b,%Y') if searchDate: 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 [%s]' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum)), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchData.encoded = searchData.title.lower().replace(' ', '-') directURL = PAsearchSites.getSearchSearchURL(siteNum).replace('/search.php?query=', '/trailers/') + searchData.encoded + '.html' directResults = [directURL] req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + searchData.encoded) searchResults = HTML.ElementFromString(req.text) for searchResult in searchResults.xpath('//div[contains(@class, "item-video")]'): sceneURL = searchResult.xpath('./div[1]//a/@href')[0] time = searchResult.xpath('.//div[contains(@class, "time")]/text()')[0].strip() if time.replace(':', '').isdigit(): if not sceneURL.startswith('http'): sceneURL = 'http:' + sceneURL directResults.append(sceneURL) googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if '/trailers/' in sceneURL and sceneURL not in searchResults: directResults.append(sceneURL) for sceneURL in directResults: try: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) titleNoFormatting = detailsPageElements.xpath('//h1 | //h3')[0].text_content().strip() curID = PAutils.Encode(sceneURL) date = detailsPageElements.xpath('//div[contains(@class, "videoInfo")]/p/text()') if date: releaseDate = parse(date[0].strip()).strftime('%Y-%m-%d') else: 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] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) except: pass return results
def search(results, lang, siteNum, searchData): searchResults = [] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if '/session/' in sceneURL not in searchResults: searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) titleNoFormatting = PAutils.parseTitle( detailsPageElements.xpath('//h3[@class="mas_title"]') [0].text_content().strip(), siteNum) subSite = detailsPageElements.xpath('//title')[0].text_content().split( '|')[1].strip().replace('.com', '') curID = PAutils.Encode(sceneURL) date = ' '.join( detailsPageElements.xpath('//div[@class="lch"]/span') [0].text_content().rsplit(',', 2)[1:]).strip() if date: releaseDate = parse(date).strftime('%Y-%m-%d') else: releaseDate = searchData.dateFormat() if searchData.date else '' 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, subSite, displayDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchResults = [] sceneID = searchData.title.split(' ', 1)[0] if unicode(sceneID, 'UTF-8').isdigit(): searchData.title = searchData.title.replace(sceneID, '', 1).strip() else: sceneID = None if sceneID: searchResults.append( PAsearchSites.getSearchSearchURL(siteNum) + sceneID) if searchData.title: 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) detailsPageElements = HTML.ElementFromString(req.text) titleNoFormatting = detailsPageElements.xpath( '//h1')[0].text_content().strip() curID = PAutils.Encode(sceneURL) releaseDate = searchData.dateFormat() if searchData.date else '' if sceneID and sceneID in sceneURL: score = 100 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
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): directURL = searchTitle.replace(' ', '-').lower() searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: sceneURL = sceneURL.split('?', 1)[0] sceneName = None if ('/movies/' in sceneURL): sceneName = sceneURL.split('/')[-1] elif unicode(sceneURL.split('/')[-3]).isdigit(): sceneName = sceneURL.split('/')[-1] if sceneName and sceneName not in searchResults: searchResults.append(sceneName) dbURL = getDBURL(PAsearchSites.getSearchBaseURL(siteNum)) for sceneName in searchResults: for sceneType in ['videoscontent', 'moviescontent']: detailsPageElements = getDataFromAPI(dbURL, sceneType, sceneName, siteNum) if detailsPageElements: break if detailsPageElements: curID = detailsPageElements['id'] titleNoFormatting = PAutils.parseTitle(detailsPageElements['title'], siteNum) siteName = detailsPageElements['site']['name'] if 'site' in detailsPageElements else PAsearchSites.getSearchSiteName(siteNum) if 'publishedDate' in detailsPageElements: releaseDate = parse(detailsPageElements['publishedDate']).strftime('%Y-%m-%d') else: releaseDate = parse(searchDate).strftime('%Y-%m-%d') if searchDate else '' displayDate = releaseDate if 'publishedDate' in detailsPageElements 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|%s' % (curID, siteNum, releaseDate, sceneType), name='%s [%s] %s' % (titleNoFormatting, siteName, displayDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, search): searchResults = [] googleResults = PAutils.getFromGoogleSearch(search['title'], siteNum, lang='enes') for sceneURL in googleResults: sceneURL = sceneURL.replace('index.php/', '') sceneURL = sceneURL.replace('es/', '') if '/tags/' not in sceneURL and '/actr' not in sceneURL and '?pag' not in sceneURL and '/xvideos' not in sceneURL and '/tag/' not in sceneURL and sceneURL not in searchResults: searchResults.append(sceneURL) if '/en/' in sceneURL: searchResults.append(sceneURL.replace('en/', '')) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) try: if '/en/' in sceneURL: language = 'English' titleNoFormatting = PAutils.parseTitle(detailsPageElements.xpath('//title')[0].text_content().split('|')[0].split('-')[0].strip(), siteNum) else: language = 'Español' titleNoFormatting = detailsPageElements.xpath('//title')[0].text_content().split('|')[0].split('-')[0].strip() curID = PAutils.Encode(sceneURL) date = detailsPageElements.xpath('//div[@class="released-views"]/span')[0].text_content().strip() if date: releaseDate = datetime.strptime(date, '%d/%m/%Y').strftime('%Y-%m-%d') else: releaseDate = parse(search['date']).strftime('%Y-%m-%d') if search['date'] else '' 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' % (curID, siteNum), name='%s {%s} [%s] %s' % (titleNoFormatting, language, PAsearchSites.getSearchSiteName(siteNum), displayDate), score=score, lang=lang)) except: pass return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): searchResults = [] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: sceneURL = sceneURL.replace('www.', '') if ('trailers' in sceneURL ) and 'as3' not 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() subSite = detailsPageElements.xpath( '//div[@class="about"]//h3')[0].text_content().replace( 'About', '').strip() curID = PAutils.Encode(sceneURL) date = '' 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' % (curID, siteNum), name='%s [PervCity/%s]' % (titleNoFormatting, subSite), score=score, lang=lang)) return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): searchResultsURLs = [] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: if sceneURL not in searchResultsURLs: url = None if '/scene/' in sceneURL: url = sceneURL else: for item in ['/trailers/', '/updates/']: if item in sceneURL: url = sceneURL.replace(item, '/1/scene/').replace('.html', '/') break if url and url not in searchResultsURLs: searchResultsURLs.append(url) for url in searchResultsURLs: req = PAutils.HTTPRequest(url) detailsPageElements = HTML.ElementFromString(req.text) curID = PAutils.Encode(url) titleNoFormatting = detailsPageElements.xpath('//h4')[0].text_content().strip() 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='%s [FPN/%s] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) encodedTitle = searchTitle.replace(' ', '_') req = PAutils.HTTPRequest(PAsearchSites.getSearchSearchURL(siteNum) + encodedTitle) searchResults = HTML.ElementFromString(req.text) for searchResult in searchResults.xpath('//div[contains(@class, "section-updates")]'): curID = PAutils.Encode(searchResult.xpath('.//a/@href')[0]) titleNoFormatting = searchResult.xpath('.//div[contains(@class, "scene-info")]//a')[0].text_content().strip() poster = searchResult.xpath('.//img/@src')[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|%s' % (curID, siteNum, releaseDate, poster), name='%s [FPN/%s] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), 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 ('/virtualreality/' in sceneURL and sceneURL not in searchResults and '/virtualreality/list' not in sceneURL): searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) if req.ok: detailsPageElements = HTML.ElementFromString(req.text) if detailsPageElements: curID = PAutils.Encode(sceneURL) titleNoFormatting = detailsPageElements.xpath( '//div[contains(@class, "video-details")]//h1[1]' )[0].text_content().strip() date = detailsPageElements.xpath( '//div[@class="stats-container"]//li[3]//span[2]' )[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 [%s]' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum)), score=score, lang=lang)) return results
def search(results, encodedTitle, searchTitle, siteNum, lang, searchDate): encodedTitle = searchTitle.replace(' ', '-') searchResultsURLs = [ PAsearchSites.getSearchSearchURL(siteNum) + 'updates/' + encodedTitle + '.html', PAsearchSites.getSearchSearchURL(siteNum) + 'updates/' + encodedTitle + '-.html', PAsearchSites.getSearchSearchURL(siteNum) + 'dvds/' + encodedTitle + '.html' ] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: if sceneURL not in searchResultsURLs: if (('/updates/' in sceneURL or '/dvds/' in sceneURL or '/scenes/' in sceneURL) and '/tour_ns/' in sceneURL) and sceneURL not in searchResultsURLs: searchResultsURLs.append(sceneURL) for sceneURL in searchResultsURLs: req = PAutils.HTTPRequest(sceneURL) if req.ok: searchResult = HTML.ElementFromString(req.text) titleNoFormatting = searchResult.xpath( '(//div[@class="trailerVideos clear"] | //div[@class="dvdSections clear"])/div[1]' )[0].text_content().replace('DVDS /', '').strip() curID = PAutils.Encode(sceneURL) 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='%s [New Sensations]' % titleNoFormatting, score=score, lang=lang)) return results
def search(results, lang, siteNum, search): searchResults = [] googleResults = PAutils.getFromGoogleSearch(search['title'], siteNum) for sceneURL in googleResults: if ('/tour1/' in sceneURL and sceneURL.endswith('.html') and sceneURL not in searchResults): searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) curID = PAutils.Encode(sceneURL) titleNoFormatting = detailsPageElements.xpath('//h1')[0].text_content().strip() releaseDate = search['date'] 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]' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum)), score=score, lang=lang)) return results
def search(results, lang, siteNum, search): directURL = PAsearchSites.getSearchSearchURL( siteNum) + search['title'].replace(' ', '-').lower() + '.html' searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(search['title'], siteNum) for sceneURL in googleResults: if ('/updates/' in sceneURL and sceneURL not in searchResults): searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) if detailsPageElements: curID = PAutils.Encode(sceneURL) titleNoFormatting = detailsPageElements.xpath( '//title')[0].text_content().strip() date = detailsPageElements.xpath( '//span[(contains(@class, "update_date"))]')[0].text_content( ).strip() releaseDate = datetime.strptime(date, '%m/%d/%Y').strftime('%Y-%m-%d') if search['date']: score = 100 - Util.LevenshteinDistance(search['date'], releaseDate) else: 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
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() searchResults = [] if sceneID: directURL = PAsearchSites.getSearchSearchURL(siteNum) + sceneID searchResults.append(directURL) googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: sceneURL = re.sub(r'www\.', '', sceneURL) sceneURL = re.sub(r'/(?<=\d/).*', '', sceneURL) if '/videos/' in sceneURL and '/page/' not 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) date = detailsPageElements.xpath('//div[@class="date"]')[0].text_content().strip() try: releaseDate = parse(date).strftime('%Y-%m-%d') except: releaseDate = '' 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
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 ('/scene/' in sceneURL and sceneURL not in searchResults): searchResults.append(sceneURL) for sceneURL in searchResults: req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) if detailsPageElements: curID = PAutils.Encode(sceneURL) titleNoFormatting = detailsPageElements.xpath( '//h1')[0].text_content().strip() date = detailsPageElements.xpath( '//span[@class="date-display-single"] | //span[@class="u-inline-block u-mr--nine"] | //div[@class="video-meta-date"] | //div[@class="date"]' )[0].text_content().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.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
def search(results, lang, siteNum, searchData): searchData.encoded = searchData.title.replace(' ', '-') searchResults = [] googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for sceneURL in googleResults: if ('/updates/' in sceneURL and '/tour_hwxxx/' 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) titleNoFormatting = detailsPageElements.xpath( '//div[@class="trailerInfo"]/h2')[0].text_content().strip() date = detailsPageElements.xpath( '//div[@class="trailerInfo"]/div[@class="released2 trailerStarr"]' )[0].text_content().strip().split(',')[0] releaseDate = parse(date).strftime('%Y-%m-%d') curID = PAutils.Encode(sceneURL) 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
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
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
def search(results, lang, siteNum, search): search['encoded'] = search['title'].lower().replace(' ', '-') directURL = PAsearchSites.getSearchSearchURL( siteNum) + search['encoded'] + '.html' searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(search['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 search['date']: score = 100 - Util.LevenshteinDistance(search['date'], releaseDate) else: score = 100 - Util.LevenshteinDistance(search['title'], titleNoFormatting) results.Append( MetadataSearchResult(id='%s|%d' % (curID, siteNum), name='%s [GirlsOutWest] %s' % (titleNoFormatting, releaseDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, search): directURL = PAsearchSites.getSearchSearchURL( siteNum) + search['title'].replace(' ', '-').lower() searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(search['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 search['date']: score = 100 - Util.LevenshteinDistance(search['date'], releaseDate) else: score = 100 - Util.LevenshteinDistance( search['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
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, encodedTitle, title, searchTitle, siteNum, lang, searchByDateActor, searchDate, searchSiteID): if searchSiteID != 9999: siteNum = searchSiteID directURL = '%s%s.html' % (PAsearchSites.getSearchSearchURL(siteNum), searchTitle.lower().replace(' ', '-')) searchResults = [directURL] googleResults = PAutils.getFromGoogleSearch(searchTitle, siteNum) for sceneURL in googleResults: sceneURL = sceneURL.lower() if ('/trailers/' in sceneURL) and sceneURL not in searchResults: searchResults.append(sceneURL) for sceneURL in searchResults: data = PAutils.HTTPRequest(sceneURL) if data and data != 'Page not found': searchResult = HTML.ElementFromString(data) titleNoFormatting = searchResult.xpath( '//h2[@class="title"]/text()')[0] curID = String.Encode(sceneURL) releaseDate = parse(searchDate) if searchDate else '' score = 100 - Util.LevenshteinDistance(searchTitle, titleNoFormatting) results.Append( MetadataSearchResult( id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [Girls Rimming]' % titleNoFormatting, score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchResults = [] 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 req.ok: detailsPageElements = HTML.ElementFromString(req.text) curID = PAutils.Encode(sceneURL) titleNoFormatting = PAutils.parseTitle(detailsPageElements.xpath('//div[@class="trailer_videoinfo"]//h3')[0].text_content().strip(), siteNum) releaseDate = None dateNode = detailsPageElements.xpath('//div[@class="trailer_videoinfo"]//p[contains(., "Added")]') if dateNode: date = None try: date = dateNode[0].text_content().split('-')[1].strip() except: pass if date: 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 [%s] %s' % (titleNoFormatting, PAsearchSites.getSearchSiteName(siteNum), releaseDate), score=score, lang=lang)) return results
def search(results, lang, siteNum, searchData): searchResults = [] siteResults = [] temp = [] count = 0 sceneID = None parts = searchData.title.split() if unicode(parts[0], 'UTF-8').isdigit(): sceneID = parts[0] if int(sceneID) > 100: searchData.title = searchData.title.replace(sceneID, '', 1).strip() movieURL = '%s/movies/%s' % ( PAsearchSites.getSearchBaseURL(siteNum), sceneID) searchResults.append(movieURL) searchData.encoded = searchData.title.replace(' ', '+') searchURL = '%s%s' % (PAsearchSites.getSearchSearchURL(siteNum), searchData.encoded) req = PAutils.HTTPRequest(searchURL, headers={'Referer': 'http://www.data18.com'}) searchPageElements = HTML.ElementFromString(req.text) for searchResult in searchPageElements.xpath( '//a[contains(@href, "movies")]//parent::div[contains(@style, "float: left; padding")]' ): movieURL = searchResult.xpath('.//*[img]/@href')[0] urlID = re.sub(r'.*/', '', movieURL) if movieURL not in searchResults: titleNoFormatting = PAutils.parseTitle( searchResult.xpath('.//*[contains(@href, "movies")]') [1].text_content(), siteNum) curID = PAutils.Encode(movieURL) siteResults.append(movieURL) date = searchResult.text if date and not date == 'unknown': try: releaseDate = datetime.strptime( date, '%Y%m%d').strftime('%Y-%m-%d') except: releaseDate = '' else: releaseDate = searchData.dateFormat( ) if searchData.date else '' displayDate = releaseDate if date else '' if sceneID == urlID: score = 100 elif searchData.date and displayDate: score = 80 - Util.LevenshteinDistance(searchData.date, releaseDate) else: score = 80 - Util.LevenshteinDistance( searchData.title.lower(), titleNoFormatting.lower()) if score > 70: sceneURL = PAutils.Decode(curID) req = PAutils.HTTPRequest(sceneURL) detailsPageElements = HTML.ElementFromString(req.text) # Studio try: studio = detailsPageElements.xpath( '//i[contains(., "Network")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: studio = detailsPageElements.xpath( '//i[contains(., "Studio")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: studio = detailsPageElements.xpath( '//i[contains(., "Site")]//preceding-sibling::a[1]' )[0].text_content().strip() except: studio = '' if score == 80: count += 1 temp.append( MetadataSearchResult( id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [%s] %s' % (titleNoFormatting, studio, displayDate), score=score, lang=lang)) else: results.Append( MetadataSearchResult( id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [%s] %s' % (titleNoFormatting, studio, displayDate), score=score, lang=lang)) #Split Scenes sceneCount = detailsPageElements.xpath( '//text()[contains(., "Related Scenes")]')[0][-2] if sceneCount.isdigit(): sceneCount = int(sceneCount) else: sceneCount = 0 for sceneNum in range(1, sceneCount + 1): section = "Scene " + str(sceneNum) scene = PAutils.Encode( detailsPageElements.xpath( '//a[contains(., "%s")]/@href' % (section))[0]) if score == 80: count += 1 temp.append( MetadataSearchResult(id='%s|%d|%s|%s|%d' % (scene, siteNum, releaseDate, titleNoFormatting, sceneNum), name='%s [%s][%s] %s' % (titleNoFormatting, section, studio, displayDate), score=score, lang=lang)) else: results.Append( MetadataSearchResult(id='%s|%d|%s|%s|%d' % (scene, siteNum, releaseDate, titleNoFormatting, sceneNum), name='%s [%s][%s] %s' % (titleNoFormatting, section, studio, displayDate), score=score, lang=lang)) else: if score == 80: count += 1 temp.append( MetadataSearchResult( id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s %s' % (titleNoFormatting, displayDate), score=score, lang=lang)) else: results.Append( MetadataSearchResult( id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s %s' % (titleNoFormatting, displayDate), score=score, lang=lang)) googleResults = PAutils.getFromGoogleSearch(searchData.title, siteNum) for movieURL in googleResults: if ('/movies/' in movieURL and '.html' not in movieURL and movieURL not in searchResults and movieURL not in siteResults): searchResults.append(movieURL) for movieURL in searchResults: req = PAutils.HTTPRequest(movieURL) detailsPageElements = HTML.ElementFromString(req.text) urlID = re.sub(r'.*/', '', movieURL) try: siteName = detailsPageElements.xpath( '//i[contains(., "Network")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: siteName = detailsPageElements.xpath( '//i[contains(., "Studio")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: siteName = detailsPageElements.xpath( '//i[contains(., "Site")]//preceding-sibling::a[1]' )[0].text_content().strip() except: siteName = '' titleNoFormatting = PAutils.parseTitle( detailsPageElements.xpath('//h1')[0].text_content(), siteNum) curID = PAutils.Encode(movieURL) try: date = detailsPageElements.xpath('//p[contains(., "Release")]')[ 0].text_content().text_content().split(':')[2].strip() except: date = '' if date and not date == 'unknown': releaseDate = parse(date).strftime('%Y-%m-%d') else: releaseDate = searchData.dateFormat() if searchData.date else '' displayDate = releaseDate if date else '' if sceneID == urlID: score = 100 elif searchData.date and displayDate: score = 80 - Util.LevenshteinDistance(searchData.date, releaseDate) else: score = 80 - Util.LevenshteinDistance(searchData.title.lower(), titleNoFormatting.lower()) # Studio try: studio = detailsPageElements.xpath( '//i[contains(., "Network")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: studio = detailsPageElements.xpath( '//i[contains(., "Studio")]//preceding-sibling::a[1]' )[0].text_content().strip() except: try: studio = detailsPageElements.xpath( '//i[contains(., "Site")]//preceding-sibling::a[1]' )[0].text_content().strip() except: studio = '' if score == 80: count += 1 temp.append( MetadataSearchResult(id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [%s] %s' % (titleNoFormatting, studio, displayDate), score=score, lang=lang)) else: results.Append( MetadataSearchResult(id='%s|%d|%s' % (curID, siteNum, releaseDate), name='%s [%s] %s' % (titleNoFormatting, studio, displayDate), score=score, lang=lang)) #Split Scenes sceneCount = detailsPageElements.xpath( '//text()[contains(., "Related Scenes")]')[0][-2] if sceneCount.isdigit(): sceneCount = int(sceneCount) else: sceneCount = 0 for sceneNum in range(1, sceneCount + 1): section = "Scene " + str(sceneNum) scene = PAutils.Encode( detailsPageElements.xpath('//a[contains(., "%s")]/@href' % (section))[0]) if score == 80: count += 1 temp.append( MetadataSearchResult( id='%s|%d|%s|%s|%d' % (scene, siteNum, releaseDate, titleNoFormatting, sceneNum), name='%s [%s][%s] %s' % (titleNoFormatting, section, studio, displayDate), score=score, lang=lang)) else: results.Append( MetadataSearchResult( id='%s|%d|%s|%s|%d' % (scene, siteNum, releaseDate, titleNoFormatting, sceneNum), name='%s [%s][%s] %s' % (titleNoFormatting, section, studio, displayDate), score=score, lang=lang)) for result in temp: if count > 1 and result.score == 80: results.Append( MetadataSearchResult(id=result.id, name=result.name, score=79, lang=lang)) else: results.Append( MetadataSearchResult(id=result.id, name=result.name, score=result.score, lang=lang)) return results