Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def showMovies(sSearch=''):
- oGui = cGui()
- if sSearch:
- #on redecode la recherhce codé il y a meme pas une seconde par l'addon
- sSearch = urllib2.unquote(sSearch)
- query_args = { 'do' : 'search' , 'subaction' : 'search' , 'story' : str(sSearch) , 'x' : '0', 'y' : '0'}
- data = urllib.urlencode(query_args)
- headers = {'User-Agent' : 'Mozilla 5.10'}
- url = 'http://www.streamingmy.com/index.php?do=search=' + sSearch
- #url = 'http://streamingmy.com/seriestv/index.php?do=search=' + sSearch
- request = urllib2.Request(url,data,headers)
- try:
- reponse = urllib2.urlopen(request)
- except URLError, e:
- print e.read()
- print e.reason
- sHtmlContent = reponse.read()
- sPattern = '<div class="img-block border-2">.*?<img src="(.*?)" alt="(.*?)" class="img-poster border-2 shadow-dark7" width="151" height="215" />.+?<a href="(http:.*?)" title'
- else:
- oInputParameterHandler = cInputParameterHandler()
- sUrl = oInputParameterHandler.getValue('siteUrl')
- oRequestHandler = cRequestHandler(sUrl)
- sHtmlContent = oRequestHandler.request()
- #sPattern = '<div class="img-block border-2">.*?<img src="(.*?)" alt="(.*?)".*?<a href="(.*?)" title'
- sPattern = '<div class="img-block border-2">.*?<img src="(.+?)" alt="(.+?)".*?<a href="(.+?)" title'
- oParser = cParser()
- aResult = oParser.parse(sHtmlContent, sPattern)
- if (aResult[0] == True):
- total = len(aResult[1])
- dialog = cConfig().createDialog(SITE_NAME)
- for aEntry in aResult[1]:
- cConfig().updateDialog(dialog, total)
- if dialog.iscanceled():
- break
- #sTitle = aEntry[2].decode('latin-1').encode("utf-8")
- #sThumbnail = 'http:'+str(aEntry[2])
- sUrl = str(aEntry[1])
- sThumbnail = str(aEntry[0])
- if not 'http://www.streamingmy.com' in sThumbnail:
- sThumbnail = 'http://www.streamingmy.com' + sThumbnail
- #print sThumbnail
- oOutputParameterHandler = cOutputParameterHandler()
- oOutputParameterHandler.addParameter('siteUrl', str(aEntry[2]))
- oOutputParameterHandler.addParameter('sMovieTitle',str(aEntry[1]))
- oOutputParameterHandler.addParameter('sThumbnail', sThumbnail)
- oGui.addMovie(SITE_IDENTIFIER, 'showHosters', aEntry[1], '', sThumbnail, '', oOutputParameterHandler)
- cConfig().finishDialog(dialog)
- sNextPage = __checkForNextPage(sHtmlContent)
- print sNextPage
- if (sNextPage != False):
- oOutputParameterHandler = cOutputParameterHandler()
- oOutputParameterHandler.addParameter('siteUrl', sNextPage)
- oGui.addDir(SITE_IDENTIFIER, 'showMovies', '[COLOR teal]Next >>>[/COLOR]', 'next.png', oOutputParameterHandler)
- sGotoPage = __checkForGotoPage(sHtmlContent)
- print sGotoPage
- if (sNextPage != False):
- oOutputParameterHandler = cOutputParameterHandler()
- oOutputParameterHandler.addParameter('siteUrl', sGotoPage)
- oGui.addDir(SITE_IDENTIFIER, 'showMovies', '[COLOR orange]Goto Page #[/COLOR]', 'next.png', oOutputParameterHandler)
- if not sSearch:
- oGui.setEndOfDirectory()
- def __checkForNextPage(sHtmlContent):
- sPattern = '<div class="nextprev">.+?<a href="([^<>]+?)"><span class="pnext">Suivant<\/span><\/a>'
- oParser = cParser()
- aResult = oParser.parse(sHtmlContent, sPattern)
- if (aResult[0] == True):
- return aResult[1][0]
- return False
- def __checkForGotoPage(sHtmlContent):
- sPattern = '<div class="nextprev">.+?<a href="([^<>]+?)"><span class="pnext">Suivant<\/span><\/a>'
- oParser = cParser()
- aResult = oParser.parse(sHtmlContent, sPattern)
- if (aResult[0] == True):
- return aResult[1][0]
- return False
- if __item_list_:
- a.add_items(__item_list_)
- a.end_of_directory()
- elif __mode_ == 'list':
- if __params_['content'] == 'search':
- __item_ = a.search_input()
- if __item_: __params_['url'] = __search_url_ + __item_
- else: exit(1)
- elif __params_['content'] == 'goto':
- __last_item_ = re.search('/page/([0-9]+)/', __params_['url'])
- if __last_item_: __last_item_ = int(__last_item_.group(1))
- else: __last_item_ = 10000
- __item_ = a.page_input(__last_item_)
- if __item_: __params_['url'] = re.sub('/page/[0-9]+/', '/page/' + str(__item_) + '/', __params_['url'])
- else: exit(1)
- __html_ = a.get_page(__params_['url'])
- __soup_ = BeautifulSoup(__html_, parseOnlyThese=SoupStrainer('body'))
- __item_list_ = []
- __params_['mode'] = 'play'
- __params_['content'] = 'movies'
- __params_['type'] = 0
- __params_['duration'] = '120'
- __xbmcdict_ = XBMCDict(0).update(__params_)
- for __item_ in __soup_.findAll('div', 'photo-thumb-image'):
- if not __item_.a.get('href') in __false_positives_:
- __dict_ = __xbmcdict_.copy()
- if 'scenes' in __params_['url']:
- __dict_['duration'] = '45'
- __dict_['content'] = 'episodes'
- __dict_['url'] = __item_.a.get('href')
- __dict_['title'] = __item_.a.get('title').encode('UTF-8')
- __dict_['tvshowtitle'] = __dict_['title']
- __dict_['originaltitle'] = __dict_['title']
- __dict_['cover_url'] = a.image(__item_.img.get('src'))
- __dict_['thumb_url'] = __dict_['cover_url']
- __dict_['poster'] = __dict_['cover_url']
- __dict_['sub_site'] = __site_
- __dict_['contextmenu_items'] = [Fc().add(__dict_)]
- __item_list_.extend([__dict_])
- __soup_ = BeautifulSoup(__html_, parseOnlyThese=SoupStrainer('div', 'more_entries'))
- if __soup_:
- __item_ = __soup_.find('a', 'previouspostslink')
- if __item_: __item_list_.extend([{'site': __site_, 'mode': 'list', 'url': __item_.get('href'), 'content': __params_['content'],
- 'title': a.language(30008), 'cover_url': a.image('previous.png', image),
- 'backdrop_url': a.art(), 'type': 3}])
- __item_ = __soup_.find('a', 'nextpostslink')
- if __item_: __item_list_.extend([{'site': __site_, 'mode': 'list', 'url': __item_.get('href'), 'content': __params_['content'],
- 'title': a.language(30009), 'cover_url': a.image('next.png', image),
- 'backdrop_url': a.art(), 'type': 3}])
- __item_ = __soup_.find('a', 'last')
- if __item_: __item_list_.extend([{'site': __site_, 'mode': 'list', 'url': __item_.get('href'), 'content': 'goto',
- 'title': a.language(30010), 'cover_url': a.image('goto.png', image),
- 'backdrop_url': a.art(), 'type': 3}])
- if __item_list_:
- a.add_items(__item_list_)
- a.end_of_directory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement