1 # mXVideos plugin by AliAbdul
2 from Plugin import Movie, Plugin
5 ##################################################
7 class mXVideosMovie(Movie):
8 def __init__(self, name, url, thumb):
9 Movie.__init__(self, name, url, thumb)
11 def getVideoUrl(self):
13 data = urllib2.urlopen(self.url).read()
16 reonecat = re.compile(r'Watch Video: <a href="(.+?)">MP4</a>')
17 list = reonecat.findall(data)
18 if list and len(list) > 0:
19 return "http://m.xvideos.com"+list[0]
23 ##################################################
25 class mXVideosSub(Plugin):
26 def __init__(self, name, url):
28 self.moreEntries = True
29 Plugin.__init__(self, name, "mXVideos.png")
31 def getEntries(self, callback, currPage=1):
32 self.currPage = currPage
33 self.callback = callback
34 self.getPage("http://m.xvideos.com%s/page/%d" % (self.url, self.currPage))
36 def getPageCallback(self, page):
38 reonecat = re.compile(r'src="(.+?)" /></a><div class="scene_title"><a href="(.+?)"> (.+?)</a></div></div>', re.DOTALL)
\r
39 for thumb, url, name in reonecat.findall(page):
40 movies.append(mXVideosMovie(name, "http://m.xvideos.com"+url, thumb))
43 def getMoreEntries(self):
45 self.getEntries(self.callback, self.currPage+1)
47 def getPageError(self, error=None):
48 if error and self.currPage == 1:
49 print "[%s] Error: %s" % (self.name, error)
51 self.moreEntries = False
53 ##################################################
55 class mXVideos(Plugin):
57 Plugin.__init__(self, "mXVideos", "mXVideos.png")
59 def getEntries(self, callback):
60 self.callback = callback
61 self.getPage("http://m.xvideos.com/tag/browse")
63 def getPageCallback(self, page):
66 reonecat = re.compile(r'<a href="(.+?)">(.+?)</a><br />', re.DOTALL)
\r
67 for url, name in reonecat.findall(page):
71 plugins.append(mXVideosSub("mXVideos - "+name, url))
74 self.callback(plugins)
76 def getPageError(self, error=None):
77 if error: print "[%s] Error: %s" % (self.name, error)
79 ##################################################