Coder Social home page Coder Social logo

youtube-dl-mp3-php's Introduction

youtube-dl-mp3-php

Php Script to download youtube video with youtube-dl, convert FFmpeg and encoding with with lame. And create a mp3 file to download directly

###Requirements:

###Server side Set permissions to youtube-dl:

chmod a+x youtube-dl

Edit download.php file, add your domain url where you put the script, in $base:

$base = "http://yoursite.com/mp3/";

go to

http://yoursite.com/mp3/download.php?id={code}&nome={name.mp3}

'code' is the code of video, the code is after https://www.youtube.com/watch?v=

'name.mp3' is the name of mp3 saved

return data will be a json object with a assolute url of mp3

Client Side

Make JSONP request, if you use jQuery:

$.ajax({
    url: "http://yoursite.com/mp3/download.php",
 
    jsonp: "callback",
 
    dataType: "jsonp",
 
    data: {
        id: "34s_cIuHWB4",
        name: "mmysong.mp3"
    },
 
    // work with the response
    success: function( data ) {
        if(data.link) alert(data.link);
        if(data.errori) console.log(data.errori);
    }
});

Now you can redirect the page to "data.link", set:

window.location.href = data.link

oer create a link:

"<a href='"+data.link+"'>download</a>"

youtube-dl-mp3-php's People

Contributors

agliottone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

youtube-dl-mp3-php's Issues

composer

could you plz make a composer for it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.