-1

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?

fabdurso
  • 2,366
  • 5
  • 29
  • 55

1 Answers1

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.

Puneet Arora
  • 199
  • 7
  • well yes, this is the idea. I was asking if someone could help achieving it – fabdurso Mar 15 '16 at 22:06
  • [Nice tutorial to parse html](https://www.raywenderlich.com/14172/how-to-parse-html-on-ios). I would start with this. Then to persist data I would [Read this](https://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started). Let me know if you need some other help. – Puneet Arora Mar 15 '16 at 22:18