All Projects → devandsev → Youtubedirectlinkextractor

devandsev / Youtubedirectlinkextractor

Licence: mit
Get the direct link to a YouTube video for AVPlayer

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Youtubedirectlinkextractor

Summerslider
🍭 SummerSlider that can distinguish the parts where the advertisement of the video player comes out
Stars: ✭ 61 (-19.74%)
Mutual labels:  avplayer
Hitomi Downloader
🍰 Desktop application to download images/videos/music/text from Hitomi.la and other sites, and more.
Stars: ✭ 1,154 (+1418.42%)
Mutual labels:  youtube
Queuetube
Make YouTube a little bit smoother
Stars: ✭ 72 (-5.26%)
Mutual labels:  youtube
Go Videos Ru
Каталог докладов, лекций и других видеоматериалов по Go
Stars: ✭ 64 (-15.79%)
Mutual labels:  youtube
Youtube ads 4 pi Hole
YouTube script to add the new Ads list for Pi-hole
Stars: ✭ 1,151 (+1414.47%)
Mutual labels:  youtube
Youtubeclone Frontend
Youtube Clone Frontend (React + Redux)
Stars: ✭ 1,161 (+1427.63%)
Mutual labels:  youtube
Avplayeroverlay
AVPlayer with custom controls, full screen mode, subtitles (.srt), Picture-In-Picture and AirPlay features.
Stars: ✭ 59 (-22.37%)
Mutual labels:  avplayer
Mmm Mirrormirroronthewall
MagicMirror² module: Displays text, images, or a Youtube video, and open or close Magic Mirror Modules according to commands heard by Alexa.
Stars: ✭ 75 (-1.32%)
Mutual labels:  youtube
Automator
Various Automator and AppleScript workflow and scripts for simplifying life
Stars: ✭ 68 (-10.53%)
Mutual labels:  youtube
Skraper
Kotlin/Java library and cli tool for scraping posts and media from various sources with neither authorization nor full page rendering (Facebook, Instagram, Twitter, Youtube, Tiktok, Telegram, Twitch, Reddit, 9GAG, Pinterest, Flickr, Tumblr, IFunny, VK, Pikabu)
Stars: ✭ 72 (-5.26%)
Mutual labels:  youtube
Spotivy
🎼 Download music videos from Spotify playlists
Stars: ✭ 64 (-15.79%)
Mutual labels:  youtube
Youtubeexplode.converter
Muxes and converts videos from YoutubeExplode
Stars: ✭ 68 (-10.53%)
Mutual labels:  youtube
Bash2mp4
Video Downloader for Termux .
Stars: ✭ 68 (-10.53%)
Mutual labels:  youtube
Musicbot
🎶 A Discord music bot that's easy to set up and run yourself!
Stars: ✭ 1,109 (+1359.21%)
Mutual labels:  youtube
Distube
A Discord.js v12 module to simplify your music commands and play songs with audio filters on Discord without any API key. Support YouTube, SoundCloud, Bandcamp, Facebook, and 700+ more sites
Stars: ✭ 73 (-3.95%)
Mutual labels:  youtube
Streamly
Portable, independent, web-based, simple streaming YouTube video queues and playlists for music videos, audiobooks, etc.
Stars: ✭ 60 (-21.05%)
Mutual labels:  youtube
Splashloginsignup
Source code for the Splash, Login and Signup Screen for Android | UI to Code - Timelapse YouTube Video
Stars: ✭ 69 (-9.21%)
Mutual labels:  youtube
Youtube Channel Name Converter
A Youtube Channel Name to ID Converter
Stars: ✭ 75 (-1.32%)
Mutual labels:  youtube
Network Avatar Picker
A npm module that returns user's social network avatar. Supported providers: facebook, instagram, twitter, tumblr, vimeo, github, youtube and gmail
Stars: ✭ 74 (-2.63%)
Mutual labels:  youtube
Musicdownloader
Material design YouTube mp3/mp4 downloader
Stars: ✭ 70 (-7.89%)
Mutual labels:  youtube

YoutubeDirectLinkExtractor

Build Status

YoutubeDirectLinkExtractor allows you to obtain the direct link to a YouTube video, which you can easily use with AVPlayer. It uses type safety and optionals to guarantee that you won't crash while extracting the link no matter what. There are popular alternatives, which use more straightforward and risky approach, though: YoutubeSourceParserKit, HCYoutubeParser.

Installation

CocoaPods

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'YoutubeDirectLinkExtractor'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

Carthage

Add this to Cartfile

github "devandsev/YoutubeDirectLinkExtractor"

In the Cartfile directory, type:

$ carthage update

Usage examples

Any force unwrapping used here is just for keeping examples short, don't use it in real projects.

Basic usage:

let y = YoutubeDirectLinkExtractor()
y.extractInfo(for: .urlString("https://www.youtube.com/watch?v=HsQvAnCGxzY"), success: { info in
    print(info.highestQualityPlayableLink)
}) { error in
    print(error)
}

Extract lowest quality video link from id:

let y = YoutubeDirectLinkExtractor()
y.extractInfo(for: .id("HsQvAnCGxzY"), success: { info in
    print(info.lowestQualityPlayableLink)
}) { error in
    print(error)
}

Use extracted video link with AVPlayer:

let y = YoutubeDirectLinkExtractor()
y.extractInfo(for: .urlString("https://www.youtube.com/watch?v=HsQvAnCGxzY"), success: { info in
    let player = AVPlayer(url: URL(string: info.highestQualityPlayableLink!)!)
    let playerViewController = AVPlayerViewController()
    playerViewController.player = player

    self.present(playerViewController, animated: true) {
        playerViewController.player!.play()
    }
}) { error in
    print(error)
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].