Отсканируй на iPhone, чтобы установить
Do you want music right in your files app? Well, here is a shortcut for that!
Что нового
Версия 1.0
First release
Что делает
Действий: 185-
CommentDeezer music 🎵 downloader. Ripped from source directly. V: 3.0.0, Made by tbb @shareshortcuts.com
-
CommentSet this text to iCloud to save files on iCloud or Browser for saving on Browser app. You can also use "iCloud and Browser" to save on both of 'em 😉
-
Text
-
Set VariableSaveTo
-
CommentWhen sharing from deezer, input is messed up hence we split and combine them for getting the actual urls.
-
Split Text
-
Combine Text
-
If
-
If
-
Text
-
Get Clipboard
-
If
-
CommentLet the user know if they wanna download the content from their clipboard link and if they don't go with search!
-
Choose from Menu…
-
Choose from MenuYes
-
Choose from MenuNo
-
Nothing
-
Set VariableInput
-
CommentEnter quality to download. 128/320/1411 128 - 128 kbps mp3 320 - 320 kbps mp3 1411 - 1411 kbps flac
-
Number
-
Set VariableQuality
-
If
-
CommentArtists nowadays usually share artistname.lnk.to/album-name like urls for redirecting to various streaming services. If we have this on input, parse it for getting deezer urls.
-
Get Contents of URL…
-
Make HTML from Rich Text
-
Match Text
-
Set VariableInput
-
If
-
CommentIf we have deezer link, just move along with downloads.
-
If
-
Text
-
Ask for Input…
-
If
-
CommentC is for top charts. You can replace this url with any of your specific charts.
-
URLhttps://api.deezer.com/chart/0/tracks
-
If
-
URL Encode
-
If
-
If
-
Match Text
-
URLhttps://api.deezer.com/search/album?q=…
-
If
-
If
-
Match Text
-
URLhttps://api.deezer.com/search/playlist?q=…
-
If
-
Match Text
-
Text
-
If
-
CommentIf none of charts, album or playlist was selected go with default track search.
-
URLhttps://api.deezer.com/search?q=…
-
Get Contents of URL…
-
CommentIf ":" was selected it gets multiple pages else one single page was fetched. Just repeat with each and add results to variable.
-
Repeat with Each
-
Get Dictionary Value
-
Count
-
CommentEvery search results have 25 results but we cut them to 10 for decreasing clutter. Specially when ":" was used it gets messy! Change the number if you want more result but don't go over 25.
-
If
-
Number
-
Set VariableItemsData
-
Get Item from List
-
CommentFrom dictionary > data we get the actual tracks. Repeat with each and add to our list for downloading on next step.
-
Repeat with Each
-
Get Dictionary Value
-
URL…
-
Set Name
-
Add to Variable
-
CommentHere we choose songs from our searched results. By default, we select only one song. You can enable multiple button here for selecting multiple songs.
-
Choose from List
-
Set VariableInput
-
Replace Text
-
CommentReplace all the deezer links with their api endpoint. You shouldn't download multiple albums/playlist at the same time, only tracks are good.
-
If
-
Split Text
-
Count
-
CommentDeezer have a api limit and that is 50 requests every 5 seconds. So we have to use their api slowly if we have more than 50 tracks. If we have less tracks we will fetch 'em all at once!
-
If
-
Repeat with Each
-
Get Contents of URL…
-
If
-
Get Contents of URL…
-
If
-
CommentHere we are gonna fetch album/playlist or anything else with a single request. Please bear in mind, we cannot get more than 400 tracks from a playlist with a single request.
-
If
-
Get Contents of URL…
-
Get Dictionary Value
-
Replace Text
-
CommentRemove all illegal characters from title as it mess up later saving to file.
-
Set VariablePlaylistTitle
-
If
-
Get Dictionary Value
-
If
-
Get Dictionary Value
-
Get Contents of URL…
-
Get Dictionary Value
-
Set VariableData
-
Count
-
If
-
Number
-
If
-
Number
-
CommentThis number are for using later for numbering tracks in order like this: 01 99 400
-
Repeat with Each
-
Get Dictionary Value
-
Replace Text
-
Set VariableSongTitle
-
Get Dictionary Value
-
CommentSet this number to 0 to disable track numbering and set it to 1 to enable numbering.
-
Number
-
If
-
Text
-
If
-
Text
-
Match Text
-
Text
-
If
-
Text
-
CommentSet tracks name and number for when we would choose tracks for album or playlist.
-
Set Name
-
Add to Variable
-
Count
-
CommentIf we have more than two tracks to download, give us an option if we wanna download 'em all or not.
-
If
-
Get Variable
-
Choose from MenuChoose an option (… Tracks)
-
Choose from MenuDownload ‘em all
-
Choose from MenuChoose ‘em (none)
-
Choose from List
-
Choose from MenuChoose ‘em (all)
-
Choose from List
-
Choose from MenuChoose range
-
Get Item from List
-
Set VariableSong Data
-
CommentHere will be the actual processing for downloads. We will repeat with each tracks and get the song from the backend server.
-
Repeat with Each
-
CommentHold on! I'm working my magic 😁 Single track downloads shouldn't take long. Stay on this screen for smooth downloading experience 🙂
-
Get Contents of URLhttp://dz.loaderapp.info/deezer/…/…
-
Set VariableContents
-
Get Details of Files
-
Match Text
-
CommentIf any of this extension files were received from our server, we would assume download was successful.
-
If
-
Set Name
-
Add to Variable
-
If
-
If
-
Create Folder
-
Get Item from List
-
Save File
-
If
-
Create Folder
-
Get Item from List
-
Save File
-
Show NotificationDownloaded Track #… … to iCloud
-
If
-
Show NotificationDownloaded Track #… …
-
If
-
Show NotificationFailed to download track #… …
-
If
-
Get Variable
-
If
-
If
-
Show Alert…
-
If
-
URL…
-
Open URLs
-
Wait
-
Nothing
-
Count
-
If
-
Show AlertOops!
-
If
-
If
-
If
-
Make Archive
-
If
-
Count
-
If
-
Make Archive
-
If
-
Get Variable
-
Open File
-
Show NotificationMusic from Deezer downloaded to Browser app. Open Inbox folder for data.
-
If
-
Show NotificationMusic from Deezer downloaded to iCloud. Open Files app to view contents.
Посмотреть как код
Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.
#include 'actions/web'
#include 'actions/sharing'
#define color darkgray
#define glyph headphones
/*
Deezer music 🎵 downloader.
Ripped from source directly.
V: 3.0.0, Made by tbb @shareshortcuts.com
*/
// Set this text to iCloud to save files on iCloud or Browser for saving on Browser app. You can also use "iCloud and Browser" to save on both of 'em 😉
@SaveTo = "Browser"
// When sharing from deezer, input is messed up hence we split and combine them for getting the actual urls.
const SplitText = splitText(ShortcutInput, " ")
const CombinedText = joinText(SplitText, "
")
if CombinedText contains CombinedText {
} else {
const Clipboard = getClipboard()
if Clipboard contains "deezer.com" {
// Let the user know if they wanna download the content from their clipboard link and if they don't go with search!
menu {
item "Yes":
item "No":
}
}
}
@Input
/*
Enter quality to download.
128/320/1411
128 - 128 kbps mp3
320 - 320 kbps mp3
1411 - 1411 kbps flac
*/
@Quality = 128
if @Input contains "lnk.to" {
// Artists nowadays usually share artistname.lnk.to/album-name like urls for redirecting to various streaming services. If we have this on input, parse it for getting deezer urls.
const ContentsOfURL = downloadURL(@Input)
makeHTML(ContentsOfURL)
containsText(, "https?.*?deezer.com/.*", false)
@Input
}
if @Input contains "deezer.com" {
// If we have deezer link, just move along with downloads.
} else {
const AskForInput = prompt()
if AskForInput == "C" {
// C is for top charts. You can replace this url with any of your specific charts.
url("https://api.deezer.com/chart/0/tracks")
} else {
const URLEncodedText = urlEncode(AskForInput)
if URLEncodedText contains ":" {
if URLEncodedText contains "A:" {
containsText(URLEncodedText, "[^:]+$", false)
url("https://api.deezer.com/search/album?q={}")
} else {
if URLEncodedText contains "P:" {
containsText(URLEncodedText, "[^:]+$", false)
url("https://api.deezer.com/search/playlist?q={}")
} else {
containsText(URLEncodedText, "[^:]+$", false)
}
}
} else {
// If none of charts, album or playlist was selected go with default track search.
url("https://api.deezer.com/search?q={URLEncodedText}")
}
}
const ContentsOfURL1 = downloadURL()
// If ":" was selected it gets multiple pages else one single page was fetched. Just repeat with each and add results to variable.
for _ in ContentsOfURL1 {
const DictionaryValue = getValue(@RepeatItem, "data")
const Count = count(DictionaryValue, "Items")
// Every search results have 25 results but we cut them to 10 for decreasing clutter. Specially when ":" was used it gets messy! Change the number if you want more result but don't go over 25.
if Count > 10 {
@ItemsData = 10
}
const ItemFromList = getListItems(DictionaryValue, @ItemsData)
// From dictionary > data we get the actual tracks. Repeat with each and add to our list for downloading on next step.
for _ in ItemFromList {
const URL = url(@RepeatItem2['link'])
setName(URL, "{['name']} - {@RepeatItem2['title']}")
@SearchItems
}
}
// Here we choose songs from our searched results. By default, we select only one song. You can enable multiple button here for selecting multiple songs.
chooseFromList(@SearchItems, "Select a music to download", false)
@Input
}
const UpdatedText = replaceText(".+?(?=/album|/artist|/playlist|/profile|/track)", "http://api.deezer.com", @Input, true)
// Replace all the deezer links with their api endpoint. You shouldn't download multiple albums/playlist at the same time, only tracks are good.
if UpdatedText contains "/track/" {
const SplitText1 = splitText(UpdatedText)
const Count1 = count(SplitText1, "Items")
// Deezer have a api limit and that is 50 requests every 5 seconds. So we have to use their api slowly if we have more than 50 tracks. If we have less tracks we will fetch 'em all at once!
if Count1 > 50 {
for _ in SplitText1 {
downloadURL(@RepeatItem)
}
} else {
downloadURL(UpdatedText)
}
} else {
// Here we are gonna fetch album/playlist or anything else with a single request. Please bear in mind, we cannot get more than 400 tracks from a playlist with a single request.
if UpdatedText contains "deezer.com" {
const ContentsOfURL2 = downloadURL(UpdatedText)
replaceText("[/:|;\",\\*']", "_", true)
// Remove all illegal characters from title as it mess up later saving to file.
@PlaylistTitle
if ContentsOfURL2 contains "\"data\"" {
} else {
downloadURL()
}
}
}
@Data = IfResult['data']
const Count2 = count(@Data, "Items")
if Count2 > 99 {
} else {
}
/*
This number are for using later for numbering tracks in order like this:
01
99
400
*/
for _ in @Data {
replaceText("[/:|;\",\\*']", "_", true)
@SongTitle
// Set this number to 0 to disable track numbering and set it to 1 to enable numbering.
const Number = 1
if Number > 0 {
const Text = "00{@RepeatItem['track_position']}"
if Text < 1 {
}
containsText(, ".{{}}$", false)
} else {
}
// Set tracks name and number for when we would choose tracks for album or playlist.
setName(IfResult1, "{@RepeatIndex}) {['name']} - {@SongTitle} ({@RepeatItem['duration']}s)")
@SongData
}
const Count3 = count(@SongData, "Items")
// If we have more than two tracks to download, give us an option if we wanna download 'em all or not.
if Count3 > 2 {
// TODO: Get Variable not supported: Assign variable here to '@SongData'.
menu "Choose an option ({Count3} Tracks)" {
item "Download ‘em all":
item "Choose ‘em (none)":
chooseFromList(@SongData, "", true)
item "Choose ‘em (all)":
chooseFromList(@SongData, true, true)
item "Choose range":
getListItems(@SongData, Ask, Ask)
}
@SongData
}
// Here will be the actual processing for downloads. We will repeat with each tracks and get the song from the backend server.
for _ in @SongData {
// Hold on! I'm working my magic 😁 Single track downloads shouldn't take long. Stay on this screen for smooth downloading experience 🙂
jsonRequest("http://dz.loaderapp.info/deezer/{@Quality}/{@RepeatItem['url']}", "GET", {
"quality": "{@Quality}",
"url": "{@RepeatItem['url']}",
"ver": "2.1.1"
})
@Contents
getFileDetail(nil, "File Extension")
const Matches = containsText(, "mp3|flac|m4a", false)
// If any of this extension files were received from our server, we would assume download was successful.
if Matches contains Matches {
setName(@Contents, @RepeatItem['title'])
@Music
if @SaveTo contains "iCloud" {
if @PlaylistTitle contains @PlaylistTitle {
createFolder("Music/{@PlaylistTitle}/")
const ItemFromList1 = getRandomItem(@Music)
saveFile("Music/{@PlaylistTitle}/", ItemFromList1, true)
} else {
createFolder("Music/")
const ItemFromList2 = getRandomItem(@Music)
saveFile("Music/", ItemFromList2)
}
showNotification("Downloaded Track #{@RepeatIndex}\n{@RepeatItem['title']} to iCloud", "Deezer++", false, IfResult2)
} else {
showNotification("Downloaded Track #{@RepeatIndex}\n{@RepeatItem['title']}", "Deezer++", false, @Music)
}
} else {
showNotification("Failed to download track #{@RepeatIndex}\n{@RepeatItem['title']}", "Deezer++", Matches)
if @Contents contains "\"error\"" {
// TODO: Get Variable not supported: Assign variable here to '@PlaylistTitle'.
if @PlaylistTitle contains @PlaylistTitle {
} else {
alert(@Contents['message'], @Contents['error'])
}
if @Contents contains "update_url" {
const URL1 = url(@Contents['update_url'])
openURL(URL1)
wait(2)
}
}
}
}
const Count4 = count(@Music, "Items")
if Count4 == "0" {
alert("We were unable to download any music ☹️", "Oops!")
} else {
if @SaveTo contains 0 {
if @PlaylistTitle contains 2 {
makeArchive(@Music, @PlaylistTitle)
} else {
const Count5 = count(@Music, "Items")
if Count5 > 1 {
makeArchive(@Music, "Deezer - {CurrentDate} ")
} else {
// TODO: Get Variable not supported: Assign variable here to '@Music'.
}
}
openFile(IfResult3, false)
showNotification("Music from Deezer downloaded to Browser app. Open Inbox folder for data.", "Downloaded", IfResult3)
} else {
showNotification("Music from Deezer downloaded to iCloud. Open Files app to view contents.", "Deezer++", @SaveTo)
}
}
Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.
Оценки и отзывы
Написать отзыв–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings
Пока нет отзывов. Поделись мнением первым!
Реклама
Ещё от tbb
Вам также может понравиться
Реклама