* parse yt as m4a
This commit is contained in:
parent
2d682d4fb8
commit
4253da7c49
|
@ -20,7 +20,7 @@ module.exports = (lib) => {
|
|||
var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links
|
||||
tmp.forEach((entry,i,a) => {
|
||||
if(!entry.match(/f0ck\.me/i) && !entry.match(/\.onion/i)) {
|
||||
getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), (e.message.match(/(!|-)mp3/i)?true:false), (cb) => {
|
||||
getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), (e.message.match(/(!|-)audio/i)?true:false), (cb) => {
|
||||
if(cb.success === true) {
|
||||
fs.move(cb.file, cb.file + '.' + cb.info.ext, (err) => {
|
||||
if(!err) {
|
||||
|
@ -64,7 +64,7 @@ module.exports = (lib) => {
|
|||
desc: 'muh'
|
||||
});
|
||||
|
||||
var getLink = (url, force, mp3, cb) => {
|
||||
var getLink = (url, force, m4a, cb) => {
|
||||
var yt = /https?:\/\/(www\.)?youtu(\.be\/|be\.com\/)((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi;
|
||||
var sc = /https?:\/\/(www\.)?(soundcloud\.com|snd\.sc)(\/\S*)(\/\S*)/gi;
|
||||
lib.checkRepost(url, (cbcr) => {
|
||||
|
@ -78,15 +78,15 @@ module.exports = (lib) => {
|
|||
var title = inf.title;
|
||||
var iurl = inf.iurl;
|
||||
try {
|
||||
var dlformat = (mp3?'mp3':'webm');
|
||||
var dlformat = (m4a?'m4a':'webm');
|
||||
ytdl.downloadFromInfo(inf, { filter: (format) => { return format.container === dlformat; } })
|
||||
.on('response', (res) => {
|
||||
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force ) {
|
||||
info = {
|
||||
type: 'youtube',
|
||||
title: title,
|
||||
mime: mp3?'audio/mpeg':'video/webm',
|
||||
ext: mp3?'mp3':'webm',
|
||||
mime: m4a?'audio/mp4':'video/webm',
|
||||
ext: m4a?'m4a':'webm',
|
||||
thumb: iurl
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user