0bmxa / YoutubeDL

A macOS / iOS wrapper around youtube-dl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YoutubeDL

This is a Swift wrapper around the amazing youtube-dl Python library.

It consists of a (more or less) platform-indepentent wrapper around the library, as well as a macOS and (// TODO) iOS app target.

How to use

You have to build it yourself (using Xcode), but everything should be rather straight forward.

Supported sites

In theory everything site that is supported by youtube-dl (See here). In practice, I've only tested with very few sites so far, so feel free to report issues.

Executing Python

As the core smartness of this project (the youtube-dl library) is written in Python, I needed to somehow be able to execute Python inside this project.

Framework

The easiest way to do so is probably to simply use Apple's Python.framework, which comes as part of macOS. Sadly, this is 1) only Python 2.7, and 2) only available on macOS, not iOS. To overcome this, I started building the official CPython implementation as a framework myself. For this, see my PythonFrameworkBuilder project.

Wrapper

CPython exposes all Python features via its C API, which comes with the typical effects of using a C API. To make the usage of this a bit more safe (in terms of memory leaks and such) and convenient, I added a (very basic, but generic) Swift wrapper around the C API. For details see the source code in Shared/Python, and its usage in Shared/YoutubeDL/YoutubeDL.swift

If youre interested in this, I'm happy to answer any questions, make it more generically usable, or simply write (better) documentation.

Credits

This started off as a fork of pieter/YoutubeDL-iOS (see my fork here), but as I realized I started rewriting everything, I set this up as a new project. No code of the original project is used anymore, but I definitely have to mention this here as the source of motivation.

About

A macOS / iOS wrapper around youtube-dl


Languages

Language:Python 96.3%Language:C 1.5%Language:C++ 0.8%Language:HTML 0.6%Language:Makefile 0.3%Language:Roff 0.1%Language:Swift 0.1%Language:PLSQL 0.1%Language:Shell 0.1%Language:DTrace 0.0%Language:Batchfile 0.0%Language:CSS 0.0%Language:Visual Basic 0.0%