2011-10-30, 20:46
will take a look at add_directory with infolabels this week. children have been ill and not had much sleep plus programming an app for work. very tired.
Eldorado Wrote:k_zeon - the quick fix in t0mm0's common library to get the infolabels to work:
Open up addon.py and make the following change:
Code:def unescape(self, text):
'''
Decodes HTML entities in a string.
You can add more entities to the ``rep`` dictionary.
Args:
text (str): String to be cleaned.
Returns:
Cleaned string.
'''
try:
text = self.decode(text)
rep = {'<': '<',
'>': '>',
'"': '"',
'’': '\'',
'´': '\'',
}
for s, r in rep.items():
text = text.replace(s, r)
# this has to be last:
text = text.replace("&", "&")
[b] except TypeError:
pass[/b]
return text
Currently it only allows strings to be passed, this will catch and let pass any non-strings
k_zeon Wrote:will take a look at add_directory with infolabels this week. children have been ill and not had much sleep plus programming an app for work. very tired.
Eldorado Wrote:t0mm0, here was the other fix I needed to do for non-text infolabels
r = re.search('//(.+?)/(?:v/|\?v=)([0-9A-Z]+)', url)
http://www.megavideo.com/?d=CZ8RKCLE
Eldorado Wrote:Just gave the add_directory with infolabels a try, works good!
koma85 Wrote:Hi! i've noticed that the resolution of the megavideo's links are limited to the v0? query:yes, i believe that the 'd=' links can also be used with megaupload to give you a higher quality stream. support for that should definitely be added.
But i've also noticed that there are several different links "desination" like d:Code:r = re.search('//(.+?)/(?:v/|\?v=)([0-9A-Z]+)', url)
Code:http://www.megavideo.com/?d=CZ8RKCLE
koma85 Wrote:And i would really apreciate an external "txt" reader for the links.
For example:
c:\linkslist.txt
That would be much more simple to edit and test!
I'm a really bad python coder and i'm tryng to make this thing work but seems to be too difficult for me.
plugin://plugin.video.t0mm0.test/?play=true&url=YOUR_URL
t0mm0 Wrote:cool
last night i also added a batch of plugins from MaxMustermann:
- ecostream
- stream2k
- xvidstage
- videozer
- uploadc
- skyload
thanks to max! and there are more on the way
yes, i believe that the 'd=' links can also be used with megaupload to give you a higher quality stream. support for that should definitely be added.
at the moment i just use the t0mm0.test addon, but it is getting unwieldy. i was thinking last night about including test links in the plugins themselves so the test addon could auto generate all the options - any thoughts?
you can also use strm files i guess, something like:would probably do the trick.Code:plugin://plugin.video.t0mm0.test/?play=true&url=YOUR_URL
t0mm0
#cat example.t0mm0
http://hotfile.com/filelink?=osdfhjofj;Test 1 film
http://megavideo.com?d=DFGRERW;Cool film n° 2
<?xml version="1.0" encoding="utf-8"?>
<WmsMediaItem>
<ClassID>51</ClassID>
<ItemID>f30e900e-b24e-40ce-8189-38a773f90544</ItemID>
<ItemPath>http://www.megavideo.com</ItemPath>
<ParentID>234DF17B-418C-4FDC-9DFE-CD0C586D2E76</ParentID>
<Properties>
<Property>
<ID>4</ID>
<Value>MegaVideo</Value>
</Property>
<Property>
<ID>515</ID>
<Value>1</Value>
</Property>
<Property>
<ID>700</ID>
<Value>0</Value>
</Property>
<Property>
<ID>701</ID>
<Value>-1</Value>
</Property>
<Property>
<ID>702</ID>
<Value>-1</Value>
</Property>
<Property>
<ID>512</ID>
<Value>0</Value>
</Property>
<Property>
<ID>532</ID>
<Value>0</Value>
</Property>
<Property>
<ID>553</ID>
<Value>1</Value>
</Property>
<Property>
<ID>550</ID>
<Value>const
WinHttpRequestOption_EnableRedirects = $00000006;
csUserID = '';
function HexToBin(const aText: string): string;
var
i, j, k: Integer;
sBin: string;
begin
Result := '';
for i := 1 to Length(aText) do begin
k := StrToInt('$' + aText[i]);
sBin := '';
for j := 0 to 3 do begin
if (k and 1) = 1 then
sBin := '1' + sBin
else
sBin := '0' + sBin;
k := k shr 1
end;
Result := Result + sBin
end
end;
function BinToHex(const aText: string): string;
var
i, j, k: Integer;
sBin: string;
begin
Result := '';
i := 1;
while i < Length(aText) do begin
sBin := Copy(aText, i, 4);
k := 0; Inc(i, 4);
for j := 1 to 4 do begin
k := k shl 1;
if sBin[j] = '1' then
k := k or 1
end;
Result := Result + Format('%x', [k]);
end
end;
function XorC(C: Char; aValue: Byte): Char;
begin
if ((C = '0') and (aValue = 0)) or ((C = '1') and (aValue = 1)) then
Result := '0'
else
Result := '1'
end;
var
bDecrypt: Boolean;
C: Char;
WinHttp: Variant;
iv: array[0..383] of Byte;
a, b, i, k1, k2: Integer;
sCrypted, sKey1, sKey2, sServer, sUserID, sVideoID, sVideoInfo, sVideoLink, sVideoPage, sUncrypted: string;
begin
MediaResourceLink := '';
if WmsRegExMatch('http://www.megavideo.com/\?v=(.*)', mpFilePath, sVideoID) then begin
bDecrypt := False;
if csUserID = '' then
WmsRegExMatch('flashvars.userid = "(.*?)"', WmsDownloadUrl(mpFilePath), sUserID)
else
sUserID := csUserID;
if sUserID <> '' then
sVideoInfo := WmsDownloadUrl('http://www.megavideo.com/xml/player_login.php?u=' + sUserID + '&v=' + sVideoID)
else
sVideoInfo := WmsDownloadUrl('http://www.megavideo.com/xml/videolink.php?v=' + sVideoID);
if WmsRegExMatch('downloadurl="(.*?)"', sVideoInfo, sVideoLink) then
MediaResourceLink := WmsHttpDecode(sVideoLink)
else if WmsRegExMatch(' hd_url="(.*?)"', sVideoInfo, sVideoLink) then
MediaResourceLink := WmsHttpDecode(sVideoLink)
else if WmsRegExMatch(' hd_k1="(\d+)"', sVideoInfo, sKey1) and
WmsRegExMatch(' hd_k2="(\d+)"', sVideoInfo, sKey2) and
WmsRegExMatch(' hd_un="(.*?)"', sVideoInfo, sCrypted) and
WmsRegExMatch(' hd_s="(.*?)"', sVideoInfo, sServer) then
bDecrypt := True
else if WmsRegExMatch(' k1="(\d+)"', sVideoInfo, sKey1) and
WmsRegExMatch(' k2="(\d+)"', sVideoInfo, sKey2) and
WmsRegExMatch(' un="(.*?)"', sVideoInfo, sCrypted) and
WmsRegExMatch(' s="(.*?)"', sVideoInfo, sServer) then
bDecrypt := True;
if bDecrypt then begin
k1 := StrToInt(sKey1);
k2 := StrToInt(sKey2);
sUncrypted := HexToBin(sCrypted);
for i := 0 to 383 do begin
k1 := (k1 * 11 + 77213) mod 81371;
k2 := (k2 * 17 + 92717) mod 192811;
iv[i] := (k1 + k2) mod 128;
end;
for i := 256 downto 0 do begin
a := iv[i];
b := i mod 128;
C := sUncrypted[a + 1];
sUncrypted[a + 1] := sUncrypted[b + 1];
sUncrypted[b + 1] := c
end;
for i := 1 to 128 do
sUncrypted[i] := XorC(sUncrypted[i], iv[i + 255] and 1);
MediaResourceLink := 'http://www' + sServer + '.megavideo.com/files/' + LowerCase(BinToHex(sUncrypted)) + '/';
end
end
end.</Value>
</Property>
<Property>
<ID>551</ID>
<Value>PascalScript</Value>
</Property>
<Property>
<ID>570</ID>
<Value>0</Value>
</Property>
</Properties>
<ChildItems></ChildItems>
</WmsMediaItem>
flashvars.userid = "OHM.yallahyakkahyallah";
<?xml version="1.0" encoding="utf-8"?>
<WmsMediaItem>
<ClassID>51</ClassID>
<ItemID>f30e900e-b24e-40ce-8189-38a773f90544</ItemID>
<ItemPath>http://www.megavideo.com</ItemPath>
<ParentID>234DF17B-418C-4FDC-9DFE-CD0C586D2E76</ParentID>
<Properties>
<Property>
<ID>4</ID>
<Value>MegaVideo</Value>
</Property>
<Property>
<ID>515</ID>
<Value>1</Value>
</Property>
<Property>
<ID>700</ID>
<Value>0</Value>
</Property>
<Property>
<ID>701</ID>
<Value>-1</Value>
</Property>
<Property>
<ID>702</ID>
<Value>-1</Value>
</Property>
<Property>
<ID>512</ID>
<Value>0</Value>
</Property>
<Property>
<ID>532</ID>
<Value>0</Value>
</Property>
<Property>
<ID>553</ID>
<Value>1</Value>
</Property>
<Property>
<ID>550</ID>
<Value>const
WinHttpRequestOption_EnableRedirects = $00000006;
csUserID = '';
function HexToBin(const aText: string): string;
var
i, j, k: Integer;
sBin: string;
begin
Result := '';
for i := 1 to Length(aText) do begin
k := StrToInt('$' + aText[i]);
sBin := '';
for j := 0 to 3 do begin
if (k and 1) = 1 then
sBin := '1' + sBin
else
sBin := '0' + sBin;
k := k shr 1
end;
Result := Result + sBin
end
end;
function BinToHex(const aText: string): string;
var
i, j, k: Integer;
sBin: string;
begin
Result := '';
i := 1;
while i < Length(aText) do begin
sBin := Copy(aText, i, 4);
k := 0; Inc(i, 4);
for j := 1 to 4 do begin
k := k shl 1;
if sBin[j] = '1' then
k := k or 1
end;
Result := Result + Format('%x', [k]);
end
end;
function XorC(C: Char; aValue: Byte): Char;
begin
if ((C = '0') and (aValue = 0)) or ((C = '1') and (aValue = 1)) then
Result := '0'
else
Result := '1'
end;
var
bDecrypt: Boolean;
C: Char;
WinHttp: Variant;
iv: array[0..383] of Byte;
a, b, i, k1, k2: Integer;
sCrypted, sKey1, sKey2, sServer, sUserID, sVideoID, sVideoInfo, sVideoLink, sVideoPage, sUncrypted: string;
begin
MediaResourceLink := '';
if WmsRegExMatch('http://www.megavideo.com/\?v=(.*)', mpFilePath, sVideoID) then begin
bDecrypt := False;
if csUserID = '' then
WmsRegExMatch('flashvars.userid = "(.*?)"', WmsDownloadUrl(mpFilePath), sUserID)
else
sUserID := csUserID;
if sUserID <> '' then
sVideoInfo := WmsDownloadUrl('http://www.megavideo.com/xml/player_login.php?u=' + sUserID + '&v=' + sVideoID)
else
sVideoInfo := WmsDownloadUrl('http://www.megavideo.com/xml/videolink.php?v=' + sVideoID);
if WmsRegExMatch('downloadurl="(.*?)"', sVideoInfo, sVideoLink) then
MediaResourceLink := WmsHttpDecode(sVideoLink)
else if WmsRegExMatch(' hd_url="(.*?)"', sVideoInfo, sVideoLink) then
MediaResourceLink := WmsHttpDecode(sVideoLink)
else if WmsRegExMatch(' hd_k1="(\d+)"', sVideoInfo, sKey1) and
WmsRegExMatch(' hd_k2="(\d+)"', sVideoInfo, sKey2) and
WmsRegExMatch(' hd_un="(.*?)"', sVideoInfo, sCrypted) and
WmsRegExMatch(' hd_s="(.*?)"', sVideoInfo, sServer) then
bDecrypt := True
else if WmsRegExMatch(' k1="(\d+)"', sVideoInfo, sKey1) and
WmsRegExMatch(' k2="(\d+)"', sVideoInfo, sKey2) and
WmsRegExMatch(' un="(.*?)"', sVideoInfo, sCrypted) and
WmsRegExMatch(' s="(.*?)"', sVideoInfo, sServer) then
bDecrypt := True;
if bDecrypt then begin
k1 := StrToInt(sKey1);
k2 := StrToInt(sKey2);
sUncrypted := HexToBin(sCrypted);
for i := 0 to 383 do begin
k1 := (k1 * 11 + 77213) mod 81371;
k2 := (k2 * 17 + 92717) mod 192811;
iv[i] := (k1 + k2) mod 128;
end;
for i := 256 downto 0 do begin
a := iv[i];
b := i mod 128;
C := sUncrypted[a + 1];
sUncrypted[a + 1] := sUncrypted[b + 1];
sUncrypted[b + 1] := c
end;
for i := 1 to 128 do
sUncrypted[i] := XorC(sUncrypted[i], iv[i + 255] and 1);
MediaResourceLink := 'http://www' + sServer + '.megavideo.com/files/' + LowerCase(BinToHex(sUncrypted)) + '/';
end
end
end.</Value>
</Property>
<Property>
<ID>551</ID>
<Value>PascalScript</Value>
</Property>
<Property>
<ID>570</ID>
<Value>0</Value>
</Property>
</Properties>
<ChildItems></ChildItems>
</WmsMediaItem>
http://www.megavideo.com/xml/player_login.php?u=OHM.PREMIUMCOOKIENUMBER&v=35SJJW7E
<?xml version="1.0" encoding="UTF-8"?>
<user type="premium" user="koma85" downloadurl="http%3A%2F%2Fwww299.megavideo.com%2Ffiles%2Ff75d1yahtta901af6cxbgcb%2FDrawn+Together+3x08+-+Persi+Nel+Parcheggio+Parte+2.avi" />
MaxMustermann Wrote:@t0mm0: Do you plan on integrating a download option (jdownloader/direct)? I have something like that in my xStream addon. Shall I convert it for the urlresolver or common script?
EDIT: Maybe a separate script like script.module.downloader would be a better place?
koma85 Wrote:Got it!
Code:http://www.megavideo.com/xml/player_login.php?u=OHM.PREMIUMCOOKIENUMBER&v=35SJJW7E
and it reply with the download url directly in the html source:
Code:<?xml version="1.0" encoding="UTF-8"?>
<user type="premium" user="koma85" downloadurl="http%3A%2F%2Fwww299.megavideo.com%2Ffiles%2Ff75d1yahtta901af6cxbgcb%2FDrawn+Together+3x08+-+Persi+Nel+Parcheggio+Parte+2.avi" />
t0mm0 Wrote:yeah, maybe you are right and it would be better to make it a separate module. happy to talk about how it would look though if you want?
t0mm0
MaxMustermann Wrote:These are the current xStream functions for direct download and download via jDownloader.
Module settings should look like this:
- folder: default download path
- bool: use default path -> if false: ask
- jDownloader
- bool: jd_enabled
- text: jd_host (default=127.0.0.1)
- text: jd_port (default=10025)
- bool: jd_automatic_start
- bool: jd_grabber