【问题标题】:downloading videos from different video sites in iPhone从 iPhone 中的不同视频网站下载视频
【发布时间】:2012-08-02 05:14:23
【问题描述】:

在我的应用程序中,用户可以从不同的视频网站下载和播放视频,如 bofunk.com、dailymotion.com、youtube.com、metacafe.com、stupid videos.com 等。从不同网站下载视频的想法是什么.我实现了一个方法并且正在为某些站点工作。即通过从 html 字符串生成可下载的 url。但是同样的方法不适用于其他站点。任何人都可以指导我吗?提前谢谢。这就是我已经尝试并正在为 bofunk.com 工作

`-(BOOL)searchForVideoInBOFUNKHTML:(NSString*)htmlString;
{
    NSString *strHTML=[NSString stringWithFormat:@"%@",htmlString];       
    NSString *newString; 

    if ([htmlString rangeOfString:@"id=\"vidplaya\""].location == NSNotFound) 
    {
        return  false;
    }   
    else
    {
        htmlString = [strHTML substringFromIndex:[htmlString rangeOfString:@"id=\"vidplaya\""].location];

        htmlString=  [htmlString stringByReplacingOccurrencesOfString:[htmlString substringFromIndex:100]
                                                        withString:@""];



            newString =[htmlString stringByReplacingOccurrencesOfString:[htmlString substringFromIndex:[htmlString rangeOfString:@"quality"].location] withString:@""];
        NSLog(@"%@",newString);

            newString = [[[newString substringFromIndex:[newString rangeOfString:@"/"].location] substringFromIndex:3] stringByReplacingOccurrencesOfString:@"\"" withString:@""];
         NSLog(@"%@",newString);

            newString = [newString stringByReplacingOccurrencesOfString:@" " withString:@""];
         NSLog(@"%@",newString);


            embededURL = [[NSString alloc] initWithFormat:@"http://media.bofunk.com/media/flvs/%@.flv",newString]; 

        NSLog(@"%@",embededURL);
            return true;

    }
    return  false;

}

`但不适用于dailymotion.com 之类的网站。这是与这些网站上的任何类型的加密有关的问题吗?

【问题讨论】:

  • 您是否确认您的程序创建的 URL 确实正确?例如获取为 dailymotion 生成的 URL,将其粘贴到浏览器中并查看结果
  • @patrix 是的,我检查了。为 bofunk.com 生成的 url 被粘贴在浏览器上并直接下载视频。但是当尝试使用为 dailymotion.com 生成的 url 时,它只是在播放视频在浏览器上。可能是什么原因?
  • 这是错误的 URL :-) 或者 dailymotion.com 不允许下载。或者,您需要查看 dailymotion.com 页面的 HTML 代码,以确定视频的直接 URL。也许他们甚至提供了一个 API 来直接访问视频。

标签: iphone objective-c xcode video download


【解决方案1】:

Dailymotion 提供API for iOS。所以你可以使用它。但不要指望它可以与其他服务一起使用。您将不得不一一实现它们。其中一些可能无法与外部软件一起使用。

【讨论】:

  • 你熟悉任何可以用来从所有视频网站下载视频的常用方法吗?
  • @iOSDeveloper,你找到解决方案了吗?我现在也在做同样的事情。
【解决方案2】:

这里是关于如何从 YouTube 下载 MP4 数据的讨论。

有示例项目和好方法可供下载。这可能会对您有所帮助。

Save Youtube video to iPhone in the app

【讨论】:

    猜你喜欢
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-28
    • 2017-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多