Open GoogleCodeExporter opened 8 years ago
could u also give the download link for the new youtube.js ??? plz..
Original comment by mehsan1...@gmail.com
on 3 Jan 2013 at 3:14
thnx in advance !!! :P
Original comment by mehsan1...@gmail.com
on 3 Jan 2013 at 3:15
var YouTube = new Object();
YouTube.rev = 1;
YouTube.SearchDesc = "YouTube by Darby_Crash";
YouTube.Name = "YouTube";
YouTube.Search = function (keyword, page){
var result = new Object();
result.bypage = 20;
result.start = (page-1)*result.bypage+1;
var sortBy = "relevance";
var catSpecified = false;
if (keyword.charAt(0) == '$')
{
var keywordBu = keyword;
var kpos = keyword.indexOf(" ");
var category = keyword.substring(1, kpos);
keyword = keyword.substring(kpos+1);
catSpecified = true;
}
if (keyword.charAt(0) == '@')
{
sortBy = "published";
}
if (catSpecified == false)
{
c=GetContents('http://gdata.youtube.com/feeds/api/videos?q='+escape(keyword)+'&start-index='+result.start+'&max-results='+result.bypage+'&orderby='+sortBy+'&racy=include&v=1');
}
else
{
c=GetContents('http://gdata.youtube.com/feeds/api/videos?q='+escape(keyword)+'&start-index='+result.start+'&max-results='+result.bypage+'&orderby='+sortBy+'&racy=include&category='+category+'&v=1');
}
result.total = ext("<openSearch:totalResults>");
result.VideoInfo = new Array();
v = {attr:2};
v.id = 0;
v.Title = "YouTube Search Help";
v.Description = "@query = search by upload date\n$category query = search in a category";
v.URL = '';
result.VideoInfo.push(v);
while(p=c.indexOf("<entry",p)+1){
v = {attr:2};//neither IDA|npp find this string ...0=RD 1= 2=SRD 3=S
v.id = ext("<id>http://gdata.youtube.com/feeds/api/videos/","</id>");
v.Title = ext("<title type='text'>");
v.Description = ext("content type='text'>")+'\nUploader:'+ext("<name>");
v.CommentCount = ext("countHint='")*1;
v.Tags = ext("keywords>").replace(/,/g,"");
v.LengthSeconds = ext("ds='")*1;
v.RatingAvg = ext("average='")*1;
v.RatingCount = ext("numRaters='")*1;
v.MylistCount = ext("favoriteCount='")*1;
v.ViewCount = ext("viewCount='")*1;
v.ThumbnailURL = 'http://i.ytimg.com/vi/'+v.id+'/default.jpg';
v.SaveFilename = v.id+".flv";
v.URL = 'YouTube.play("'+v.id+'")';
result.VideoInfo.push(v);
}
result.end = result.start-1+result.VideoInfo.length;
return result;
}
YouTube.play = function (id){
c=GetContents("http://www.youtube.com/watch?v="+id).ext('url_encoded_fmt_stream'
,'\u0026');p=0;
c=unescape(c);
ind=ext('_map=','=')+"=";
var regex = new RegExp(''+ind+'','g');
c=c.replace(/_map=/,"").replace(regex,"\n");
c=c.match(/(.+?)itag%3D5(.+)/);c=ind+c[0]+"&";c=c.replace(/,/g,"&");
url=c.match(/url=(.+?)\&/)[0].replace(/url=/,"").replace(/&/,"");url=unescape(ur
l);
sig=c.match(/sig=(.+?)\&/)[0].replace(/sig=/,"").replace(/&/,"");
host=c.match(/fallback_host=(.+?)\&/)[0].replace(/fallback_host=/,"").replace(/&
/,"");
url=url.match(/\/videoplayback?(.+)/)[0];
var link = "http://"+host+url+"&signature="+sig;
return link;
}
SiteList.push(YouTube);
1) open notepad
2) paste the script
3) save as youtube.js
Original comment by th3zone...@gmail.com
on 3 Jan 2013 at 10:45
Original issue reported on code.google.com by
mehsan1...@gmail.com
on 3 Jan 2013 at 3:07