Skip to content

Commit

Permalink
YouNow
Browse files Browse the repository at this point in the history
Add younow.com module
  • Loading branch information
Leonardo committed Nov 8, 2016
1 parent 3bd3579 commit 49251ce
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Extension/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -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 !"
Expand Down
12 changes: 11 additions & 1 deletion Extension/libs/jquery.gam.1.0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
],
objflag : "gamselected",
maxstorage : 1100,
minfilesize : "1.5 MB",
minfilesize : "0 byte",
filters : {

version : "1.0.0.9",
Expand Down Expand Up @@ -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 : {

Expand Down
2 changes: 1 addition & 1 deletion Extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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__",
Expand Down
123 changes: 123 additions & 0 deletions Extension/modules/younow.js
Original file line number Diff line number Diff line change
@@ -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=<username>
Ping .m3u8 https://cdn.younow.com/php/api/broadcast/videoPath/hls=1/broadcastId=<user broadcast id>
Risorse trovate qui https://ynassets.younow.com/angularjsapp/live/dist/app/younow-js.<key session>.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 );
2 changes: 2 additions & 0 deletions Extension/modules/younow.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Extension/modules/younow.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 49251ce

Please sign in to comment.