Voinage
Banned
Posts: 856
Joined: Mar 2008
Location: England
|
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.
|