noobroom py

tomtomclub

New member
Apr 21, 2013
211
0
0
The Netherlands.usa
sometimes works fine but sometime noting i can not see the problem
kodi 17.

import re,urllib

from resources.lib.libraries import control
from resources.lib.libraries import cleantitle
from resources.lib.libraries import client

class source:
def __init__(self):
self.base_link = 'http://dick.network'
self.search_link = '/search.php?q=%s'
self.login_link = '/login.php'
self.login2_link = '/login2.php'
self.mail = control.setting('noobroom_mail')
self.password = control.setting('noobroom_password')


def __cookie(self):
try:
if (self.mail == '' or self.password == ''): raise Exception()

post = urllib.urlencode({'email': self.mail, 'password': self.password})
client.source(self.base_link + self.login_link, close=False)
client.source(self.base_link + self.login_link, output='cookie', close=False)
cookie = client.source(self.base_link + self.login2_link, post=post, output='cookie')
return cookie
except:
return


def get_movie(self, imdb, title, year):
try:
if (self.mail == '' or self.password == ''): raise Exception()
cookie = self.__cookie()

query = urllib.quote_plus(title)
query = self.base_link + self.search_link % query

result = client.source(query, cookie=cookie)

result = re.compile('(<i>Movies</i>.+)').findall(result)[0]
result = result.split("'tippable'")

title = '>' + cleantitle.movie(title) + '<'
years = ['(%s)' % str(year), '(%s)' % str(int(year)+0), '(%s)' % str(int(year)-1)]
result = [i for i in result if any(x in i for x in years)]
result = [i for i in result if title in cleantitle.movie(i)][0]
result = re.compile("href='(.+?)'").findall(result)[0]

try: url = re.compile('//.+?(/.+)').findall(result)[0]
except: url = result
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
except:
return


def get_show(self, imdb, tvdb, show, year):
try:
if (self.mail == '' or self.password == ''): raise Exception()
cookie = self.__cookie()

query = urllib.quote_plus(show)
query = self.base_link + self.search_link % query

result = client.source(query, cookie=cookie)
result = re.compile('(<i>TV Series</i>.+)').findall(result)[0]
result = result.replace('(incomplete)', '')
result = result.split("><a ")

title = '>' + cleantitle.tv(show) + '<'
years = [str(year), str(int(year)+1), str(int(year)-1)]
result = [i for i in result if title in cleantitle.tv(i)][0]
result = re.compile("href='(.+?)'").findall(result)[:2]

for i in result:
try:
result = client.source(self.base_link + i, cookie=cookie)
y = re.compile('\d*-\d*-(\d{4})').findall(result)[0]
if any(x == y for x in years):
match = i
break
except:
pass

result = match

try: url = re.compile('//.+?(/.+)').findall(result)[0]
except: url = result
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
except:
return


def get_episode(self, url, imdb, tvdb, title, date, season, episode):
try:
if url == None: return

if (self.mail == '' or self.password == ''): raise Exception()
cookie = self.__cookie()

url = self.base_link + url

result = client.source(url, cookie=cookie)
result = re.compile("<b>%01dx%02d .+?style=.+? href='(.+?)'" % (int(season), int(episode))).findall(result)[0]

try: url = re.compile('//.+?(/.+)').findall(result)[0]
except: url = result
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
except:
return


def get_sources(self, url, hosthdDict, hostDict, locDict):
try:
if url == None: return

sources = []

url = self.base_link + url
sources.append({'source': 'Noobroom', 'quality': 'HD', 'provider': 'Noobroom', 'url': url})
return sources
except:
return sources


def resolve(self, url):
try:
if (self.mail == '' or self.password == ''): raise Exception()
cookie = self.__cookie()

result = client.request(url, cookie=cookie, close=False)
result = re.compile('"file": "(.+?)"').findall(result)

url = [i for i in result if 'type=flv' in i]
url += [i for i in result if 'type=mp4' in i]
url = self.base_link + url[-1]

u = None

u = client.request(url.replace('&hd=0', '&hd=1'), output='geturl')
if not u == None: return u

u = client.request(url, output='geturl')
if not u == None: return u

return url
except:
return
 

RavRob

Moderator
Staff member
Nov 21, 2012
6,444
34
48
The Halls of Valhalla
@tomtomclub
Please, when you post such amount of text, code your test to keep the forum cleaner. Also, as you can see by the *s in your text, the addon is not supported here (for now at least)
 
Thread starter Similar threads Forum Replies Date
M Random Topics 2
I Random Topics 4
G Random Topics 6