Skip to content

Commit

Permalink
Edit readme, add license, change download folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBelgium committed Jul 20, 2018
1 parent 1531f0d commit 4f6ed85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,27 @@ With these two php files you are able to create your own Youtube to MP3 API with
| max_results | No | integer | The max results of search results u want to get |


# Requirements
# Software requirements

* [youtube-dl](https://rg3.github.io/youtube-dl/)
* [ffmpeg](https://www.ffmpeg.org/)
* [libmp3lame](http://lame.sourceforge.net/)

* [youtube-dl-php](https://github.com/norkunas/youtube-dl-php)
* [google api client](https://github.com/google/google-api-php-client)

# General installation

First we install the dependencies on the server, then website.

## VPS

* Install libmp3lame (see below)
* Install ffmpeg (see below)
* install youtube-dl
* Install ffmpeg (+ libmp3lame - see below)
* [install youtube-dl](https://rg3.github.io/youtube-dl/download.html)

## Website

* Get a google developer api key
* Go to a directory to run composer into (this will be the directory where you'll access the API via browser)
* Install youtube-dl-php (or just do `composer require norkunas/youtube-dl-php`)
* Install the google api client (or just do `composer require google/apiclient:^2.0`)
* Put the `convert.php` and `search.php` in the same directory (the files in this repo is an example. These are the files I use on my VPS.)
* Go to your webserver files to run composer into
* Run `composer create-project michaelbelgium/youtube-to-mp3 [directoryname]` - where `directoryname` is .. a directory where people can access the API from.
* Edit defines:

In `search.php` you can define these variables:
```PHP
Expand All @@ -54,7 +49,7 @@ define("API_KEY", "");

# How I installed ffmpeg (compiling/building and installing)

If you have ffmpeg in `yum` or `apt-get` or any kind this is probably not needed. I had to do this manually as I'm using Centos 6.x
If you have ffmpeg in `yum` or `apt-get` this is **not needed**. I had to do this manually as I'm using Centos 6.x

## libmp3lame

Expand Down Expand Up @@ -89,6 +84,8 @@ Aftwards ffmpeg was installed in `/usr/local/bin/ffmpeg` which then I needed to
# Example output

## Download/convert
`http://michaelbelgium.me/ytconverter/convert.php?youtubelink=https://www.youtube.com/watch?v=gUJKs1m7Y8M`

```JSON
{
"error": false,
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"norkunas/youtube-dl-php": "^1.0",
"google/apiclient": "^2.0"
},
"license": "MIT",
"authors": [
{
"name": "Michael V.",
Expand Down
2 changes: 1 addition & 1 deletion convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use YoutubeDl\YoutubeDl;

define("DOWNLOAD_FOLDER", "/var/www/html/michael/ytconverter/download/"); //Be sure the chmod the download folder
define("DOWNLOAD_FOLDER", dirname(__FILE__)."/download/"); //Be sure the chmod the download folder
define("DOWNLOAD_FOLDER_PUBLIC", "http://michaelbelgium.me/ytconverter/download/");

header("Content-Type: application/json");
Expand Down

0 comments on commit 4f6ed85

Please sign in to comment.