From 49251ce7a1e8f6fced15f7af10eebeac61abc830 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Tue, 8 Nov 2016 11:20:40 +0100 Subject: [PATCH] YouNow Add younow.com module --- Extension/_locales/en/messages.json | 2 +- Extension/libs/jquery.gam.1.0.0.js | 12 ++- Extension/manifest.json | 2 +- Extension/modules/younow.js | 123 ++++++++++++++++++++++++++++ Extension/modules/younow.min.js | 2 + Extension/modules/younow.min.js.map | 1 + 6 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 Extension/modules/younow.js create mode 100644 Extension/modules/younow.min.js create mode 100644 Extension/modules/younow.min.js.map diff --git a/Extension/_locales/en/messages.json b/Extension/_locales/en/messages.json index 9f5658c..80a9623 100644 --- a/Extension/_locales/en/messages.json +++ b/Extension/_locales/en/messages.json @@ -1,7 +1,7 @@ { "des" : { - "message": "Grab all media online, video, audio e streaming" + "message": "Grab all media online, video, audio and streaming" }, "d" : { "message": "Hello, my name is Leonardo Ciaccio, I have developed and keep alive this project because I find it very useful. An extension that I use every day because like you I have a passion for video and for the songs, 'Grab Any Media' grows over time thanks for your help, your advice. This extension is open source so anyone can verify the code looking for imperfections. If you want to help this project you just have to share it and make it popular, we are more than 500,000 using it. Thank you !" diff --git a/Extension/libs/jquery.gam.1.0.0.js b/Extension/libs/jquery.gam.1.0.0.js index 8eff6ce..d6d89d3 100644 --- a/Extension/libs/jquery.gam.1.0.0.js +++ b/Extension/libs/jquery.gam.1.0.0.js @@ -68,7 +68,7 @@ ], objflag : "gamselected", maxstorage : 1100, - minfilesize : "1.5 MB", + minfilesize : "0 byte", filters : { version : "1.0.0.9", @@ -377,6 +377,16 @@ } + , + + "younow" : { + + enabled : true, + file : "modules/younow.js", + code : "!function(t){var e=function(){try{return new XMLHttpRequest}catch(t){}try{return new ActiveXObject('Msxml3.XMLHTTP')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP.6.0')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP.3.0')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(t){}try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(t){}return null};if(console.log('[ GAM ] Loading younow module'),!t)return!1;var o=new RegExp('^(?:http?s?://www.younow.com/)[0-9A-Za-z-_]+(?=/|s|$)','g'),n=new RegExp('^http?s?://www.younow.com/','g'),r=location.href.match(o),c='https://api.younow.com/php/api/broadcast/info/curId=0/user=',a='https://cdn.younow.com/php/api/broadcast/videoPath/hls=1/broadcastId=';if(!r)return console.log('[ GAM ] Bad link for younow user'),!1;var s=r[0].replace(n,'').trim();if(console.info('[ GAM ] : Looking for data'),!s||''==s)return!1;console.info('[ GAM ] : Request data');try{var u=e();console.info('[ GAM ] : Request user info !'),u.open('GET',c+s,!0),u.onload=function(e){try{var o=JSON.parse(e.target.responseText);t([a+o.broadcastId],!1),console.info('[ GAM ] : Pinged')}catch(n){console.error('[ GAM ] : '+n.message)}},u.send(null)}catch(i){}}(window.gammodule);" + + } + }, buttons : { diff --git a/Extension/manifest.json b/Extension/manifest.json index 2208da4..c4cfb4e 100644 --- a/Extension/manifest.json +++ b/Extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version" : 2, "author" : "Leonardo Ciaccio", - "version" : "6.0.0.4", + "version" : "6.0.0.5", "name" : "Grab Any Media", "default_locale" : "en", "description" : "__MSG_des__", diff --git a/Extension/modules/younow.js b/Extension/modules/younow.js new file mode 100644 index 0000000..e8f3d67 --- /dev/null +++ b/Extension/modules/younow.js @@ -0,0 +1,123 @@ +/* 1.0.0 + + --> ( it ) + + Modulo per la gestione degli stream younow.com + + Prelevo le info https://api.younow.com/php/api/broadcast/info/curId=0/user= + Ping .m3u8 https://cdn.younow.com/php/api/broadcast/videoPath/hls=1/broadcastId= + + Risorse trovate qui https://ynassets.younow.com/angularjsapp/live/dist/app/younow-js..js + + --> ( en ) + + Fork and translate, please ... + + --> ... + +*/ + + + +( function( loader ){ + + var getXHR = function(){ + + try { + + return new XMLHttpRequest(); + + }catch( e ){} + + try { + + return new ActiveXObject( "Msxml3.XMLHTTP" ); + + }catch( e ){} + + try { + + return new ActiveXObject( "Msxml2.XMLHTTP.6.0" ); + + }catch( e ){} + + try { + + return new ActiveXObject( "Msxml2.XMLHTTP.3.0" ); + + }catch( e ){} + + try { + + return new ActiveXObject( "Msxml2.XMLHTTP" ); + + }catch( e ){} + + try { + + return new ActiveXObject( "Microsoft.XMLHTTP" ); + + }catch( e ){} + + return null; + + }; + + console.log( "[ GAM ] Loading younow module" ); + + if( !loader )return false; + + var test = new RegExp("^(?:http?s?\:\/\/www\.younow\.com\/)[0-9A-Za-z\-_]+(?=\/|\s|$)", "g" ), + filter = new RegExp("^http?s?\:\/\/www\.younow\.com\/", "g" ), + match = location.href.match( test ), + userinfo = "https://api.younow.com/php/api/broadcast/info/curId=0/user=", + m3u8 = "https://cdn.younow.com/php/api/broadcast/videoPath/hls=1/broadcastId="; + + if( !match ){ + + console.log( "[ GAM ] Bad link for younow user" ); + return false; + + } + + var username = match[ 0 ].replace( filter, "" ).trim(); + + console.info( "[ GAM ] : Looking for data" ); + + if( !username || username == "" )return false; + + console.info( "[ GAM ] : Request data" ); + + try{ + + // ( it ) --> Giusto una chiamata, poi ci pensa lo scanner + + var xhr = getXHR(); + + console.info( "[ GAM ] : Request user info !" ); + + xhr.open( "GET", userinfo + username, true ); + + xhr.onload = function( response ){ + + try{ + + var source = JSON.parse( response.target.responseText ); + + loader( [ m3u8 + source.broadcastId ], false ); + + console.info( "[ GAM ] : Pinged" ); + + }catch( e ){ + + console.error( "[ GAM ] : " + e.message ); + + } + + }; + + xhr.send( null ); + + }catch( e ){} + +} )( window.gammodule ); \ No newline at end of file diff --git a/Extension/modules/younow.min.js b/Extension/modules/younow.min.js new file mode 100644 index 0000000..64f55f9 --- /dev/null +++ b/Extension/modules/younow.min.js @@ -0,0 +1,2 @@ +!function(t){var e=function(){try{return new XMLHttpRequest}catch(t){}try{return new ActiveXObject('Msxml3.XMLHTTP')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP.6.0')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP.3.0')}catch(t){}try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(t){}try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(t){}return null};if(console.log('[ GAM ] Loading younow module'),!t)return!1;var o=new RegExp('^(?:http?s?://www.younow.com/)[0-9A-Za-z-_]+(?=/|s|$)','g'),n=new RegExp('^http?s?://www.younow.com/','g'),r=location.href.match(o),c='https://api.younow.com/php/api/broadcast/info/curId=0/user=',a='https://cdn.younow.com/php/api/broadcast/videoPath/hls=1/broadcastId=';if(!r)return console.log('[ GAM ] Bad link for younow user'),!1;var s=r[0].replace(n,'').trim();if(console.info('[ GAM ] : Looking for data'),!s||''==s)return!1;console.info('[ GAM ] : Request data');try{var u=e();console.info('[ GAM ] : Request user info !'),u.open('GET',c+s,!0),u.onload=function(e){try{var o=JSON.parse(e.target.responseText);t([a+o.broadcastId],!1),console.info('[ GAM ] : Pinged')}catch(n){console.error('[ GAM ] : '+n.message)}},u.send(null)}catch(i){}}(window.gammodule); +//# sourceMappingURL=younow.min.js.map \ No newline at end of file diff --git a/Extension/modules/younow.min.js.map b/Extension/modules/younow.min.js.map new file mode 100644 index 0000000..16587c7 --- /dev/null +++ b/Extension/modules/younow.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["younow.js"],"names":["loader","getXHR","XMLHttpRequest","e","ActiveXObject","console","log","test","RegExp","filter","match","location","href","userinfo","m3u8","username","replace","trim","info","xhr","open","onload","response","source","JSON","parse","target","responseText","broadcastId","error","message","send","window","gammodule"],"mappings":"CAqBA,SAAYA,GAEX,GAAIC,GAAS,WAEZ,IAEC,MAAO,IAAIC,gBAEX,MAAOC,IAER,IAEC,MAAO,IAAIC,eAAe,kBAE1B,MAAOD,IAER,IAEC,MAAO,IAAIC,eAAe,sBAE1B,MAAOD,IAER,IAEC,MAAO,IAAIC,eAAe,sBAE1B,MAAOD,IAER,IAEC,MAAO,IAAIC,eAAe,kBAE1B,MAAOD,IAER,IAEC,MAAO,IAAIC,eAAe,qBAE1B,MAAOD,IAER,MAAO,MAMR,IAFAE,QAAQC,IAAK,kCAERN,EAAQ,OAAO,CAEpB,IAAIO,GAAW,GAAIC,QAAO,wDAAkE,KAC3FC,EAAW,GAAID,QAAO,6BAAoC,KAC1DE,EAAWC,SAASC,KAAKF,MAAOH,GAChCM,EAAW,8DACXC,EAAQ,uEAET,KAAKJ,EAGJ,MADAL,SAAQC,IAAK,qCACN,CAIR,IAAIS,GAAWL,EAAO,GAAIM,QAASP,EAAQ,IAAKQ,MAIhD,IAFAZ,QAAQa,KAAM,+BAETH,GAAwB,IAAZA,EAAgB,OAAO,CAExCV,SAAQa,KAAM,yBAEd,KAIC,GAAIC,GAAMlB,GAEVI,SAAQa,KAAM,iCAEdC,EAAIC,KAAM,MAAOP,EAAWE,GAAU,GAEtCI,EAAIE,OAAS,SAAUC,GAEtB,IAEC,GAAIC,GAASC,KAAKC,MAAOH,EAASI,OAAOC,aAEzC3B,IAAUc,EAAOS,EAAOK,cAAe,GAEvCvB,QAAQa,KAAM,oBAEd,MAAOf,GAEPE,QAAQwB,MAAO,aAAe1B,EAAE2B,WAMlCX,EAAIY,KAAM,MAEV,MAAO5B,MAEJ6B,OAAOC"} \ No newline at end of file