MyFreeMP3 API

Music API for http://tool.liumingye.cn/music/ and http://tool.liumingye.cn/music_old/

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @require https://update.greatest.deepsurf.us/scripts/474021/1465958/MyFreeMP3%20API.js

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Δημιουργός
PYUDNG
Έκδοση
0.1.8
Δημιουργήθηκε την
27/08/2023
Ενημερώθηκε την
16/10/2024
Μέγεθος
20 KB
Άδεια
MIT

Music API for MyFreeMP3 and MyFreeMP3(old)

Requirements:

//@grant GM_xmlhttpRequest
//@connect api.liumingye.cn
//@connect api2.liumingye.cn

Usage: This method will request new or old api and provides a standardized callback argument object. Recommended.

Mfapi.search({
    type: 'YQD', // Search songs in "M" then use "YQM", search in "B" then use "YQB", search in "D" then use "YQD", etc; Default: "YQD"
    text: 'your search params', // Song name, artist names, etc
    page: 1, // Default: 1
    callback: function(json) { console.log(json); },
    onerror: function(err) { console.log(err); }, // Default: function() {}
    api: 'auto' // Which api to use, 'new','old' or 'auto' for automatically choose, Default: 'auto'
}, 3);
// The second argument is retry count,  meaning how many retries we'll take before onerror got called.
// This number will be doubled if your api === 'auto' because we have to try both new and old apis if one of them is unavailable.
// Default: 3

You can specific different type, text, page, callback, and onerror for different apis by providing an object. For example, if you want to search text 'Song A' while requesting 'new' api but search 'Song B' while requesting 'old' api, you can use code like this:

Mfapi.search({
    type: 'YQD', // Search songs in "M" then use "YQM", search in "B" then use "YQB", search in "D" then use "YQD", etc; Default: "YQD"
    text: {
        new: 'Song A', // Search 'Song A' while requesting new api
        old: 'Song B'  // Search 'Song B' while requesting old api
    },
    page: 1, // Default: 1
    callback: function(json) { console.log(json); },
    onerror: function(err) { console.log(err); }, // Default: function() {}
    api: 'auto' // Which api to use, 'new','old' or 'auto' for automatically choose, Default: 'auto'
}, 3);

This may be useful when api is 'auto'.

or you can request old or new api directly to access raw api return value.

Mfapi.new.search({ type, text, page, callback, onerror });
Mfapi.old.search({ type, text, page, callback, onerror });

The apis' token encoders are also provided as Mfapi.new.encode and Mfapi.old.encode, and there's also Mfapi.new.link and Mfapi.old.link methods which accepts a song object and a quality number and returns its download url.

Try it out yourself and look into the callback values!