Download all available (and new) files

拥有回忆 提交于 2019-12-23 06:25:07

问题


I'm using NSURLSessionDownloadTask to download some .mov files from a web and storing them in my app.

Now what I'd like to achieve is to

  • 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.

Is there any way to achieve this?


回答1:


  1. 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.

  2. 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.



来源:https://stackoverflow.com/questions/36018080/download-all-available-and-new-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!