Kodi Community Forum
[TIPS] Regex code for divxstage.net (eu) :) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: [TIPS] Regex code for divxstage.net (eu) :) (/showthread.php?tid=140598)



[TIPS] Regex code for divxstage.net (eu) :) - drascom - 2012-09-15

hi guys i wrote simple regex code for my plugin which is reveal divxstage.net flv video link and wanna share you..if some one needs it

in my first video page i found the first embed link

Code:
match=re.compile('src=.*?embed\.php(.*?)\&').findall(link)
url='http://embed.divxstage.eu/embed.php'+str(match[0])
--------------------------- RESULT ----------------------------------
Code:
http://embed.divxstage.eu/embed.php?v=46dhv6rh25rl4
----------------------------------------------------------------------------

Use url to find first divxstage web page

Code:
match=re.compile('domain="http://www.divxstage.eu";\n\t\t\tflashvars.file="(.*?)";\n\t\t\tflashvars\.filekey="(.*?)"').findall(link)
for first,second in match:
    url ='http://www.divxstage.eu/api/player.api.php?file='+first+'&key='+second

------------------------- RESULT -------------------------------------------------------------
Code:
http://www.divxstage.eu/api/player.api.php?file=46dhv6rh25rl4&key=46.154.67.175-3d17eb5316ba4a2df288d82a14be3c87
-------------------------------------------------------------------------------

Use url to find second divxstage web page

Code:
match=re.compile('url=(.*?)&').findall(link)

-------------------------- RESULT ---------------------------------
Code:
http://s43.divxstage.eu/dl/abd0e59fa52829ac3e3eda55a2d39529/5054b6f4/fffde8ce1c925f20f46ce2310e94b6ec15.flv
-------------------------------------------------------------------------------------------------

Here is the flv link...

i know everybody knows code between lines but here is the code to open and read url

Code:
req = urllib2.Request(url)
req.add_header('User-Agent', USER_AGENT)
content = urllib2.urlopen(req)
data = content.read()
content.close()



RE: [TIPS] Regex code for divxstage.net (eu) :) - Bstrdsmkr - 2012-09-15

UrlResolver would have saved you a lot of time: https://github.com/Eldorados/script.module.urlresolver/blob/master/lib/urlresolver/plugins/divxstage.py
=)


RE: [TIPS] Regex code for divxstage.net (eu) :) - drascom - 2012-09-16

i know that but i'm beginning at coding and it gives me happinnes to resolve someting by myself Smile