1 # bangyoulater plugin by AliAbdul
2 from Plugin import Movie, Plugin
5 ##################################################
7 class bangYouLaterSub(Plugin):
8 def __init__(self, name, url):
10 self.moreEntries = True
11 Plugin.__init__(self, name, "bangyoulater.png")
13 def getEntries(self, callback, currPage=1):
14 self.currPage = currPage
15 self.callback = callback
16 self.getPage("%s/%d" % (self.url, self.currPage))
18 def getPageCallback(self, page):
20 reonecat = re.compile(r'<div class="mobile_item">(.+?)</td>', re.DOTALL)
21 for div in reonecat.findall(page):
22 reonecat = re.compile(r'<a href="/player.php(.+?)"><img src="(.+?)" /></a>.+?margin-top: 8px;">(.+?)</div>', re.DOTALL)
23 for url, thumb, name in reonecat.findall(div):
24 movies.append(Movie(name, "http://stream.bangyoulater.com/"+url[3:]+"/mobile.mp4", thumb))
27 def getMoreEntries(self):
29 self.getEntries(self.callback, self.currPage+1)
31 def getPageError(self, error=None):
32 if error and self.currPage == 1:
33 print "[%s] Error: %s" % (self.name, error)
35 self.moreEntries = False
37 ##################################################
39 class bangYouLater(Plugin):
41 Plugin.__init__(self, "Bang You Later", "bangyoulater.png")
43 def getEntries(self, callback):
44 self.callback = callback
45 self.getPage("http://mobile.bangyoulater.com")
47 def getPageCallback(self, page):
49 if 'Most Discussed' in page:
50 page = page[page.index('Most Discussed'):]
51 reonecat = re.compile(r'<option value="(.+?)">(.+?)</option>', re.DOTALL)
\r
52 for cat, name in reonecat.findall(page):
53 plugins.append(bangYouLaterSub("Bang You Later - "+name, "http://mobile.bangyoulater.com/?cat="+cat))
54 self.callback(plugins)
56 def getPageError(self, error=None):
57 if error: print "[%s] Error: %s" % (self.name, error)
59 ##################################################