下载所有可用(和新)文件 [英] Download all available (and new) files
问题描述
我正在使用 NSURLSessionDownloadTask
从网络下载一些 .mov 文件,并将其存储在我的应用程序中。
I'm using NSURLSessionDownloadTask
to download some .mov files from a web and storing them in my app.
现在我想要实现的是
-
下载 ALL 某些类型的文件(在这种情况下为.mov),而不必指定每个文件URL
download ALL files of certain type (in this case .mov) available on the page, without having to specify every file URL
仅下载文件
download files ONLY if they are not already stored in my app.
有没有办法实现? / p>
Is there any way to achieve this?
推荐答案
-
你必须抓住该HTML页面才能获取所有的URL(.mov )你正在寻找你可以使用
NSXMLParser
,如果你想自己写,或者你可以google一些图书馆。
You would have to scrape that html page to get all the urls (.mov) you are looking for. Either you can use
NSXMLParser
if you want to write your own or you can google some library.
当您下载文件时,请在SQLite或CoreData中保留一些元数据(例如名称或某些唯一标识符),以便您可以检查文件是否已经下载。
When you download a file, persist some metadata (eg. name or some unique identifier) either in SQLite or CoreData, so that you can check if the file has already been downloaded.
这篇关于下载所有可用(和新)文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!