Posts: 843
Joined: Mar 2008
Well here`s my code with Basjes` Megavideo Algo. I know that Megavideo streams run in XOT perfectly. But i still cannot get the stream appended to the res list. It will not enter through to the link stage. Must be something simple.
[CODE]
#################################
# sniffs & decodes megavideo url
################################
def decode (url,data):
if url.find("megavideo.com")>0:
codeRegex='addVariable\("flv","([^"]+)"\)'
codeResults = re.findall(codeRegex, data, re.DOTALL + re.IGNORECASE)
if len(codeResults)>0:
code=codeResults[-1]
dictionary = {"_": "b", "I": "t", "J": "w", "K": "v", "M": "p", "N": "s", "P": "m", "Q": "l", "R": "o", "T": "i", "U": "h", "X": "e", "Y": "d", "Z": "g", "%04": "9", "%05": "8", "%07": ":", "%08": "5", "%09": "4", "%0A": "7", "%0B": "6", "%0C": "1", "%0D": "0", "%0E": "3", "%0F": "2", "%12": "/", "%13": ".", "%5B": "f", "%5C": "a", "%5E": "c"}
return ReplaceDictionary(code,dictionary)
else:
return "No Video Link Found."
def ReplaceDictionary (string,dictionary):
rc=re.compile('|'.join(map(re.escape, dictionary)))
def Translate(match):
return dictionary[match.group(0)]
return rc.sub(Translate, string)
########################################################
# Gets Megavideo links & shortens them before decoding.#
########################################################
def getMegavideo(a):
res=[]
p=re.compile(r'<iframe src=\"(http://.+?)"')
match=p.findall(a)
for a in match:
res.append(a)
return res
#if len(a)>=80:
#a=a[:-45]
#code=re.sub('v/','?v=',a)
#sniff=urllib.urlopen(code)
#result1=sniff.read()
#sniff.close()
#link=ExtractMediaUrl(code,result1)
#res.append(a)
#return res
#else:
#if len(a)==35:
#sniff2=urllib.urlopen(a)
#result2=sniff2.read()
#sniff2.close()
#link2=ExtractMediaUrl(a,result2)
#res.append(a)
#return res
[CODE]
Hope that you could get this to append the Vidlinks, it`s really winding me up.
Voinage.
Posts: 843
Joined: Mar 2008
sorry missed the backslash off the last code tag.
Posts: 843
Joined: Mar 2008
Code:
#################################
# sniffs & decodes megavideo url
################################
def decode (url,data):
if url.find("megavideo.com")>0:
codeRegex='addVariable\("flv","([^"]+)"\)'
codeResults = re.findall(codeRegex, data, re.DOTALL + re.IGNORECASE)
if len(codeResults)>0:
code=codeResults[-1]
dictionary = {"_": "b", "I": "t", "J": "w", "K": "v", "M": "p", "N": "s", "P": "m", "Q": "l", "R": "o", "T": "i", "U": "h", "X": "e", "Y": "d", "Z": "g", "%04": "9", "%05": "8", "%07": ":", "%08": "5", "%09": "4", "%0A": "7", "%0B": "6", "%0C": "1", "%0D": "0", "%0E": "3", "%0F": "2", "%12": "/", "%13": ".", "%5B": "f", "%5C": "a", "%5E": "c"}
return ReplaceDictionary(code,dictionary)
else:
return "No Video Link Found."
def ReplaceDictionary (string,dictionary):
rc=re.compile('|'.join(map(re.escape, dictionary)))
def Translate(match):
return dictionary[match.group(0)]
return rc.sub(Translate, string)
########################################################
# Gets Megavideo links & shortens them before decoding.#
########################################################
def getMegavideo(a):
res=[]
p=re.compile(r'<iframe src=\"(http://.+?)"')
match=p.findall(a)
for a in match:
if len(a)>=80:
a=a[:-45]
code=re.sub('v/','?v=',a)
sniff=urllib.urlopen(code)
result1=sniff.read()
sniff.close()
link=ExtractMediaUrl(code,result1)
res.append(link)
return res
else:
if len(a)==35:
sniff2=urllib.urlopen(a)
result2=sniff2.read()
sniff2.close()
link2=ExtractMediaUrl(a,result2)
res.append(link2)
return res
Formatted.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
i take it a is always >=80 or ==35?
you could use a try/except catch around the for block to make sure it's not erroring and being caught somewhere else.
Posts: 843
Joined: Mar 2008
Code:
for a in match:
if len(a)>79:
a=a[:-45]
code=re.sub('v/','?v=',a)
sniff=urllib.urlopen(code)
result1=sniff.read()
sniff.close()
res=ExtractMediaUrl(code,result1)
#return res
else:
if len(a)<37:
res=[]
sniff2=urllib.urlopen(a)
result2=sniff2.read()
res=ExtractMediaUrl(a,result2)
#return res
Throwing an error over the length of some links, guess i was too tired the other night.
Thanks Nuka
Posts: 107
Joined: Mar 2008
Reputation:
0
plex
Senior Member
Posts: 107
Voinage if you want to play a megavideo flv stream add a / to it on the latest unstable build of xbmc
OR on the not so latest build
add a /index.flv
I made a thread about this that no one bothered to read.
Spread the knowledge, nothing else.
Posts: 843
Joined: Mar 2008
It`s okay plex, It wasn`t the fact that i needed to play megavideo stream.
Just wanted to add it to the power flv plugin, because of the blood +, DearS, and Claymore
vids in the anime section.
Well i`ve done it anyway. haha
Just tested and streamed Blood+,Claymore and Dears very merrily.
will tidy up plugin and repost.
Thanks for putting up with the moaning.
Voinage
Posts: 843
Joined: Mar 2008
Well here is a half finished powerflv - it runs Megavideo perfectly.
Only problem is you can`t get any links other than Megavideo.
It throws out a TypeError: Iteration over non sequence and won`t collect other links.
I`ve tried catching it, try,except etc but all to no avail.
Tried changing the def of Megavideo at least 8 times and now I need help to integrate Megavideo and keep the other links working. Also if someone could point out my error so i can learn from it I`d be most grateful.
Thanks, Voin.
http://www.megaupload.com/?d=J4EG4YAJ
Posts: 843
Joined: Mar 2008
The Megavideo test files are: Claymore and Blood+ in Anime
Tv - Absolutely fabulous.
And a quite few of the movies.