Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcas796/youtubekit
A Swift package that extracts and downloads YouTube videos.
https://github.com/dcas796/youtubekit
swift swift-5-8 swift-package-manager youtube youtube-downloader
Last synced: 8 days ago
JSON representation
A Swift package that extracts and downloads YouTube videos.
- Host: GitHub
- URL: https://github.com/dcas796/youtubekit
- Owner: dcas796
- Created: 2023-05-13T15:35:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-31T16:00:30.000Z (8 months ago)
- Last Synced: 2024-04-01T16:48:34.474Z (8 months ago)
- Topics: swift, swift-5-8, swift-package-manager, youtube, youtube-downloader
- Language: Swift
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YouTubeKit
A Swift package that extracts and downloads YouTube videos.
Note: this is just a fun side-project, don't use this for production :)
| Test | Passing |
|--------------------|----------|
| testYTVideo | ❌ |
| testDownload | ❌ |
| testYTMimeType | ✅ |
| testEnumEncoding | ✅ |
| testNDescrambling | ✅ |
| testThumbnails | ❌ |
| testHTTPDownloader | ❌ |Note: This project hasn't been updated in a long time, so don't expect it to work.
I will continue committing to this project whenever I find spare time.## Example
```swift
let videoURL = URL(string: "https://www.youtube.com/watch?v=dQw4w9WgXcQ")!
let destURL = URL(filePath: "video.mp4")var downloader = YTDownloader()
let video = try await downloader.video(for: videoURL)
let format = downloader.bestFormat(for: video, quality: .hd1080)!try await downloader.download(video: video, format: format, outputURL: destURL, updateHandler: { _, progress in
let percentage = String(format: "%.3f", progress.fractionCompleted * 100)
print("Downloaded \(progress.completedUnitCount) bytes of \(progress.totalUnitCount) bytes (\(percentage)%)")
})print("Video downloaded to \(destURL.path())")
```## Features
- Extract info from YouTube videos
- Download YouTube videos at any resolution and format (mp4, webm)
- Integrated HTTP multi-threaded chunked downloader for faster download speeds
- Unthrottle YouTube download speeds (using n param descrambling)
- Pure Swift interface for handling video info
- More coming soon...## Install with SPM
To include this package, add this line to your ```Package.swift```:```swift
.package(url: "https://github.com/dcas796/YouTubeKit.git", exact: "0.0.3")
```---
Made by [dcas796](https://dcas796.github.com/)