diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py
index 55ca25d..8a79515 100644
--- a/Contents/Code/__init__.py
+++ b/Contents/Code/__init__.py
@@ -8,6 +8,7 @@
import desirulez
import desitvbox
import desitashan
+import yodesi
PREFIX = common.PREFIX
NAME = common.NAME
@@ -31,6 +32,7 @@ def Start():
@handler(PREFIX, NAME, art=ART, thumb=ICON)
def MainMenu():
oc = ObjectContainer()
+ oc.add(DirectoryObject(key=Callback(yodesi.ChannelsMenu, url=yodesi.SITEURL), title=yodesi.SITETITLE, thumb=R(yodesi.SITETHUMB)))
oc.add(DirectoryObject(key=Callback(desitvbox.ChannelsMenu, url=desitvbox.SITEURL), title=desitvbox.SITETITLE, thumb=R(desitvbox.SITETHUMB)))
oc.add(DirectoryObject(key=Callback(desitashan.ChannelsMenu, url=desitashan.SITEURL), title=desitashan.SITETITLE, thumb=R(desitashan.SITETHUMB)))
oc.add(DirectoryObject(key=Callback(desirulez.TypeMenu, url=desirulez.SITEURL), title=desirulez.SITETITLE, thumb=R(desirulez.SITETHUMB)))
diff --git a/Contents/Code/common.py b/Contents/Code/common.py
index b656fea..672ee10 100644
--- a/Contents/Code/common.py
+++ b/Contents/Code/common.py
@@ -1,6 +1,6 @@
################################################################################
TITLE = L('Title')
-VERSION = '0.06' # Release notation (x.y - where x is major and y is minor)
+VERSION = '0.07' # Release notation (x.y - where x is major and y is minor)
GITHUB_REPOSITORY = 'coder-alpha/DesiTelly.bundle'
PREFIX = "/video/desitelly"
################################################################################
@@ -86,9 +86,9 @@
#DesiTashan
TV_NEWS = 'TV News'
-VALID_SOURCES_DOMAIN = ['dailymotion.','playwire.','vidshare.','openload.','playu.', 'cloudy.', 'vmg.','watchvideo','tvlogy']
-VALID_SOURCES = ['Dailymotion','Flash Player','Flash','Playwire','Letwatch','Openload','PlayU','StreamHD','HDStream','Watchvideo','TvLogy']
-VALID_SOURCES_ICONS = ['dailymotion','playwire','playwire','playwire','letwatchus','openload','playu','vmg','vmg','source-watchvideo','tvlogy']
+VALID_SOURCES_DOMAIN = ['dailymotion.','playwire.','vidshare.','openload.','playu.', 'cloudy.', 'vmg.','watchvideo','tvlogy','google','mediatv.','vidwatch3.','speedwatch.us','tune.pk']
+VALID_SOURCES = ['Dailymotion','Flash Player','Flash','Playwire','Letwatch','Openload','PlayU','StreamHD','HDStream','Watchvideo','TvLogy','Google','VidWatch','Vid Watch','SpeedWatch','Speed','TunePK','Tune']
+VALID_SOURCES_ICONS = ['dailymotion','playwire','playwire','playwire','letwatchus','openload','playu','vmg','vmg','source-watchvideo','tvlogy','google','vidwatch','vidwatch','speedwatch','speedwatch','tunepk','tunepk']
####################################################################################################
diff --git a/Contents/Code/common_fnc.py b/Contents/Code/common_fnc.py
index e2010dc..c08bbf3 100644
--- a/Contents/Code/common_fnc.py
+++ b/Contents/Code/common_fnc.py
@@ -150,6 +150,11 @@ def GetTvURLSource(url, referer, date='', key=None):
elif len(html.xpath("//iframe[contains(@src,'openload.')]/@src")) > 0:
#Log('openload')
url = html.xpath("//iframe[contains(@src,'openload.co')]/@src")[0]
+ elif len(html.xpath("//iframe[contains(@src,'tune.')]/@src")) > 0:
+ #Log('tune')
+ url = html.xpath("//iframe[contains(@src,'tune.')]/@src")[0]
+ html = HTML.ElementFromURL(url=url, headers={'Referer': url})
+ url = html.xpath("//iframe[contains(@src,'tune.')]/@src")[0]
else:
#Log('Undefined src')
orig_url = url
@@ -179,11 +184,17 @@ def GetTvURLSource(url, referer, date='', key=None):
except:
pass
- #Log(url)
+ if Prefs["use_debug"]:
+ Log("common_fnc.GetTvURLSource : %s" % url)
+
if url.startswith('//'):
url = 'http:' + url
url = CheckURLSource(url=url, referer=referer, key=key, string=string, html=html)
+
+ if Prefs["use_debug"]:
+ Log("Post CheckURLSource")
+ Log("common_fnc.GetTvURLSource : %s" % url)
return url
@@ -193,8 +204,6 @@ def CheckURLSource(url, referer, key=None, string=None, html=None, stringMatch=F
if string == None:
string = HTTP.Request(url=url, headers={'Referer': referer}).content
- #Log('string: ' + string)
-
try:
if string.find('dailymotion.com') != -1:
#Log('dailymotion')
@@ -206,6 +215,11 @@ def CheckURLSource(url, referer, key=None, string=None, html=None, stringMatch=F
page = HTTP.Request(url, headers={'Referer': referer}).content
if 'Content removed' in page or 'Content rejected' in page or 'This video got removed' in page or 'ERROR' in page:
url = 'disabled'
+ elif string.find('tune.') != -1:
+ #Log('tune')
+ page = HTTP.Request(url, headers={'Referer': referer}).content
+ if 'Content removed' in page or 'Content rejected' in page or 'this video has been deactivated' in page or 'ERROR' in page:
+ url = 'disabled'
elif string.find('vidshare.') != -1:
#Log('vidshare')
try:
diff --git a/Contents/Code/desitashan.py b/Contents/Code/desitashan.py
index 5a826ec..f7b91c7 100644
--- a/Contents/Code/desitashan.py
+++ b/Contents/Code/desitashan.py
@@ -26,7 +26,6 @@ def ChannelsMenu(url):
# Channel title
channel = item.xpath("text()")[0]
# Log("Channel = "+channel)
- # Log("item "+ etree.tostring(item, pretty_print=True))
# Channel link
link = item.xpath("@href")[0]
if link.startswith("http") == False:
@@ -118,7 +117,7 @@ def EpisodesMenu(url, title):
# Add the found item to the collection
if 'Watch'.lower() in episode.lower():
- episode = episode.replace(' Video Watch...','')
+ episode = episode.replace(' Video Watch...','').replace(' Video Watch','')
oc.add(PopupDirectoryObject(key=Callback(PlayerLinksMenu, url=link, title=episode, type=L('Tv')), title=episode))
# Find the total number of pages
diff --git a/Contents/Code/yodesi.py b/Contents/Code/yodesi.py
new file mode 100644
index 0000000..8f2853e
--- /dev/null
+++ b/Contents/Code/yodesi.py
@@ -0,0 +1,311 @@
+import common, common_fnc
+import messages
+import re
+
+SITETITLE = 'Yo-Desi'
+SITEURL = 'http://www.yodesi.tv'
+SITETHUMB = 'icon-yodesi.png'
+
+PREFIX = common.PREFIX
+NAME = common.NAME
+ART = common.ART
+ICON = common.ICON
+
+MC = messages.NewMessageContainer(common.PREFIX, common.TITLE)
+
+SWITCH_1 = ['Flash','Yodplayer']
+SWITCH_2 = ['Google','TvLogy']
+
+####################################################################################################
+
+@route('%s/%s/channels' % (PREFIX,SITETITLE))
+def ChannelsMenu(url):
+ oc = ObjectContainer(title2=SITETITLE)
+
+ html = HTML.ElementFromURL(url)
+
+ for item in html.xpath(".//nav[@id='navigation']//li//a"):
+ try:
+ # Channel title
+ channel = item.xpath("text()")[0]
+ #Log("Channel = "+channel)
+ # Channel link
+ link = item.xpath("@href")[0]
+ if link.startswith("http") == False:
+ link = SITEURL + link
+
+ #Log("Channel Link: " + link)
+ except:
+ pass
+
+ try:
+ image = common.GetThumb(channel.lower())
+ except:
+ continue
+
+ if channel.lower() in common.GetSupportedChannels():
+ oc.add(DirectoryObject(key=Callback(ShowsMenu, url=link, title=channel), title=channel, thumb=image))
+
+ # If there are no channels, warn the user
+ if len(oc) == 0:
+ return ObjectContainer(header=SITETITLE, message=L('ChannelWarning'))
+
+ return oc
+
+####################################################################################################
+
+@route('%s/%s/showsmenu' % (PREFIX,SITETITLE))
+def ShowsMenu(url, title):
+ oc = ObjectContainer(title2=title)
+ #Log("Shows Menu: " + url + ":" + title)
+ html = HTML.ElementFromURL(url)
+
+ for item in html.xpath(".//div[@id='tab-0-title-1']//div[contains(@class, 'one_fourth')]"):
+ #Log("item "+ etree.tostring(item, pretty_print=True))
+ try:
+ # Show title
+ show = item.xpath(".//p//text()")[0]
+ thumb = item.xpath(".//img//@src")[0]
+ #Log("show name: " + show)
+ # Show link
+ link = item.xpath(".//p//@href")[0]
+ #Log("show link: " + link)
+ if link.startswith("http") == False:
+ link = SITEURL + link.lstrip('/')
+# Log("final show link: " + link)
+ except:
+ #Log("In Excpetion")
+ continue
+
+ # Add the found item to the collection
+ oc.add(DirectoryObject(key=Callback(EpisodesMenu, url=link, title=show), title=show, thumb=thumb))
+
+ for item in html.xpath(".//div[@id='tab-1-title-2']//div[contains(@class, 'one_fourth')]"):
+ #Log("item "+ etree.tostring(item, pretty_print=True))
+ try:
+ # Show title
+ show = item.xpath(".//p//text()")[0] + ' (Archived)'
+ thumb = item.xpath(".//img//@src")[0]
+ #Log("show name: " + show)
+ # Show link
+ link = item.xpath(".//p//@href")[0]
+ #Log("show link: " + link)
+ if link.startswith("http") == False:
+ link = SITEURL + link.lstrip('/')
+# Log("final show link: " + link)
+ except:
+ #Log("In Excpetion")
+ continue
+
+ # Add the found item to the collection
+ oc.add(DirectoryObject(key=Callback(EpisodesMenu, url=link, title=show), title=show, thumb=thumb))
+
+ # If there are no channels, warn the user
+ if len(oc) == 0:
+ return ObjectContainer(header=title, message=L('ShowWarning'))
+
+ return oc
+
+####################################################################################################
+
+@route('%s/%s/episodesmenu' % (PREFIX,SITETITLE))
+def EpisodesMenu(url, title):
+ oc = ObjectContainer(title2 = unicode(title))
+
+ pageurl = url
+
+ html = HTML.ElementFromURL(pageurl)
+
+ for item in html.xpath(".//div[@id='content_box']//article"):
+ try:
+ # Episode title
+ episode = unicode(str(item.xpath(".//header//h2//text()")[0].strip()))
+ thumb = unicode(str(item.xpath(".//a//img//@src")[0].strip()))
+
+ # episode link
+ link = item.xpath(".//h2//@href")[0]
+ if link.startswith("http") == False:
+ link = SITEURL + link.lstrip('/')
+ #Log("Episode: " + episode + " Link: " + link)
+ except:
+ continue
+
+ # Add the found item to the collection
+ if 'Watch'.lower() in episode.lower():
+ episode = episode.replace(' Watch Online','')
+ oc.add(PopupDirectoryObject(key=Callback(PlayerLinksMenu, url=link, title=episode, type=L('Tv')), title=episode))
+
+ # Find the total number of pages
+ next_page = ' '
+ try:
+ next_page = html.xpath(".//div[@id='content_box']//nav//a[@class='next page-numbers']//@href")
+ oc.add(DirectoryObject(key=Callback(EpisodesMenu, url=next_page, title=title), title=L('Pages')))
+ except:
+ pass
+
+ # If there are no channels, warn the user
+ if len(oc) == 0:
+ return ObjectContainer(header=title, message=L('EpisodeWarning'))
+
+ if common_fnc.CheckPin(url=url):
+ oc.add(DirectoryObject(
+ key = Callback(common_fnc.RemovePin, url = url),
+ title = "Remove Pin",
+ summary = 'Removes the current Show from the Pin list',
+ thumb = R(common.ICON_PIN)
+ ))
+ else:
+ oc.add(DirectoryObject(
+ key = Callback(common_fnc.AddPin, site = SITETITLE, url = url, title = title),
+ title = "Pin Show",
+ summary = 'Adds the current Show to the Pin list',
+ thumb = R(common.ICON_PIN)
+ ))
+
+ return oc
+
+####################################################################################################
+
+@route('%s/%s/playerlinksmenu' % (PREFIX,SITETITLE))
+def PlayerLinksMenu(url, title, type):
+ oc = ObjectContainer(title2 = unicode(title))
+
+ html = HTML.ElementFromURL(url=url, headers={'Referer': url})
+ content = HTML.StringFromElement(html)
+ thumb = GetThumb(html)
+
+ oc.art = Resource.ContentsOfURLWithFallback(thumb, fallback=R(ART))
+
+ if '/images/xfuture.png.pagespeed.ic.WVkcd7CGfW.png' in content:
+ return ObjectContainer(header=title, message=L('ComingSoonWarning'))
+
+ sources = html.xpath(".//*//div[@class='thecontent']//span//text()")
+
+ for source in sources:
+ source = Switch(source, SWITCH_1, SWITCH_2)
+ s_source, i = common_fnc.GetArrayItemMatchInString(common.VALID_SOURCES, source.lower(), False)
+ if s_source <> None:
+ if '720p' in source.lower():
+ if 'single' in source.lower():
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=(common.VALID_SOURCES[i] + ' HD (Single Link)'), thumb=R('icon-'+common.VALID_SOURCES_ICONS[i]+'.png')))
+ else:
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=(common.VALID_SOURCES[i] + ' HD'), thumb=R('icon-'+common.VALID_SOURCES_ICONS[i]+'.png')))
+ elif 'hd' in source.lower():
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=(common.VALID_SOURCES[i] + ' HD'), thumb=R('icon-'+common.VALID_SOURCES_ICONS[i]+'.png')))
+ elif 'dvd' in source.lower():
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=(common.VALID_SOURCES[i] + ' DVD'), thumb=R('icon-'+common.VALID_SOURCES_ICONS[i]+'.png')))
+ else:
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=common.VALID_SOURCES[i], thumb=R('icon-'+common.VALID_SOURCES_ICONS[i]+'.png')))
+ elif Prefs['allow_unknown_sources']:
+ oc.add(DirectoryObject(key=Callback(EpisodeLinksMenu, url=url, title=title, type=source, thumb=thumb), title=source, thumb=R('icon-unknown.png')))
+
+# If there are no channels, warn the user
+ if len(oc) == 0:
+ return ObjectContainer(header=title, message=L('PlayerWarning'))
+
+ oc.objects.sort(key=lambda obj: obj.title, reverse=False)
+
+ return oc
+
+####################################################################################################
+
+@route('%s/%s/episodelinksmenu' % (PREFIX,SITETITLE))
+def EpisodeLinksMenu(url, title, type, thumb):
+
+ oc = ObjectContainer(title2 = unicode(title))
+ oc.art = Resource.ContentsOfURLWithFallback(thumb, fallback=R(ART))
+
+ html = HTML.ElementFromURL(url)
+ # Summary
+ summary = GetSummary(html)
+ items = GetParts(html, Switch(type, SWITCH_2, SWITCH_1))
+
+ links = []
+
+ for item in items:
+
+ try:
+ # Video site
+ videosite = item.xpath(".//text()")[0]
+ videosite = Switch(videosite, SWITCH_1, SWITCH_2)
+ if Prefs["use_debug"]:
+ Log("Video Site: " + videosite)
+ # Video link
+ link = item.xpath(".//@href")[0]
+ if Prefs["use_debug"]:
+ Log("Link: " + link)
+ if link.startswith("http") == False:
+ link = link.lstrip('htp:/')
+ link = 'http://' + link
+
+ # Get video source url and thumb
+ link = common_fnc.GetTvURLSource(link,url)
+ if Prefs["use_debug"]:
+ Log("Video Site: " + videosite + " Link: " + link + " Thumb: " + thumb)
+ except:
+ continue
+
+ links.append(link)
+
+ # Add the found item to the collection
+ if common_fnc.IsArrayItemInString2(common.VALID_SOURCES_DOMAIN, link, False) or (Prefs['allow_unknown_sources'] and URLService.ServiceIdentifierForURL(link) <> None):
+
+ if link.find('openload') != -1 and not common_fnc.is_uss_installed():
+ return MC.message_container('Error', 'UnSupportedServices.bundle Required')
+
+ oc.add(VideoClipObject(
+ url = link,
+ title = videosite,
+ thumb = Resource.ContentsOfURLWithFallback(thumb, fallback=R(ICON)),
+ art = Resource.ContentsOfURLWithFallback(thumb, fallback=R(ART)),
+ summary = summary))
+
+ # If there are no channels, warn the user
+ if len(oc) == 0 and 'disabled' in links:
+ return ObjectContainer(header=title, message=L('DisabledWarning'))
+ if len(oc) == 0:
+ return ObjectContainer(header=title, message=L('SourceWarning'))
+
+ return oc
+
+####################################################################################################
+
+def GetParts(html, keyword):
+
+ xpath_str = ".//*//div[@class='thecontent']//span[contains(text(),'"+keyword+"')]//following::p[1]//a"
+
+ try:
+ items = html.xpath(xpath_str)
+ except:
+ items = []
+
+ return items
+
+####################################################################################################
+
+def GetSummary(html):
+ try:
+ summary = html.xpath("//h1[@class='entry_title entry-title']/text()")[0]
+ except:
+ summary = ''
+ return summary
+
+####################################################################################################
+
+def GetThumb(html):
+ try:
+ thumb = html.xpath(".//meta[@name='twitter:image']//@content")[0]
+ Log ('Thumb: ' + thumb)
+ except:
+ thumb = R(ICON)
+ return thumb
+
+####################################################################################################
+
+def Switch(mystr, arr_in, arr_to):
+ try:
+ for i in range(0, len(arr_in)):
+ mystr = mystr.replace(arr_in[i], arr_to[i])
+ except:
+ pass
+ return mystr
\ No newline at end of file
diff --git a/Contents/DefaultPrefs.json b/Contents/DefaultPrefs.json
index 989c886..ac48e4e 100644
--- a/Contents/DefaultPrefs.json
+++ b/Contents/DefaultPrefs.json
@@ -1 +1 @@
-[
{
"id": "allow_unknown_sources",
"label": "Allow Hosts natively NOT supported by this plugin (Default is False | Experimental feature)",
"type": "bool",
"default": "false"
},
{
"id": "consolidate_parts",
"label": "Consolidate Parts - Flash/Playwire [Desitvbox] (Default is False | Experimental feature)",
"type": "bool",
"default": "false"
}
]
\ No newline at end of file
+[
{
"id": "allow_unknown_sources",
"label": "Allow Hosts natively NOT supported by this plugin (Default is False | Experimental feature)",
"type": "bool",
"default": "false"
},
{
"id": "consolidate_parts",
"label": "Consolidate Parts - Flash/Playwire [Desitvbox] (Default is False | Experimental feature)",
"type": "bool",
"default": "false"
},
{
"id": "use_debug",
"label": "Debug Mode",
"type": "bool",
"default": "false"
}
]
\ No newline at end of file
diff --git a/Contents/Resources/icon-google.png b/Contents/Resources/icon-google.png
new file mode 100644
index 0000000..bcd695b
Binary files /dev/null and b/Contents/Resources/icon-google.png differ
diff --git a/Contents/Resources/icon-speedwatch.png b/Contents/Resources/icon-speedwatch.png
new file mode 100644
index 0000000..7fcec45
Binary files /dev/null and b/Contents/Resources/icon-speedwatch.png differ
diff --git a/Contents/Resources/icon-tunepk.png b/Contents/Resources/icon-tunepk.png
new file mode 100644
index 0000000..f1f8eb8
Binary files /dev/null and b/Contents/Resources/icon-tunepk.png differ
diff --git a/Contents/Resources/icon-vidwatch.png b/Contents/Resources/icon-vidwatch.png
new file mode 100644
index 0000000..9d738fb
Binary files /dev/null and b/Contents/Resources/icon-vidwatch.png differ
diff --git a/Contents/Resources/icon-yodesi.png b/Contents/Resources/icon-yodesi.png
new file mode 100644
index 0000000..7764573
Binary files /dev/null and b/Contents/Resources/icon-yodesi.png differ
diff --git a/Contents/Services/ServiceInfo.plist b/Contents/Services/ServiceInfo.plist
index 419486d..6ca6021 100644
--- a/Contents/Services/ServiceInfo.plist
+++ b/Contents/Services/ServiceInfo.plist
@@ -20,6 +20,13 @@
<2 d="20" c="#17">2u 19.2><16/><2 d="18" c="#15">2t 2s 2r 2q.2>
\',2p:\'<2 d="20" c="#17">2o 2n b.2><16/><2 d="18" c="#15">2m 2l 2k 2j.2>
\',},2i:\'2h\',2g:[{14:"11",b:"5://a.8.7/2f/13.12"},{14:"2e",b:"5://a.8.7/2d/13.12"},],2c:"11",2b:[{10:\'2a\',29:\'5://v.8.7/t-m/m.28\'},{10:\'27\'}],26:{\'25-3\':{\'24\':{\'23\':22,\'21\':\'5://a.8.7/i/z/y/\',\'1z\':\'w\',\'1y\':\'1x\'}}},s:\'5://v.8.7/t-m/s/1w.1v\',1u:"1t",1s:"1r",1q:\'1p\',1o:"1n",1m:"1l",1k:\'5\',1j:\'o\',});l e;l k=0;l 6=0;4().1i(9(x){f(6>0)k+=x.r-6;6=x.r;f(q!=0&&k>=q){6=-1;4().1h();4().1g(o);$(\'#1f\').j();$(\'h.g\').j()}});4().1e(9(x){6=-1});4().1d(9(x){n(x)});4().1c(9(){$(\'h.g\').j()});9 n(x){$(\'h.g\').1b();f(e)1a;e=1;}',36,109,'||font||jwplayer|http|p0102895|me|vidto|function|edge3|file|color|size|vvplay|if|video_ad|div||show|tt102895|var|player|doPlay|false||21600|position|skin|test||static|1y7okrqkv4ji||00020|01|type|360p|mp4|video|label|FFFFFF|br|FF0000||deleted|return|hide|onComplete|onPlay|onSeek|play_limit_box|setFullscreen|stop|onTime|dock|provider|391|height|650|width|over|controlbar|5110|duration|uniform|stretching|zip|stormtrooper|213|frequency|prefix||path|true|enabled|preview|timeslidertooltipplugin|plugins|html5|swf|src|flash|modes|hd_default|3bjhohfxpiqwws4phvqtsnolxocychumk274dsnkblz6sfgq6uz6zt77gxia|240p|3bjhohfxpiqwws4phvqtsnolxocychumk274dsnkba36sfgq6uzy3tv2oidq|hd|original|ratio|broken|is|link|Your|such|No|nofile|more|any|availabe|Not|File|OK|previw|jpg|image|setup|flvplayer'.split('|')))''' + # test = '''eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('y.x(A(\'%0%f%b%9%1%d%8%8%o%e%B%c%0%e%d%0%f%w%1%7%3%2%p%d%1%n%2%1%c%0%t%0%f%7%8%8%d%5%6%1%7%e%b%l%7%1%2%e%9%q%c%0%6%1%z%2%0%f%b%1%9%c%0%s%6%6%l%G%4%4%5%5%5%k%b%7%5%8%o%i%2%k%6%i%4%2%3%p%2%n%4%5%7%6%9%s%4%j%q%a%h%a%3%a%E%a%3%D%H%9%K%C%I%m%r%g%h%L%v%g%u%F%r%g%3%J%3%j%3%m%h%4\'));',48,48,'22|72|65|6d|2f|77|74|61|6c|63|4e|73|3d|6f|6e|20|4d|32|76|59|2e|70|51|64|69|62|79|31|68|30|7a|34|66|write|document|75|unescape|67|4f|5a|57|55|3a|44|47|4a|78|49'.split('|'),0,{}))''' + # test = '''eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('x.w(z(\'%1%f%9%b%0%d%7%7%m%e%A%c%1%e%d%1%f%v%0%3%i%2%o%d%0%s%2%0%c%1%q%1%f%3%7%7%d%6%5%0%3%e%9%l%3%0%2%e%b%g%c%1%5%0%y%2%1%f%9%0%b%c%1%r%5%5%l%E%4%4%6%6%6%n%9%3%6%7%m%k%2%n%5%k%4%2%i%o%2%s%4%6%3%5%b%r%4%8%D%h%C%a%F%8%H%B%I%h%i%a%g%8%u%a%q%j%t%j%g%8%t%h%p%j%p%a%G%4\'));',45,45,'72|22|65|61|2f|74|77|6c|5a|73|55|63|3d|6f|6e|20|79|59|6d|4d|76|70|69|2e|62|7a|30|68|64|44|54|66|write|document|75|unescape|67|51|32|6a|3a|35|5f|47|34'.split('|'),0,{}))''' + #test = '''eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('q.r(s(\'%h%t%a%p%u%6%c%n%0%5%l%4%2%4%7%j%0%8%1%o%b%3%7%m%1%8%a%7%b%3%d%6%1%f%0%v%1%5%D%9%0%5%c%g%0%4%A%9%0%f%k%z%2%8%1%C%2%i%d%6%2%3%k%j%2%3%y%e%x%w%g%B%E%F%i%h%e\'));',42,42,'5a|4d|4f|54|6a|44|33|6b|57|7a|56|4e|68|55|3e|47|69|65|6d|32|45|46|31|6f|30|75|document|write|unescape|6e|62|6c|2f|3c|22|79|63|66|78|59|72|61'.split('|'),0,{}))''' + #test = '''eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('g 11=3("3e");11.3d({3c:[{8:"4://b.a.6/3b/3a,39,38,.37/36.35"},{8:"4://b.a.6/34/v.10",z:"33"},{8:"4://b.a.6/32/v.10",z:"31","30":"j"}],2z:"4://b.a.6/i/2y/2x/2w.2v",2u:"2t",2s:"y%",2r:"y%",2q:"16:9",2p:"j",2o:"2n",2m:j,2l:"2k",2j:{2i:"2h"},2g:{2f:"2e",2d:{"2c":{"2a":"29","28":""}}},27:"26",25:[],24:"22",21:"20://1z.6",w:{8:"/o?n=w&1y=m"}});g c,h;3().1x(2(x){d(5>0&&x.1w>=5&&h!=1){h=1;$(\'7.1v\').e(\'1u\')}});3().1t(2(x){r(x)});3().1s(2(){$(\'.t\').e()});3().f(2(){$(\'7.q\').1r()});3().f(2(){d(1q!=\'1p\'){g s=u.1o(\'1n\');s.1m="4://1l.1k/23/2b/1j/1i.1h";u.1g("1f")[0].1e(s)}});3().f(2(){$(\'.t\').e()});2 r(x){$(\'7.q\').p();$(\'7.1d\').p();d(c)1c;c=1;$.1b(\'/o?n=1a&19=m&18=17-l-l-15-14\',2(k){$(\'#13\').12(k)})}',36,123,'||function|jwplayer|https||us|div|file||jiocdn|sw6|vvplay|if|fadeIn|onComplete|var|vvad||true|data|128|9qajtrzqdroh|op|dl|hide|video_ad|doPlay||cover1big|document||related||100|label|mp4|player|html|fviews|54783e1b1a6b24779d53c757e445795c|1495739204||149992|hash|file_code|view|get|return|cover1big2|appendChild|head|getElementsByTagName|js|232b06388cc2a88e3d917b4e0e916453|06|com|ssl2anyone4|src|script|createElement|546|555|show|onPause|onPlay|slow|video_ad_fadein|position|onTime|code|speedwatch|http|aboutlink|SpeedWatch||abouttext|tracks|start|startparam|tag|pre|offset||myAds|schedule|vast|client|advertising|thin|name|skin|exactfit|stretching|hlshtml|none|preload|androidhls|aspectratio|height|width|640|duration|jpg|tid2fqeq8s0o|00029|01|image|default|360|xcgfuejeypfxwbmljj3padopp2iw2a2tugsh3fgk3i6zj4nxxgq3zatcthqq|720|xcgfuejeypfxwbmljj3padopp2iw2a2tugsh3fgk3tgzj4nxxgq3fsnmfoma|m3u8|master|urlset|tgzj4nxxgq3fsnmfoma|i6zj4nxxgq3zatcthqq|xcgfuejeypfxwbmljj3padopp2iw2a2tugsh3fgk3|hls|sources|setup|vplayer'.split('|')))''' + test = '''eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('6("3i").3h({3g:[{k:"2://a.8.7/3f/3e,3d,3c,.3b/3a.39"},{k:"2://a.8.7/38/v.10",z:"37"},{k:"2://a.8.7/36/v.10",z:"35"}],34:"2://a.8.7/i/33/32/31.30",2z:"2y",2x:"j%",2w:"j%",2v:"16:9",2u:"y",2t:"2s",2r:y,2q:"2p",2o:{2n:"2m"},2l:"2k",2j:[],2i:{2h:\'#2g\',2f:15,2e:"2d",2c:j},"2b":{2a:"%29 28%w%27%26%25%24.4%23-c.b%22 21%h 20%h 1z%h 1y%1x 1w%w%1v%22 1u%1t 1s%1r%u%1q%1p%u",1o:"2://d.4/c.b"},1n:"1m.4",1l:"2://d.4"});1k e,g;6().1j(3(x){n(5>0&&x.1i>=5&&g!=1){g=1;$(\'f.1h\').s(\'1g\')}});6().1f(3(x){r(x)});6().t(3(){$(\'f.q\').1e()});6().t(3(){$(\'.p\').s()});3 r(x){$(\'f.q\').o();$(\'.p\').o();n(e)1d;e=1;$.1c(\'2://d.4/1b?1a=19&18=c&17=14-m-m-13-12\',3(l){$(\'#11\').b(l)})}',36,127,'||http|function|me||jwplayer|us|jiocdn||vw100|html|cynkfve9rbyi|vidwatch|vvplay|div|vvad|3D0||100|file|data|128|if|hide|cover1big|video_ad|doPlay|fadeIn|onComplete|3E||3D||true|label|mp4|fviews|7d9362b1bf89a2b2933c314669098a66|1495739666|259124|||hash|file_code|view|op|dl|get|return|show|onPlay|slow|video_ad_fadein|position|onTime|var|aboutlink|VidWatch|abouttext|link|2FIFRAME|3C|3D440|HEIGHT|3D700|WIDTH|22true|allowfullscreen|3DNO|SCROLLING|MARGINHEIGHT|MARGINWIDTH|FRAMEBORDER||2Fembed|2Fvidwatch|2F|3A|22http|SRC|3CIFRAME|code|sharing|backgroundOpacity|Verdana|fontFamily|fontSize|FFFFFF|color|captions|tracks|start|startparam|thin|name|skin|exactfit|stretching|hlshtml|none|preload|androidhls|aspectratio|height|width|640|duration|jpg|cbqnjibeer5z_xt|00051|01|image|360|be33kmduv62gyphx4pm7cjctczhvawl3howof4vzqjeuu2ezfr35bat7c2dq|720|be33kmduv62gyphx4pm7cjctczhvawl3howof4vzqq2vq2ezfr3vpantd35q|m3u8|master|urlset|q2vq2ezfr3vpantd35q|jeuu2ezfr35bat7c2dq|be33kmduv62gyphx4pm7cjctczhvawl3howof4vzq|hls|sources|setup|vplayer'.split('|')))''' + print unpack(test) + +def jsunpack_keys(): + #TODO: I need 1 week..., to disable this... + FEATURES = [ + base64.urlsafe_b64decode('NGJlNjhkN2VhYjFmYmQxYjZmZDhhM2I4MGE2NWE5NWU='), + base64.urlsafe_b64decode('OGQwZTRkY2E4NmM3NzlmNDE1N2ZjMmM0NjljMzcyY2E='), + base64.urlsafe_b64decode('YTNkYzExMWU2NjEwNWY2Mzg3ZTk5MzkzODEzYWU0ZDU='), + base64.urlsafe_b64decode('YTg2MjY3M2I4ZDExMmZjMjMxMTdlNTQ4ZTdlODM5MTY='), + base64.urlsafe_b64decode('NDEyZThjYTNiODY0YjQ1ODA1OWY5NjNkYzU2MzNiMGE='), + base64.urlsafe_b64decode('ODY0YjZkZThhOWJiOGYyZmQ5N2Q3ZjZlNDEyYjY5MDI=') + ] + return random.choice(FEATURES) + +#test() \ No newline at end of file diff --git a/Contents/Services/URL/Google/ServiceCode.pys b/Contents/Services/URL/Google/ServiceCode.pys new file mode 100644 index 0000000..eff6a11 --- /dev/null +++ b/Contents/Services/URL/Google/ServiceCode.pys @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import string, re + +ART = 'http://i.imgur.com/GwSnkxE.jpg' +COVER = 'http://i.imgur.com/0snKSZt.png' +USE_ITAG = True + +######################################################################################## +def NormalizeURL(url): + + return url + +#################################################################################################### +def MetadataObjectForURL(url): + + thumb = '' + title = 'Google Redirect Page' + summary = 'Summary info Page' + + return VideoClipObject( + title = title, + summary = summary, + art = Resource.ContentsOfURLWithFallback([thumb,ART]), + thumb = Resource.ContentsOfURLWithFallback([thumb,COVER]) + ) + +#################################################################################################### +def MediaObjectsForURL(url): + + page_data = HTTP.Request(url).content + #Log(page_data) + files = [] + + try: + match = re.findall(r'\[{.+}]', page_data)[0] + #Log(match) + files = JSON.ObjectFromString(match) + except: + pass + + if len(files) == 0: + raise Ex.MediaNotAvailable + + sortable_list = [] + for file in files: + furl = file['file'] + res = None + if USE_ITAG: + res = googletag(furl) + #Log(res) + if res != None: + res = res['quality'].replace('p','') + if res != '1080': + res = '0'+res + if res == None: + if 'label' in file.keys(): + res = file['label'].replace('p','') + if res != '1080': + res = '0'+res + else: + res = '720' + + + #type = file['type'] + sortable_list.append({'label': res, 'file':furl}) + + newlist = sorted(sortable_list, key=lambda k: k['label'], reverse=True) + media_obj = [] + + for file in newlist: + furl = file['file'] + res = int(file['label']) + #type = file['type'] + + #Log("furl ---- %s" % furl) + + if '.flv' in furl: + mo = MediaObject( + container = Container.FLV, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + else: + mo = MediaObject( + container = Container.MP4, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + + media_obj.append(mo) + + return media_obj + +#################################################################################################### +@indirect +def PlayVideo(url): + + return IndirectResponse(VideoClipObject, key = url) + +#################################################################################################### +def googletag(url): + quality = re.compile('itag=(\d*)').findall(url) + quality += re.compile('=m(\d*)$').findall(url) + try: quality = quality[0] + except: return None + #control.log('<><><><><><><><><><><><> %s <><><><><><><><><>' % quality) + if quality in ['37', '137', '299', '96', '248', '303', '46']: + return {'source': 'gvideo', 'quality': u'1080p', 'url': url} + elif quality in ['22', '84', '136', '298', '120', '95', '247', '302', '45', '102']: + return {'source': 'gvideo', 'quality': u'720p', 'url': url} + elif quality in ['35', '44', '135', '244', '94', '59']: + return {'source': 'gvideo', 'quality': u'480p', 'url': url} + elif quality in ['18', '34', '43', '82', '100', '101', '134', '243', '93']: + return {'source': 'gvideo', 'quality': u'480p', 'url': url} + elif quality in ['5', '6', '36', '83', '133', '242', '92', '132']: + return {'source': 'gvideo', 'quality': u'480p', 'url': url} + else: + return {'source': 'gvideo', 'quality': u'720p', 'url': url} diff --git a/Contents/Services/URL/SpeedWatch/ServiceCode.pys b/Contents/Services/URL/SpeedWatch/ServiceCode.pys new file mode 100644 index 0000000..402fb39 --- /dev/null +++ b/Contents/Services/URL/SpeedWatch/ServiceCode.pys @@ -0,0 +1,137 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import string, re + +# import Shared ServiceCode +import jsunpack as JSP + +ART = 'http://i.imgur.com/GwSnkxE.jpg' +COVER = 'http://i.imgur.com/0snKSZt.png' + +######################################################################################## +def NormalizeURL(url): + + return url + +#################################################################################################### +def MetadataObjectForURL(url): + + title = 'SpeedWatch Redirect Page' + summary = 'Summary info Page' + + try: + txt = HTTP.Request(url).content + JSP_codes = re.findall(r'eval\(.+\)', txt) + for JSP_code in JSP_codes: + if 'jwplayer' in JSP_code: + break + # Log(JSP_code) + txt = JSP.unpack(JSP_code) + txt = re.findall(r'{.*}\);var', txt)[0] + txt = re.findall(r'{.*}', txt)[0] + jsondata = JSON.ObjectFromString(txt) + thumb = jsondata['image'] + duration = jsondata['duration'] + summary = jsondata['abouttext'] + except: + thumb = url + + return VideoClipObject( + title = title, + summary = summary, + art = Resource.ContentsOfURLWithFallback([thumb, ART]), + thumb = Resource.ContentsOfURLWithFallback([thumb, COVER]) + ) + +#################################################################################################### +def MediaObjectsForURL(url): + + #Log("url-----------" + url) + files = [] + try: + page_data = HTTP.Request(url).content + #Log(page_data) + JSP_codes = re.findall(r'eval\(.+\)', page_data) + for JSP_code in JSP_codes: + if 'jwplayer' in JSP_code: + break + #Log(JSP_code) + txt = JSP.unpack(JSP_code) + #Log(txt) + sources = re.findall(r'\[{.*}]', txt)[0] + #Log(sources) + files = JSON.ObjectFromString(sources) + #Log(files) + except: + pass + + if len(files) == 0: + raise Ex.MediaNotAvailable + + #Log(files) + + sortable_list = [] + for file in files: + furl = file['file'] + + if 'label' in file.keys(): + res = file['label'].replace('p','') + if res != '1080': + res = '0'+res + else: + res = '720' + sortable_list.append({'label': res, 'file':furl}) + + newlist = sorted(sortable_list, key=lambda k: k['label'], reverse=True) + media_obj = [] + + for file in newlist: + furl = file['file'] + res = int(file['label']) + + #Log("furl ---- %s" % furl) + + if '.flv' in furl: + mo = MediaObject( + container = Container.FLV, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + elif '.m3u8' in furl: + mo = MediaObject( + protocol = 'hls', + container = 'mpegts', + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + else: + mo = MediaObject( + container = Container.MP4, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + + media_obj.append(mo) + + return media_obj + +#################################################################################################### +@indirect +def PlayVideo(url): + + if '.m3u8' in url: + return IndirectResponse(VideoClipObject, key=HTTPLiveStreamURL(url)) + else: + return IndirectResponse(VideoClipObject, key=url) diff --git a/Contents/Services/URL/TunePK/ServiceCode.pys b/Contents/Services/URL/TunePK/ServiceCode.pys new file mode 100644 index 0000000..886aa97 --- /dev/null +++ b/Contents/Services/URL/TunePK/ServiceCode.pys @@ -0,0 +1,147 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import string, re, json + +HTTP_HEADERS = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'} + +ART = 'http://i.imgur.com/GwSnkxE.jpg' +COVER = 'http://i.imgur.com/0snKSZt.png' + +######################################################################################## +def NormalizeURL(url): + + return url + +#################################################################################################### +def MetadataObjectForURL(url): + + title = 'TunePK Redirect Page' + summary = 'Summary info Page' + thumb = COVER + duration = 1000 + + try: + http_headers = HTTP_HEADERS + #http_headers['Referer'] = url + #page_elems = HTML.ElementFromURL(url, headers=http_headers) + #url = page_elems.xpath("//iframe[contains(@src,'tune.pk')]/@src")[0] + refurl = url + http_headers['Referer'] = url + page_data = HTTP.Request(url, headers=http_headers).content + url = re.findall(r'\'(.*api_key.*)\'', page_data)[0] + http_headers['Referer'] = url + page_data = HTTP.Request(url, headers=http_headers).content + jsondata = JSON.ObjectFromString(page_data) + duration = int(jsondata['data']['details']['duration']) * 1000 + title = jsondata['data']['details']['video']['title'] + thumb = jsondata['data']['details']['video']['thumb'] + except: + pass + + return VideoClipObject( + title = title, + summary = summary, + duration = duration, + art = Resource.ContentsOfURLWithFallback([thumb,ART]), + thumb = Resource.ContentsOfURLWithFallback([thumb,COVER]) + ) + +#################################################################################################### +def MediaObjectsForURL(url): + + files = [] + refurl = url + try: + http_headers = HTTP_HEADERS + #http_headers['Referer'] = url + #page_elems = HTML.ElementFromURL(url, headers=http_headers) + #url = page_elems.xpath("//iframe[contains(@src,'tune.pk')]/@src")[0] + refurl = url + http_headers['Referer'] = url + page_data = HTTP.Request(url, headers=http_headers).content + url = re.findall(r'\'(.*api_key.*)\'', page_data)[0] + http_headers['Referer'] = url + page_data = HTTP.Request(url, headers=http_headers).content + jsondata = JSON.ObjectFromString(page_data) + #Log(jsondata) + sources = jsondata['data']['details']['player']['sources'] + #Log(sources) + sources = json.dumps(sources) + sources = sources.replace('u\'','\'') + file_matches = re.findall(r'{.*?}', sources) + for file_m in file_matches: + file_m = file_m.replace('u\'','\'') + file_m = JSON.ObjectFromString(file_m) + file_x = {'file':file_m['file'], 'label':str(file_m['label']), 'type':file_m['type']} + files.append(file_x) + except: + pass + + if len(files) == 0: + raise Ex.MediaNotAvailable + + sortable_list = [] + for file in files: + furl = file['file'] + + if 'label' in file.keys(): + res = file['label'].replace('p','') + if res != '1080': + res = '0'+res + else: + res = '720' + sortable_list.append({'label':res, 'file':furl}) + + newlist = sorted(sortable_list, key=lambda k: k['label'], reverse=True) + media_obj = [] + + for file in newlist: + furl = file['file'] + res = int(file['label']) + + #Log("furl ---- %s" % furl) + + if '.flv' in furl: + mo = MediaObject( + container = Container.FLV, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl, refurl=refurl))] + ) + elif '.m3u8' in furl: + mo = MediaObject( + protocol = 'hls', + container = 'mpegts', + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl, refurl=refurl))] + ) + else: + mo = MediaObject( + container = Container.MP4, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl, refurl=refurl))] + ) + + media_obj.append(mo) + + return media_obj + +#################################################################################################### +@indirect +def PlayVideo(url, refurl): + + http_headers = HTTP_HEADERS + http_headers['Referer'] = refurl + + return IndirectResponse(VideoClipObject, key=url, http_headers=http_headers) diff --git a/Contents/Services/URL/TvLogy/ServiceCode.pys b/Contents/Services/URL/TvLogy/ServiceCode.pys index c2e5ed8..736baa2 100644 --- a/Contents/Services/URL/TvLogy/ServiceCode.pys +++ b/Contents/Services/URL/TvLogy/ServiceCode.pys @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + import string, re HTTP_HEADERS = { @@ -22,8 +25,7 @@ def MetadataObjectForURL(url): try: page_data = HTTP.Request(url).content - - img = re.findall(r'http.*jpg', page_data)[0] + img = match = re.findall(r'http.*jpg', page_data)[0] thumb = img except: thumb = url diff --git a/Contents/Services/URL/VidWatch/ServiceCode.pys b/Contents/Services/URL/VidWatch/ServiceCode.pys index c3cbb0d..e69c221 100644 --- a/Contents/Services/URL/VidWatch/ServiceCode.pys +++ b/Contents/Services/URL/VidWatch/ServiceCode.pys @@ -1,11 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + import string, re +# import Shared ServiceCode +import jsunpack as JSP + HTTP_HEADERS = { 'Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encoding: gzip, deflate', 'Accept-Language: en-US,en;q=0.5', 'Connection: keep-alive', - 'Referer: http://www.vidshare.us', + 'Referer: http://www.vidwatch3.me', 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0' } @@ -20,15 +26,25 @@ def NormalizeURL(url): #################################################################################################### def MetadataObjectForURL(url): + title = 'VidWatch Redirect Page' + summary = 'Summary info Page' + try: - page_data = HTML.ElementFromURL(url) - img = page_data.xpath("//img/@src")[0] - thumb = img + txt = HTTP.Request(url).content + JSP_codes = re.findall(r'eval\(.+\)', txt) + for JSP_code in JSP_codes: + if 'jwplayer' in JSP_code: + break + # Log(JSP_code) + txt = JSP.unpack(JSP_code) + txt = re.findall(r'{.*}\);var', txt)[0] + txt = re.findall(r'{.*}', txt)[0] + jsondata = JSON.ObjectFromString(txt) + thumb = jsondata['image'] + duration = jsondata['duration'] + summary = jsondata['abouttext'] except: thumb = url - - title = 'VidShare Redirect Page' - summary = 'Summary info Page' return VideoClipObject( title = title, @@ -41,43 +57,90 @@ def MetadataObjectForURL(url): def MediaObjectsForURL(url): #Log("url-----------" + url) + files = [] + try: + page_data = HTTP.Request(url).content + #Log(page_data) + JSP_codes = re.findall(r'eval\(.+\)', page_data) + for JSP_code in JSP_codes: + if 'jwplayer' in JSP_code: + break + #Log(JSP_code) + txt = JSP.unpack(JSP_code) + #Log(txt) + sources = re.findall(r'\[{.*}]', txt)[0] + #Log(sources) + files = JSON.ObjectFromString(sources) + #Log(files) + except: + pass + + if len(files) == 0: + raise Ex.MediaNotAvailable + + Log(files) + + sortable_list = [] + for file in files: + furl = file['file'] + + if 'label' in file.keys(): + res = file['label'].replace('p','') + if res != '1080': + res = '0'+res + else: + res = '720' + sortable_list.append({'label': res, 'file':furl}) + + newlist = sorted(sortable_list, key=lambda k: k['label'], reverse=True) + media_obj = [] - return [ - MediaObject( - container = Container.FLV, - video_codec = VideoCodec.H264, - audio_codec = AudioCodec.AAC, - audio_channels = 2, - video_resolution = '720', - optimized_for_streaming = True, - parts = [PartObject(key=Callback(PlayVideo, url=url, quality='hd'))] - ), - MediaObject( - container = Container.FLV, - video_codec = VideoCodec.H264, - audio_codec = AudioCodec.AAC, - audio_channels = 2, - video_resolution = 'sd', - optimized_for_streaming = True, - parts = [PartObject(key=Callback(PlayVideo, url=url, quality='sd'))] - ) - ] + for file in newlist: + furl = file['file'] + res = int(file['label']) + + #Log("furl ---- %s" % furl) + + if '.flv' in furl: + mo = MediaObject( + container = Container.FLV, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + elif '.m3u8' in furl: + mo = MediaObject( + protocol = 'hls', + container = 'mpegts', + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + else: + mo = MediaObject( + container = Container.MP4, + video_codec = VideoCodec.H264, + audio_codec = AudioCodec.AAC, + video_resolution = res, + audio_channels = 2, + optimized_for_streaming = True, + parts = [PartObject(key=Callback(PlayVideo, url=furl))] + ) + + media_obj.append(mo) + + return media_obj #################################################################################################### @indirect -def PlayVideo(url, quality): +def PlayVideo(url): - try: - page_data = HTML.ElementFromURL(url) - stuff = page_data.xpath(".//script[contains(text(),'vplayer')]//text()")[0] - if quality == 'HD': - match = re.search(',{file:"(.+?)\",label:"HD', stuff) - else: - match = re.search('file:"(.+?)\",label:"SD', stuff) - url0 = match.group(1) - - # http://103.43.94.69/l7z7btxjdqnhgn4vfj2bga6cqdroexc376gj3a6mmo4emsbchtortpisujva/v.flv - except: - url0 = url - - return IndirectResponse(VideoClipObject, key=url0) + if '.m3u8' in url: + return IndirectResponse(VideoClipObject, key=HTTPLiveStreamURL(url)) + else: + return IndirectResponse(VideoClipObject, key=url)