URGENT:Do you have the possibility to create addon from these websites

Status
Not open for further replies.

art01

New member
Apr 7, 2015
2
0
0

art01

New member
Apr 7, 2015
2
0
0
Could someone who has a clue have a look into this to see what is wrong with this?????

thank you,

art


# -*- coding: utf8 -*-
import sys,syspath
import urllib,urllib2,re,xbmcplugin,xbmcgui,sys,os
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from httplib import HTTP
from urlparse import urlparse
import StringIO
import urllib2,urllib
import re
import httplib
import time,itertools

__settings__ = xbmcaddon.Addon(id='plugin.video.mistreci')
__icon__ = __settings__.getAddonInfo('icon')
__fanart__ = __settings__.getAddonInfo('fanart')
__language__ = __settings__.getLocalizedString
_thisPlugin = int(sys.argv[1])
_pluginName = (sys.argv[0])
baseurl='http://www.mistreci.com/filma/'
def read_url2(url):
try:
req = urllib2.Request(url)
response = urllib2.urlopen(req)
data = response.read()
response.close()
return data
except:
return None




def read_url(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')
req.add_header('Host', 'dardarkom.com:80')
req.add_header('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
req.add_header('Cookie', 'popNum=8; __atuvc=6%7C34%2C3%7C35; popundr=1; PHPSESSID=478ff84e532ad811df5d63854f4f0fe1; watched_video_list=MTgzNDY%3D')
response = urllib2.urlopen(req)
link=response.read()
return link

def patch_http_response_read(func):
def inner(*args):
try:
return func(*args)
except httplib.IncompleteRead, e:
return e.partial

return inner
httplib.HTTPResponse.read = patch_http_response_read(httplib.HTTPResponse.read)


def getCategories():
list1=[]

done=True
list1=[]

regx='''<a href="http://www.mistreci.com/filma/category/(.*?)">(.*?)</a></li>'''
#regx='''<li><a href='(.*?)'>(.*?)</a></li>'''
done=True
if done:
data=read_url2(baseurl)
#print 'data',data

if data is None:
addDir('Error:Download Error','Download error',1,'')
return

match1 = re.findall(regx,data, re.M|re.I)
print 'match1',match1
if len(match1)<1:
addDir('Error:script Error','Download error',1,'')
return
addDir("Search",'http://www.mistreci.com/filma/?s=',8,'')
for href,title in match1:
link="http://www.mistreci.com/filma/category/"+href
print title
addDir(title,link,1,'')







def search():



search_entered = ''
debug=True
if debug:
keyboard = xbmc.Keyboard(search_entered, 'Search 1Ch**nel')
keyboard.doModal()
if keyboard.isConfirmed():
search_entered = keyboard.getText() .replace(' ','+')
print "mfarajx3",search_entered

else:
print "search error"




url="http://www.mistreci.com/filma/?s="+search_entered
print "mfarajx4_url",url

getVideos("Search",url,1)

def getVideos(name1, urlmain,page):
print "mahmou1",urlmain
print "page",page

if page>1:
#&paged=2
#http://www.mistreci.com/filma/category/akson/page/2/
url_page=urlmain+'page/'+str(page)+"/"

else:
#http://www.dardarkom.com/filme-enline/filme-gharbi/page/2/
url_page=urlmain
print "url_page",url_page

data = read_url2(url_page)


regx='''<h2><a href="http://www.mistreci.com/filma/(.*?)">\s\s(.*?)</a></h2>'''

if data is None:
addDir('Error:Download Error','Download error',1,'')
return
match1 = re.findall(regx,data, re.M|re.I)
print 'match1',match1
if len(match1)<1:
addDir('Error:script Error','Download error',1,'')
return






for href,title in match1:
title=title.strip()
link="http://www.mistreci.com/filma/"+href
addDir(title,link,2,"")

addDir('next page>',urlmain, 1,'',str(page+1))


def resolve_host(url):
if 'vk.com' in url:
stream_link=resolve_vk(url)
else:
import urlresolver

stream_link = urlresolver.resolve(url)
if 'unresolvable' not in stream_link and not stream_link.startswith('Error'):
listItem = xbmcgui.ListItem(path=str(stream_link))
xbmcplugin.setResolvedUrl(sys.argv[0], True, listItem)
else:
addDir('Error,' + stream_link, '', 9, '')
def get_hostlink(url):
data=read_url2(url)


regx='''<iframe src="(.+?)" width='''
match = re.findall(regx,data, re.M|re.I)
print 'match-mfaraj',match,url
if len(match)<1:
regx="'proxy.link'.+?'(.+?)'"
match = re.findall(regx,data, re.M|re.I)
print 'match-mfaraj2',match,url

i=0
for href in match:


i=i+1
server='link1'+str(i)
addLink(server,href,7,'')
def resolve_vk(url):
web_url =url
print "45m",web_url
debug=True
from addon.common.net import Net
import json as json
net = Net()
try:
soup = net.http_GET(web_url).content
html = soup.decode('cp1251')
print "html",html
vars_s = re.findall("""var vars = (.+)""",html)
if vars_s :
jsonvars = json.loads(vars_s[0])
purged_jsonvars = {}
for item in jsonvars :
if re.search('url[0-9]+', str(item)) :
purged_jsonvars[item] = jsonvars[item]
lines = []
ls_url = []
for item in purged_jsonvars :
ls_url.append(item)
quality = item.lstrip('url')
lines.append(str(quality))
if len(ls_url) == 1 :
return purged_jsonvars[ls_url[0]].encode('utf-8')
result =1# xbmcgui.Dialog().select('Choose the link', lines)
if result != -1 :
return purged_jsonvars[ls_url[result]].encode('utf-8')
else :
return self.unresolvable(0,'No link selected')
else :
return self.unresolvable(0,'No var_s found')
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo)
return self.unresolvable(code=3, msg=e)
except Exception, e:
common.addon.log('**** VK Error occured: %s' % e)
common.addon.show_small_popup(title='[COLOR white]VK[/COLOR]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo)
return self.unresolvable(code=0, msg=e)
def get_servers(url):
data=read_url2(url)


regx='''<iframe.+?src="(.+?)" width=.+?></iframe>'''
regx='''.+?href="(.+?)" target="_blank">'''#<span style="color: #358fcf;"><span style="color: #358fcf; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;">Played</span></span></a></h4>'''
regx='''<h4 style="text-align: center;"><a href="(.+?)" target="_blank"><span style="color: #358fcf;"><span style="color: #358fcf; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;">(.+?)</span></span></a></h4>'''
regx='''<h4 style="text-align: center;"><a href="(.+?)" target="_blank"><span style="color: #358fcf;".+?>(.+?)<.+?</h4>'''
regx='''<h4 style="text-align: center;"><a href="(.+?)" target='''
#regx='''<h4 style="text-align: center;"><a href="(.+?)" target="_blank"><span style="color: #358fcf;".+?>Nosupload</span></a></h4>
#</td>'''
#regx='''<h4 style=".+?"><a href="(.+?)" target="_blank">.+?>(.+?)</span>.+?'''
match = re.findall(regx,data, re.M|re.I)
print 'match',match
i=0
for href in match:


i=i+1
debug=True
server=gethostname(href)
addDir(server,href,7,'')
return
def gethostname(url):
from urlparse import parse_qs, urlparse
query = urlparse(url)

return query.hostname.replace("www.","")
def get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}
for i in range(len(pairsofparams)):
splitparams={}
splitparams=pairsofparams.split('=')
if (len(splitparams))==2:
param[splitparams[0]]=splitparams[1]

return param

def addLink(name,url,mode,iconimage):
u=_pluginName+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty("IsPlayable","true");
ok=xbmcplugin.addDirectoryItem(handle=_thisPlugin,url=u,listitem=liz,isFolder=False)
return ok



def addDir(name,url,mode,iconimage,page=1):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&page="+str(page)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok




params=get_params()
url=None
name=None
mode=None
initial=None
max=None
rating=None
cast=None
year=None
genre=None
duration=None
writer=None
director=None


try:
url=urllib.unquote_plus(params["url"])
except:
pass
try:
name=urllib.unquote_plus(params["name"])
except:
pass

try:
mode=int(params["mode"])
except:
pass
try:
page=int(params["page"])
except:
page=1





print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)
print "page: "+str(page)
if mode==None or url==None or len(url)<1:
print ""
getCategories()

elif mode==1:
print ""+url
getVideos(name,url,page)
elif mode==2:
print ""+url
get_servers(url)


elif mode==6:
print ""+url
get_hostlink(url)
elif mode==7:
resolve_host(url)
elif mode==8:
search()

xbmcplugin.endOfDirectory(int(sys.argv[1]))
 

elkooora

New member
Jul 15, 2020
1
0
1
thank yo

spam removed by RavRob
Ancient Topic locked
 
Last edited by a moderator:
Status
Not open for further replies.