Compare commits
No commits in common. "67a78c2de28f2885c31e89595f07546d2b40dd1d" and "96ac5a6f31ef02b9158d0678f0017eff1c148100" have entirely different histories.
67a78c2de2
...
96ac5a6f31
34
index.js
34
index.js
|
@ -15,30 +15,18 @@ require('dotenv').config();
|
||||||
|
|
||||||
|
|
||||||
async function getSpotifyPlaylist(playListUrl){
|
async function getSpotifyPlaylist(playListUrl){
|
||||||
const spotifyPlaylistPageContent = await fetch(playListUrl, {
|
const spotifyPlaylistPageContent = await fetch(playListUrl)
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
|
|
||||||
const $ = Cheerio.load(spotifyPlaylistPageContent);
|
const $ = Cheerio.load(spotifyPlaylistPageContent);
|
||||||
|
|
||||||
let config;
|
let playlist;
|
||||||
$('script#config').each(function(i, elem){
|
$('script').each(function(i, elem){
|
||||||
config = JSON.parse($(this).html());
|
const content = $(this).html();
|
||||||
});
|
if(/Spotify.Entity/.test(content)){
|
||||||
debug('config=%O', config);
|
playlist = vm.runInNewContext(content);
|
||||||
|
|
||||||
const playlistSpotifyId = /\/playlist\/([^\/]+)\/?$/.exec(playListUrl)[1];
|
|
||||||
|
|
||||||
const playlist = await fetch(`https://api.spotify.com/v1/playlists/${playlistSpotifyId}?type=track%2Cepisode`, {
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0',
|
|
||||||
Authorization: `Bearer ${config.accessToken}`
|
|
||||||
}
|
}
|
||||||
}).then(res => res.json());
|
});
|
||||||
|
|
||||||
return playlist;
|
return playlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +55,7 @@ async function searchOnVkMusic(query){
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchOnMyFreeMp3(query){
|
async function searchOnMyFreeMp3(query){
|
||||||
const url = new URL('https://myfreemp3cc.com/api/search.php?callback=jQuery666');
|
const url = new URL('https://myfreemp3cc.com/api/search.php?callback=callback');
|
||||||
|
|
||||||
return await fetch(url, {
|
return await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -77,11 +65,7 @@ async function searchOnMyFreeMp3(query){
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(page => {
|
.then(jsonp => vm.runInNewContext(jsonp, { callback: (payload) => payload.response }))
|
||||||
debug('page=%O', page);
|
|
||||||
return page;
|
|
||||||
})
|
|
||||||
.then(jsonp => vm.runInNewContext(jsonp, { jQuery666: (payload) => payload.response }))
|
|
||||||
.then(items => _.filter(items, item => !_.isString(item)));
|
.then(items => _.filter(items, item => !_.isString(item)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "vk-music-dl",
|
"name": "vk-music-dl",
|
||||||
"version": "1.0.7",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "vk-music-dl",
|
"name": "vk-music-dl",
|
||||||
"version": "1.0.7",
|
"version": "1.0.6",
|
||||||
"description": "Download Spotify playlist as mp3 from VKontakte",
|
"description": "Download Spotify playlist as mp3 from VKontakte",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user