def xhamster_photos(): ObjectContainer.art = R(STRAIGHT_ART) DirectoryObject.art = R(STRAIGHT_ART) oc = ObjectContainer(title2=L("Photos")) oc.add( DirectoryObject(key=Callback(xhamster_photos_album_list, url=XHAMSTER_PHOTOS, title=L("Last Added Albums")), title=L("Last Added"), summary=L("last added p**n photo albums"))) oc.add( DirectoryObject(key=Callback(xhamster_photos_album_categories), title=L("Categories"), summary=L("choose a category"))) oc.add( DirectoryObject(key=Callback(xhamster_photos_top), title=L("Top Rated"), summary=L("top rated p**n photos"))) oc.add( DirectoryObject(key=Callback(xhamster_photos_album_random), title=L("Random Album"), summary=L("show me a random p**n photo album"))) return oc
def xhamster_videos_straight_categories(): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_videos_straight_categories") oc = ObjectContainer(title2=L("Categories") + " - " + L("Straight"), no_cache=True) data = HTML.ElementFromURL(XHAMSTER_VIDEOS_CATEGORIES, cacheTime=0) xpath_string = '//div[text()="' + L( "Straight") + '"]/parent::div/following-sibling::div[1]/a' categories = data.xpath(xpath_string) # categories is a 5 column list. Order categories ordered_categories = [] for i in list(range(0, 5)): ordered_categories += categories[i::5] for category in ordered_categories: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(category)) try: url = category.xpath('./@href')[0] except: continue name = category.xpath('./text()')[-1].strip() oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=name, url=url), title=unicode(name))) return oc
def xhamster_photos_album_list(title, url, page=1): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_photos_album_list") oc = ObjectContainer(title2=unicode(title) + " | " + L("Page") + " " + str(page)) data = HTML.ElementFromURL(url) albums = data.xpath('//div[contains(@class, "gallery")]') for album in albums: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(album)) album_url = album.xpath('.//a/@href')[0] album_thumb = album.xpath('.//img/@src')[0] album_title = album.xpath('.//img/@title')[0] oc.add( PhotoAlbumObject( url=album_url, title=unicode(album_title), thumb=Resource.ContentsOfURLWithFallback(url=album_thumb), art=Resource.ContentsOfURLWithFallback(url=album_thumb))) next_a = data.xpath('//div[@class="pager"]//a[contains(@class,"last")]') if len(next_a) > 0: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(next_a[0])) oc.add( NextPageObject(key=Callback( xhamster_photos_album_list, title=title, url=next_a[0].xpath('./@href')[0], page=page + 1, ), title=L('Next') + ' >>')) return oc
def xhamster_videos_list(title, url, page=1): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_videos_list *** url " + url + " ***") oc = ObjectContainer(title2=unicode(title) + " | " + L("Page") + " " + str(page)) data = HTML.ElementFromURL(url) # TODO: exclude promoted videos videos = data.xpath('//div[contains(@class, "video")]') for video in videos: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(video)) video_url = video.xpath('.//a/@href')[0] video_thumb = video.xpath('.//img/@src')[0] video_title = video.xpath('.//img/@alt')[0].strip() oc.add( VideoClipObject( url=video_url, title=video_title, thumb=Resource.ContentsOfURLWithFallback(url=video_thumb), art=Resource.ContentsOfURLWithFallback(url=video_thumb))) next_a = data.xpath('//div[@class="pager"]//a[contains(@class,"last")]') if len(next_a) > 0: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(next_a[0])) oc.add( NextPageObject(key=Callback(xhamster_videos_list, title=title, url=next_a[0].xpath('./@href')[0], page=page + 1), title=L('Next') + ' >>')) return oc
def xhamster_photos_album_random(): oc = ObjectContainer(title2=L("Random Photo Album"), no_cache=True) random_album = xhamster_get_redirect_url(XHAMSTER_PHOTOS_RANDOM) oc.add(URLService.MetadataObjectForURL(random_album)) return oc
def xhamster_main_menu(): language = Prefs["language"].split("/")[1] HTTP.Headers['Accept-Language'] = str(language) if XHAMSTER_DEBUG: Log.Info("*** HEADERS *** " + str(HTTP.Headers)) oc = ObjectContainer(no_cache=True) oc.add( DirectoryObject(key=Callback(xhamster_videos), title=L("Videos"), summary=L("xHamster videos"))) oc.add( DirectoryObject(key=Callback(xhamster_photos), title=L("Photos"), summary=L("xHamster photos"))) if Client.Product != 'PlexConnect': oc.add( InputDirectoryObject(key=Callback(xhamster_search), title=L('Search xHamster Videos'), prompt=L('Search for xHamster Videos'), summary=L('Search for xHamster Videos'), thumb=R(SEARCH_ICON))) return oc
def xhamster_videos(): from xhamstervideostraight import xhamster_videos_straight from xhamstervideogays import xhamster_videos_gays from xhamstervideotranssexuals import xhamster_videos_transsexuals oc = ObjectContainer(title2=L("Videos")) oc.add( DirectoryObject(key=Callback(xhamster_videos_straight), title=L("Straight"), summary=L("straight videos"), thumb=R(STRAIGHT_ICON))) oc.add( DirectoryObject(key=Callback(xhamster_videos_gays), title=L("Gays"), summary=L("gay videos"), thumb=R(GAYS_ICON))) oc.add( DirectoryObject(key=Callback(xhamster_videos_transsexuals), title=L("Transsexuals"), summary=L("transsexual videos"), thumb=R(TRANSSEXUALS_ICON))) return oc
def xhamster_random(): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_random") oc = ObjectContainer(title2=L("Random Video"), no_cache=True) random_video = xhamster_get_redirect_url(XHAMSTER_VIDEOS_RANDOM) if XHAMSTER_DEBUG: Log.Info("*** redirect url " + random_video + " ***") oc.add(URLService.MetadataObjectForURL(random_video)) return oc
def xhamster_photos_top(): oc = ObjectContainer(title2=L("Top Rated Photos"), ) oc.add( PhotoAlbumObject(url=XHAMSTER_PHOTOS_TOP_7DAYS, title=L("Weekly"), summary=L("last week top rated p**n photo album"))) oc.add( PhotoAlbumObject(url=XHAMSTER_PHOTOS_TOP_30DAYS, title=L("Monthly"), summary=L("last month top rated p**n photo album"))) oc.add( PhotoAlbumObject(url=XHAMSTER_PHOTOS_TOP, title=L("All Time"), summary=L("all time top rated p**n photo album"))) return oc
def xhamster_photos_album_categories(): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_photos_album_categories") oc = ObjectContainer(title2=L("Photo Albums Categories"), no_cache=True) data = HTML.ElementFromURL(XHAMSTER_PHOTOS_CATEGORIES, cacheTime=0) categories = data.xpath('//div[@id="menuLeft"]/div[@class="list"][1]/a') for category in categories: if XHAMSTER_DEBUG: Log.Info(HTML.StringFromElement(category)) try: url = category.xpath('./@href')[0] except: continue name = category.xpath('./text()')[-1].strip() oc.add( DirectoryObject(key=Callback(xhamster_photos_album_list, title=name, url=url), title=unicode(name))) return oc
def xhamster_videos_straight_top(): if XHAMSTER_DEBUG: Log.Info("[XHAMSTER] xhamster_videos_straight_top") oc = ObjectContainer(title2=L("Top Rated") + " - " + L("Straight"), ) # We have to force fetching the headers or CookiesForURL won't work request = HTTP.Request(XHAMSTER_VIDEOS_LATEST_STRAIGHT) headers = request.headers cookies = HTTP.CookiesForURL(XHAMSTER_VIDEOS_LATEST_STRAIGHT) HTTP.Headers['Cookie'] = cookies if XHAMSTER_DEBUG: Log.Info("#### COOKIES #### " + cookies) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Daily Top") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_TOP_1DAY), title=L("Daily"), summary=L("last day top rated straight videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Weekly Top") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_TOP_7DAYS), title=L("Weekly"), summary=L("last week top rated straight videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Monthly Top") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_TOP_30DAYS), title=L("Monthly"), summary=L("last month top rated straight videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("All Time Top") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_TOP), title=L("All Time"), summary=L("all time top rated straight videos"))) return oc
def xhamster_videos_straight(): ObjectContainer.art = R(STRAIGHT_ART) DirectoryObject.art = R(STRAIGHT_ART) oc = ObjectContainer(title2=L("Straight Videos")) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Last Added") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_LATEST_STRAIGHT), title=L("Last Added"), summary=L("new straight p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_straight_categories), title=L("Categories"), summary=L("choose a category"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_straight_top), title=L("Top Rated"), summary=L("top rated straight p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("HD P**n") + " - " + L("Straight"), url=XHAMSTER_VIDEOS_HD_STRAIGHT), title=L("HD P**n"), summary=L("HD straight p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Recommendations"), url=XHAMSTER_VIDEOS_RECOMMENDATIONS), title=L("Recommendations"), summary=L("recommended for me"))) oc.add( DirectoryObject(key=Callback(xhamster_random), title=L("Random Video"), summary=L("show me a random video"))) return oc
def xhamster_videos_gays(): ObjectContainer.art = R(GAYS_ART) DirectoryObject.art = R(GAYS_ART) oc = ObjectContainer(title2=L("Gays Videos")) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Last Added") + " - " + L("Gays"), url=XHAMSTER_VIDEOS_LATEST_GAYS), title=L("Last Added"), summary=L("new gay p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_gays_categories), title=L("Categories"), summary=L("choose a category"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_gays_top), title=L("Top Rated"), summary=L("top rated gay p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("HD P**n") + " - " + L("Gays"), url=XHAMSTER_VIDEOS_HD_GAYS), title=L("HD P**n"), summary=L("HD gay p**n videos"))) return oc
def xhamster_videos_transsexuals(): ObjectContainer.art = R(TRANSSEXUALS_ART) DirectoryObject.art = R(TRANSSEXUALS_ART) oc = ObjectContainer(title2=L("Transsexuals Videos")) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("Last Added") + " - " + L("Transsexuals"), url=XHAMSTER_VIDEOS_LATEST_TRANSSEXUALS), title=L("Last Added"), summary=L("new transsexuals p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_transsexuals_categories), title=L("Categories"), summary=L("choose a category"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_transsexuals_top), title=L("Top Rated"), summary=L("top rated transsexuals p**n videos"))) oc.add( DirectoryObject(key=Callback(xhamster_videos_list, title=L("HD P**n") + " - " + L("Transsexuals"), url=XHAMSTER_VIDEOS_HD_TRANSSEXUALS), title=L("HD P**n"), summary=L("HD transsexuals p**n videos"))) return oc