--- trunk/resources/services/youtube/youtube.js 2010/09/02 11:52:07 911 +++ trunk/resources/services/youtube/youtube.js 2012/05/08 17:34:53 975 @@ -3,7 +3,7 @@ * This file is part of xVideoServiceThief, * an open-source cross-platform Video service download * -* Copyright (C) 2007 - 2010 Xesc & Technology +* Copyright (C) 2007 - 2012 Xesc & Technology * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,9 +25,9 @@ function RegistVideoService() { - this.version = "2.1.5"; + this.version = "3.0.6"; this.minVersion = "2.0.0a"; - this.author = "Xesc & Technology 2009"; + this.author = "Xesc & Technology 2012"; this.website = "http://www.youtube.com/"; this.ID = "youtube.com"; this.caption = "YouTube"; @@ -38,7 +38,6 @@ function getVideoInformation(url) { const URL_YOUTBE = "http://www.youtube.com/watch?v=%1"; - const HD_VIDEO_RES = "22"; // init result var result = new VideoDefinition(); // default URL @@ -52,35 +51,112 @@ embededID = strRemove(embededID, 0, embededID.lastIndexOf("/v/") + 3); youTubeURL = strFormat(URL_YOUTBE, embededID); } + // cehck if is an embeded video (v2) + else if (youTubeURL.toString().indexOf("/embed/") != -1) + { + var embededID = copyBetween(youTubeURL + "?", "/embed/", "?"); + youTubeURL = strFormat(URL_YOUTBE, embededID); + } // download webpage var http = new Http(); var html = http.downloadWebpage(youTubeURL); + // get cookies + result.cookies = http.getCookies("|"); // get the video title result.title = copyBetween(html, "
'; + const HTML_SEARCH_SUMMARY_END = '
'; // replace all spaces for "+" keyWord = strReplace(keyWord, " ", "+"); // init search results object @@ -110,7 +188,7 @@ var http = new Http(); var html = http.downloadWebpage(strFormat(URL_SEARCH, keyWord, pageIndex, searchResults.getUserLanguage())); // get the search summary - var summary = copyBetween(html, '', '')); // get rating