Exemple #1
0
 def handleVideo(self, link):
     vid = self.scrapper.scrapVideoLink(link)
     if vid == None:
         xbmcUtil.notification(header=lang(30070), message=lang(30071))
         return False
     else:
         return vid
Exemple #2
0
def scrapSeries(url, pg=1):
	try:
		#find serie id
		req = urllib2.Request(url)
		req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
		response = urllib2.urlopen(req)
		content = response.read()
		response.close()

		res = re.compile('episodes_1","args":\["(.*?)"\]').findall(content)
		if len(res) > 0:
			serieId = res[0]
			url = 'http://www.ruutu.fi/views_cacheable_pager/videos_by_series/episodes_1/' + serieId + '?page=0%2C' + str(pg - 1)
			return scrapPager(url)
		else:
			soup = BeautifulSoup(content)
			items = soup.findAll('div', 'views-row grid-3')
			content = ''
			for it in items:
				content = content + str(it)
			return scrapPagerContent(content)
		#xbmcUtil.notification('Error', 'Could not find series')
		#return None
	except Exception as e:
		xbmcUtil.notification('Error', str(e))
		return None
Exemple #3
0
def scrapSeries(url, pg=1):
	try:
		#find serie id
		req = urllib2.Request(url)
		req.add_header('User-Agent', USER_AGENT)
		response = urllib2.urlopen(req)
		content = response.read()
		response.close()

		res = re.compile('episodes_1","args":\["(.*?)"\]').findall(content)
		if len(res) > 0:
			serieId = res[0]
			url = 'http://www.ruutu.fi/views_cacheable_pager/videos_by_series/episodes_1/' + serieId + '?page=0%2C' + str(pg - 1)
			return scrapPager(url)
		else:
			soup = BeautifulSoup(content)
			section = soup.find(id='quicktabs-container-ruutu_series_episodes_by_season')
			#section = soup.find(id='quicktabs-tabpage-ruutu_series_episodes_by_season-1')
			items = section.findAll('div', 'views-row grid-3')
			content = ''
			for it in items: content += str(it)
			return scrapPagerContent(content)
		#xbmcUtil.notification('Error', 'Could not find series')
		#return None
	except Exception as e:
		xbmcUtil.notification('Error', str(e))
		return None
Exemple #4
0
def scrapSeries(url, pg=1):
	try:		
		#find serie id
		req = urllib2.Request(url)
		req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
		response = urllib2.urlopen(req)
		content=response.read()	
		response.close()
	
		res = re.compile('episodes_1":\["(.*?)"\]').findall(content)
		if len(res)>0:
			serieId = res[0]
			url = 'http://www.ruutu.fi/views_cacheable_pager/videos_by_series/episodes_1/' + serieId + '?page=0%2C' + str(pg-1)
			return scrapPager(url)
		else:
			soup = BeautifulSoup(content)
			items = soup.findAll('div', 'views-row grid-3')
			content = ''
			for it in items:
				content = content + str(it)				
			return scrapPagerContent(str(it))
			#xbmcUtil.notification('Error', 'Could not find series')
			#return None
	except Exception as e:
		xbmcUtil.notification('Error', str(e))
		return None
	def handleVideo(self, link):
		vid = self.scrapper.scrapVideoLink(link)
		if vid==None:
			xbmcUtil.notification(header=lang(30070), message=lang(30071))
			return False
		else:
			return vid
Exemple #6
0
def scrapSeries(url, pg=1):
    try:
        # find serie id
        req = urllib2.Request(url)
        req.add_header("User-Agent", USER_AGENT)
        response = urllib2.urlopen(req)
        content = response.read()
        response.close()

        res = re.compile('episodes_1","args":\["(.*?)"\]').findall(content)
        if len(res) > 0:
            serieId = res[0]
            url = "".join(
                [
                    "http://www.ruutu.fi/views_cacheable_pager/",
                    "videos_by_series/episodes_1/",
                    serieId,
                    "?page=0%2C",
                    str(pg - 1),
                ]
            )
            return scrapPager(url)
        else:
            soup = BeautifulSoup(content, "html5lib")
            section = soup.find(id="quicktabs-container-ruutu_series_episodes_by_season")
            items = section.find_all("div", class_="views-row grid-3")
            content = ""
            for it in items:
                content += str(it)
            return scrapPagerContent(content)
        # xbmcUtil.notification('Error', 'Could not find series')
        # return None
    except Exception as e:
        xbmcUtil.notification("Error", str(e))
        return None
Exemple #7
0
def scrapSeries(url, pg=1):
    try:
        #find serie id
        req = urllib2.Request(url)
        req.add_header('User-Agent', USER_AGENT)
        response = urllib2.urlopen(req)
        content = response.read()
        response.close()

        res = re.compile('episodes_1","args":\["(.*?)"\]').findall(content)
        if len(res) > 0:
            serieId = res[0]
            url = 'http://www.ruutu.fi/views_cacheable_pager/videos_by_series/episodes_1/' + serieId + '?page=0%2C' + str(
                pg - 1)
            return scrapPager(url)
        else:
            soup = BeautifulSoup(content)
            section = soup.find(
                id='quicktabs-container-ruutu_series_episodes_by_season')
            #section = soup.find(id='quicktabs-tabpage-ruutu_series_episodes_by_season-1')
            items = section.findAll('div', 'views-row grid-3')
            content = ''
            for it in items:
                content += str(it)
            return scrapPagerContent(content)
        #xbmcUtil.notification('Error', 'Could not find series')
        #return None
    except Exception as e:
        xbmcUtil.notification('Error', str(e))
        return None
Exemple #8
0
	def handleAction(self, action, params):
		if action=='addFav':
			self.favSeries[params['name'].encode("utf-8")] = params['link']
			favStr = repr(self.favSeries)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30006), params['name'].encode("utf-8") )
		elif action=='removeFav':
			self.favSeries.pop(params['name'])
			favStr = repr(self.favSeries)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30007), unicode(params['name'], "utf-8").encode("utf-8") )
		else:
			super(ViewAddonAbstract, self).handleAction(self, action, params)
def readJSON(url):
	req = urllib2.Request(url)
	req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
	try:
		response = urllib2.urlopen(req)
		content = response.read()
		response.close()
		jsonObj = json.loads(content)
		return jsonObj
	except IOError as e:
		xbmc.log(str(e), level=xbmc.LOGERROR)
		xbmcUtil.notification('Error', str(e))
		return [];
Exemple #10
0
	def handleAction(self, action, params):
		if action=='addFav':
			self.favourites[params['name'].encode("utf-8")] = params['link']
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification('Added', params['name'].encode("utf-8") )
		elif action=='removeFav':
			self.favourites.pop(params['name'])
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification('Removed', params['name'].encode("utf-8") )
		else:
			super(ViewAddonAbstract, self).handleAction(self, action, params)
Exemple #11
0
 def handleAction(self, action, params):
     if action == 'addFav':
         self.favourites[params['name'].encode("utf-8")] = params['link']
         favStr = repr(self.favourites)
         self.addon.setSetting('fav', favStr)
         xbmcUtil.notification('Added', params['name'].encode("utf-8"))
     elif action == 'removeFav':
         self.favourites.pop(params['name'])
         favStr = repr(self.favourites)
         self.addon.setSetting('fav', favStr)
         xbmcUtil.notification('Removed', params['name'].encode("utf-8"))
     else:
         super(ViewAddonAbstract, self).handleAction(self, action, params)
Exemple #12
0
def readJSON(url):
	req = urllib2.Request(url)
	req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
	try:	
		response = urllib2.urlopen(req)
		content=response.read()	
		response.close()				
		jsonObj = json.loads(content)
		return jsonObj
	except IOError as e:
		xbmc.log(str(e), level=xbmc.LOGERROR )
		xbmcUtil.notification('Error', str(e))
		return [];
Exemple #13
0
	def __init__(self):
		xbmcUtil.ViewAddonAbstract.__init__(self)
		self.addHandler(None, self.handleMain)
		self.addHandler('serie', self.handleSerie)
		self.addHandler('programs', self.handlePrograms)
		self.scrapper = KatsomoScraper()
		user = settings.getSetting('username')
		passwd = settings.getSetting('password')
		if user != "" and not self.scrapper.doLogin(user, passwd):
			xbmcUtil.notification('Message','Cannot login check your credentials')
		elif user == "":
			self.scrapper.noLogin()
		self.favourites = {}
		self.initFavourites()
Exemple #14
0
	def handleAction(self, action, params):
		if action=='addFav':
			self.favourites[params['name'].encode("utf-8")] = params['link']
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30006), params['name'].encode("utf-8") )
		elif action=='removeFav':
			self.favourites.pop(params['name'])
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30007), params['name'].encode("utf-8") )
		elif action=='download':
			downloadVideo(params['videoLink'], params['title'])		
		else:
			super(ViewAddonAbstract, self).handleAction(self, action, params)
Exemple #15
0
	def handleAction(self, action, params):
		if action=='addFav':
			self.favourites[params['name'].encode("utf-8")] = params['link']
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30006), params['name'].encode("utf-8") )
		elif action=='removeFav':
			self.favourites.pop(params['name'])
			favStr = repr(self.favourites)
			self.addon.setSetting('fav', favStr)
			xbmcUtil.notification(self.lang(30007), params['name'].encode("utf-8") )
		elif action=='download':
			downloadVideo(params['videoLink'], params['title'])		
		else:
			super(ViewAddonAbstract, self).handleAction(self, action, params)
Exemple #16
0
 def __init__(self):
     xbmcUtil.ViewAddonAbstract.__init__(self)
     self.addHandler(None, self.handleMain)
     self.addHandler('serie', self.handleSerie)
     self.addHandler('programs', self.handlePrograms)
     self.scrapper = KatsomoScrapper()
     user = settings.getSetting('username')
     passwd = settings.getSetting('password')
     if user != "" and not self.scrapper.doLogin(user, passwd):
         xbmcUtil.notification('Message',
                               'Cannot login check your credentials')
     elif user == "":
         self.scrapper.noLogin()
     self.favourites = {}
     self.initFavourites()
Exemple #17
0
 def handleAction(self, action, params):
     if action == "addFav":
         self.favourites[params["name"].encode("utf-8")] = params["link"]
         favStr = repr(self.favourites)
         self.addon.setSetting("fav", favStr)
         xbmcUtil.notification(self.lang(30006), params["name"].encode("utf-8"))
     elif action == "removeFav":
         self.favourites.pop(params["name"])
         favStr = repr(self.favourites)
         self.addon.setSetting("fav", favStr)
         xbmcUtil.notification(self.lang(30007), params["name"].encode("utf-8"))
     elif action == "download":
         downloadVideo(params["videoLink"], params["title"])
     else:
         super(ViewAddonAbstract, self).handleAction(self, action, params)  # NOQA
Exemple #18
0
#for OSX add Crypto module folder
if sys.platform == 'darwin':
    cmd_subfolder = os.path.realpath(
        os.path.abspath(
            os.path.join(
                os.path.split(inspect.getfile(inspect.currentframe()))[0],
                "osx")))
    if cmd_subfolder not in sys.path:
        sys.path.insert(0, cmd_subfolder)

try:
    #import yle-dl (version 2.0.1)
    yledl = __import__('lib.yle-dl', globals(), locals(), ['yle-dl'], -1)
except ImportError as e:
    xbmc.log(str(e), level=xbmc.LOGERROR)
    xbmcUtil.notification('Error', str(e))
    sys.exit()


def scrapVideo(url):
    url = yledl.encode_url_utf8(url)
    dl = yledl.downloader_factory(url)
    if isinstance(dl, yledl.AreenaLiveDownloader):
        rtmpparams = dl.get_live_rtmp_parameters(url)
        clip = None
    else:
        playlist = dl.get_playlist(url, True)
        clip = playlist[0]
        rtmpparams = dl.get_rtmp_parameters(clip, url)

    enc = sys.getfilesystemencoding()
	cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0], "win32")))
	if cmd_subfolder not in sys.path:
		sys.path.insert(0, cmd_subfolder)

#for OSX add Crypto module folder 
if sys.platform == 'darwin':
	cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0], "osx")))
	if cmd_subfolder not in sys.path:
		sys.path.insert(0, cmd_subfolder)

try:
	#import yle-dl (version 2.0.1)
	yledl = __import__('lib.yle-dl', globals(), locals(), ['yle-dl'], -1)
except ImportError as e:
	xbmc.log(str(e), level=xbmc.LOGERROR)
	xbmcUtil.notification('Error', str(e))
	sys.exit();


def scrapVideo(url):
	url = yledl.encode_url_utf8(url)
	dl = yledl.downloader_factory(url)
	if isinstance(dl, yledl.AreenaLiveDownloader):
		rtmpparams = dl.get_live_rtmp_parameters(url)
		clip = None
	else:
		playlist = dl.get_playlist(url, True)
		clip = playlist[0]
		rtmpparams = dl.get_rtmp_parameters(clip, url)

	enc = sys.getfilesystemencoding()