Download youtube video in iOS Swift
Asked Answered
E

3

7

I am looking for solution to download video from youtube. i saw in youtube native application in ios they are providing a feature to save video for offline.

Is there any solution to download video in application? Or any API to download video.

Ellyellyn answered 13/7, 2016 at 9:35 Comment(1)
See this question: #8082176Caddric
P
4

You can download video file from Youtube if we know youtube URL of the video. First you need to download files (HCYoutubeParser) into your project. Now you need to call following function into your code:

let video =  HCYoutubeParser.h264videosWithYoutubeURL(yturl!)
let downloadURL = video["medium"] as! String

Where yturl is video URL. We need to pass it into h264videosWithYoutubeURL function. HCYoutubeParser is a class which provides methods for converting Youtube video watch URL into video download URL. This can be done by Youtube video id also. Following method is used for that:

let video =  HCYoutubeParser.h264videosWithYoutubeID(ytID!)
let downloadURL = video["medium"] as! String

Where ytID is id of Youtube video. In these code snippet we are getting download URL of medium quality video. For more info and HCYoutubeParser class follow this link: http://findnerd.com/list/view/How-to-download-videos-from-YouTube-in-iOS/22437/

Pesade answered 26/7, 2016 at 7:23 Comment(0)
M
3

If you are looking for a library then XCDYouTubeKit would be a good choice. If you are looking for an open source app then YouTag might be helpful.

Mumble answered 17/4, 2020 at 10:11 Comment(0)
D
0

As of May 2024, YouTubeKit is the only thing I could find that works: https://github.com/alexeichhorn/YouTubeKit.git

Massive props to the maintainers

Deflection answered 14/5 at 20:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.