问题
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:
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.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