V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
caizixian
V2EX  ›  分享发现

Linux 下代替硕鼠客户端的代码(依然依赖硕鼠网站),轻喷

  •  1
     
  •   caizixian · 2014-05-05 20:48:35 +08:00 · 3128 次点击
    这是一个创建于 3957 天前的主题,其中的信息可能已经有所发展或是发生改变。
    这里大神很多,轻喷,如果有好方案,分享一下吧。
    只要在硕鼠网站上解析好m3u列表即可,axel多线程下载加合并
    为了解决问题临时写的,quick and dirty
    #include <iostream>
    #include <cstdio>
    #include <cstdlib>
    #include <fstream>
    #include <string>
    #include <sstream>
    using namespace std;
    ifstream fin;
    ofstream fout;
    stringstream ss;
    int main()
    {
    string m3u_filename,lst_filename,downloadurl;
    string command="chmod +x ",mergecommand="mencoder -oac pcm -ovc copy -idx -o output.flv ",tempstr;
    int counter=0,i;
    cout<<"Enter filename of m3u"<<endl;
    cin>>m3u_filename;
    cout<<"Enter filename of download script"<<endl;
    cin>>lst_filename;
    fin.open(m3u_filename.c_str());
    fout.open(lst_filename.c_str());
    fin>>downloadurl;
    while(fin>>downloadurl)
    {
    counter++;
    fout<<"axel --output "<<counter<<".flv \""<<downloadurl<<"\""<<endl;
    }
    command.append(lst_filename);
    for (i=1;i<=counter;i++)
    {
    ss.str("");
    ss.clear();
    tempstr="";
    ss<<i;
    ss>>tempstr;
    mergecommand.append(tempstr);
    mergecommand.append(".flv ");
    }
    fout<<mergecommand;
    system(command.c_str());
    fin.close();
    fout.close();
    return 0;
    }
    view raw m3u2script.cpp hosted with ❤ by GitHub
    1 条回复    2014-05-05 20:54:58 +08:00
    Ever
        1
    Ever  
       2014-05-05 20:54:58 +08:00   ❤️ 2
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5249 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:21 · PVG 15:21 · LAX 23:21 · JFK 02:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.