穿越吧,Youtube视频快快下载

 

     昨天看到GFW只是封锁掉youtube这个字眼,而通过208.117.240.37依然可以访问,但是无法观看,网上有提供多种方式来下载视频,比如通过keepHD输入相应的youtube视频地址可获得不同质量的flv视频。今天我又想起了一款开源跨平台视频下载软件,曾有多次介绍这个网络在线视频下载软件xVideoServiceThief,通过查看源代码知道其对网址以及关键词进行检测来识别是否为网络视频,那就修改源代码让其将
http://208.117.240.37/watch?v=lXpdFn3mz24识别为“真正”Youtube视频。


先将编译通过的可执行文件奉上,xvst下载地址,文件大小为1.26M,仅支持Linux下运行。
接下来就说说如何实现全过程并且穿越来观看Youtube视频:
首先自然需要下载xVideoServiceThief的源代码
然后到src文件下找到videoinformation.cpp文件,大概在360行左右有对Youtube视频的定义,我只需要做如下修改即可:

 // Plugin for YouTube Videos  VideoInformation_Youtube::VideoInformation_Youtube(VideoInformation *videoInformation) {  setID("208.117.240.37");  setCaption("Youtube");  adultContent = false;  registPlugin(videoInformation); }  VideoDefinition VideoInformation_Youtube::getVideoInformation(const QString URL) {  const QString URL_YOUTBE  = "http://208.117.240.37/watch?v=%1";  const QString URL_GET_FLV = "http://%1/get_video?video_id=%2&t=%3";   // init result  VideoDefinition result;  VideoItem::initVideoDefinition(result);  // default URL  QString youTubeURL = URL;  // check if is an embeded video, and get the "real url" of youtube  if (URL.indexOf("208.117.240.37/v/") != -1)  {   QString embededID = URL;   embededID = embededID.remove(0, embededID.lastIndexOf("/v/") + 3);   if (embededID.indexOf("&") != -1) embededID = copy(embededID, 0, embededID.indexOf("&"));   youTubeURL = QString(URL_YOUTBE).arg(embededID);  }  // download webpage  Http http;  QString html = http.downloadWebpage(QUrl(youTubeURL));  // get the video ID and the video HASH  QString vidID = QUrl(youTubeURL).queryItemValue("v");  QString vidHash = copyBetween(html, "\"t\": \"", "\"");  // get the video title  result.title = copyBetween(html, "").trimmed();  // build the video url  result.URL = URL_GET_FLV.arg(QUrl(youTubeURL).host()).arg(vidID).arg(vidHash);  // check if this video need a login  result.needLogin = result.title == "Broadcast Yourself.";  // return the video information  return result; } 

接下来所要做的事情自然是进行编译啦,在源代码文件中how to compile.txt有说明如何进行编译

 A compiler directrive (STATIC_BUILD) must be defined if you want to get a "valid" xVST compilation. - Static mode:   If you want compile the xVST in STATIC version, you should do:    > qmake -set build_mode static_build    > qmake    > make - Dynamic mode:   If you want compile the xVST in DYNAMIC version, you should do:    > qmake -set build_mode dynamic_build    > qmake    > make  
按照提示进行编译,偶在Ubuntu中进行编译会提示缺少必要软件包,安装如下两个软件包

sudo apt-get install libqt4-dev
sudo apt-get install qt4-qmake
之后即可编译通过,如果出现错误,自行排查,应该是某某源代码少了string.h头文件,编译通过之后xvst就会出现在源代码目录的bin文件夹中,直接双击xvst运行即可,应该会提示缺少xUpdater,这个是用来进行多国语言升级支持(大概就是这么回事吧),所以无关紧要,忽略。当然xVideoServiceThief有提供视频下载完成之后转换为avi,mp4等等格式,这个就需要ffmpeg软件包的支持,sudo apt-get install ffmpeg安装即可。


再接下来要做的事情就是来验证一下是否能够正常运行,打开xVideoServiceThief

 然后点击Add Video,回到顶部图片,
输入http://208.117.240.37/watch?v=lXpdFn3mz24&feature=channel中右侧的网址

如顶部图片所示,这时自然会将208.117.240.37所对应的视频识别为Youtube视频,然后所要做的事情就是稍等片刻,最后欣赏其已经将flv转换为avi格式的视频,当然你也可以进行设置转换为其他格式,前提条件需要安装ffmpeg软件包。

 可以转换为avi,mpg,3gp,wmv,mp3等多种格式。


     大功告成,还差点什么没说,哦,特此声明,本人对C++一窍不通,曾多次面试因为编程基础薄弱而自告奋勇走出笔试考场-_-!,对于Qt编程更是一点都不懂,纯粹是一种折腾的精神来进行软件编程学习,此软件仅供娱乐使用,勿要作为其他不正当用途(反正开源,你想怎么着就怎么着吧,后果自负)。同时不得不指出此软件同样支持土豆网视频下载

完整软件包附带升级功能压缩包下载地址,

虽然这样编译通过了,但是问题就来了,如果Youtube解封,自然是用Youtube的链接地址比较方便啦,那么程序又该如何修改使其既支持IP地址又支持youtube.com域名呢?诸位程序员们来解决一下这个问题。

没有评论: