ShareShortcuts

Deezer++

Do you want music right in your files app?

tbb
Dupliquer « Deezer++ »

Tu as créé quelque chose de nouveau à partir de ce raccourci ? Partage-le comme version dérivée : il devient un raccourci à toi, que tu gères, et les deux pages renvoient l’une vers l’autre pour que tbb soit crédité.

  1. 1Obtenez le raccourci et modifiez-le dans l’app Raccourcis. Donnez-lui un nom bien à lui.
  2. 2Partage-le depuis l’app Raccourcis et copie le lien iCloud.
  3. 3Reviens ici, colle le lien et décris ce qui change, par exemple : « Ajout d’une étape qui utilise Apple Intelligence pour personnaliser le texte. »
Créer mon fork
Téléchargements
59K
Enregistré
0
Actions
185
Catégorie
API
Version
1.0
Langue
EN

Do you want music right in your files app? Well, here is a shortcut for that!

Nouveautés

Version 1.0

First release

Historique des versions
1.0 28 juil. 2020

First release

Ce qu’il fait

185 actions
  1. Comment
    Deezer music 🎵 downloader. Ripped from source directly. V: 3.0.0, Made by tbb @shareshortcuts.com
  2. Comment
    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 😉
  3. Text
  4. Set Variable
    SaveTo
  5. Comment
    When sharing from deezer, input is messed up hence we split and combine them for getting the actual urls.
  6. Split Text
  7. Combine Text
  8. If
  9. If
  10. Text
  11. Get Clipboard
  12. If
  13. Comment
    Let the user know if they wanna download the content from their clipboard link and if they don't go with search!
  14. Choose from Menu
    …
  15. Choose from Menu
    Yes
  16. Choose from Menu
    No
  17. Nothing
  18. Set Variable
    Input
  19. Comment
    Enter quality to download. 128/320/1411 128 - 128 kbps mp3 320 - 320 kbps mp3 1411 - 1411 kbps flac
  20. Number
  21. Set Variable
    Quality
  22. If
  23. Comment
    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.
  24. Get Contents of URL
    …
  25. Make HTML from Rich Text
  26. Match Text
  27. Set Variable
    Input
  28. If
  29. Comment
    If we have deezer link, just move along with downloads.
  30. If
  31. Text
  32. Ask for Input
    …
  33. If
  34. Comment
    C is for top charts. You can replace this url with any of your specific charts.
  35. URL
    https://api.deezer.com/chart/0/tracks
  36. If
  37. URL Encode
  38. If
  39. If
  40. Match Text
  41. URL
    https://api.deezer.com/search/album?q=…
  42. If
  43. If
  44. Match Text
  45. URL
    https://api.deezer.com/search/playlist?q=…
  46. If
  47. Match Text
  48. Text
  49. If
  50. Comment
    If none of charts, album or playlist was selected go with default track search.
  51. URL
    https://api.deezer.com/search?q=…
  52. Get Contents of URL
    …
  53. Comment
    If ":" was selected it gets multiple pages else one single page was fetched. Just repeat with each and add results to variable.
  54. Repeat with Each
  55. Get Dictionary Value
  56. Count
  57. Comment
    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.
  58. If
  59. Number
  60. Set Variable
    ItemsData
  61. Get Item from List
  62. Comment
    From dictionary > data we get the actual tracks. Repeat with each and add to our list for downloading on next step.
  63. Repeat with Each
  64. Get Dictionary Value
  65. URL
    …
  66. Set Name
  67. Add to Variable
  68. Comment
    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.
  69. Choose from List
  70. Set Variable
    Input
  71. Replace Text
  72. Comment
    Replace all the deezer links with their api endpoint. You shouldn't download multiple albums/playlist at the same time, only tracks are good.
  73. If
  74. Split Text
  75. Count
  76. Comment
    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!
  77. If
  78. Repeat with Each
  79. Get Contents of URL
    …
  80. If
  81. Get Contents of URL
    …
  82. If
  83. Comment
    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.
  84. If
  85. Get Contents of URL
    …
  86. Get Dictionary Value
  87. Replace Text
  88. Comment
    Remove all illegal characters from title as it mess up later saving to file.
  89. Set Variable
    PlaylistTitle
  90. If
  91. Get Dictionary Value
  92. If
  93. Get Dictionary Value
  94. Get Contents of URL
    …
  95. Get Dictionary Value
  96. Set Variable
    Data
  97. Count
  98. If
  99. Number
  100. If
  101. Number
  102. Comment
    This number are for using later for numbering tracks in order like this: 01 99 400
  103. Repeat with Each
  104. Get Dictionary Value
  105. Replace Text
  106. Set Variable
    SongTitle
  107. Get Dictionary Value
  108. Comment
    Set this number to 0 to disable track numbering and set it to 1 to enable numbering.
  109. Number
  110. If
  111. Text
  112. If
  113. Text
  114. Match Text
  115. Text
  116. If
  117. Text
  118. Comment
    Set tracks name and number for when we would choose tracks for album or playlist.
  119. Set Name
  120. Add to Variable
  121. Count
  122. Comment
    If we have more than two tracks to download, give us an option if we wanna download 'em all or not.
  123. If
  124. Get Variable
  125. Choose from Menu
    Choose an option (… Tracks)
  126. Choose from Menu
    Download ‘em all
  127. Choose from Menu
    Choose ‘em (none)
  128. Choose from List
  129. Choose from Menu
    Choose ‘em (all)
  130. Choose from List
  131. Choose from Menu
    Choose range
  132. Get Item from List
  133. Set Variable
    Song Data
  134. Comment
    Here will be the actual processing for downloads. We will repeat with each tracks and get the song from the backend server.
  135. Repeat with Each
  136. Comment
    Hold on! I'm working my magic 😁 Single track downloads shouldn't take long. Stay on this screen for smooth downloading experience 🙂
  137. Get Contents of URL
    http://dz.loaderapp.info/deezer/…/…
  138. Set Variable
    Contents
  139. Get Details of Files
  140. Match Text
  141. Comment
    If any of this extension files were received from our server, we would assume download was successful.
  142. If
  143. Set Name
  144. Add to Variable
  145. If
  146. If
  147. Create Folder
  148. Get Item from List
  149. Save File
  150. If
  151. Create Folder
  152. Get Item from List
  153. Save File
  154. Show Notification
    Downloaded Track #… … to iCloud
  155. If
  156. Show Notification
    Downloaded Track #… …
  157. If
  158. Show Notification
    Failed to download track #… …
  159. If
  160. Get Variable
  161. If
  162. If
  163. Show Alert
    …
  164. If
  165. URL
    …
  166. Open URLs
  167. Wait
  168. Nothing
  169. Count
  170. If
  171. Show Alert
    Oops!
  172. If
  173. If
  174. If
  175. Make Archive
  176. If
  177. Count
  178. If
  179. Make Archive
  180. If
  181. Get Variable
  182. Open File
  183. Show Notification
    Music from Deezer downloaded to Browser app. Open Inbox folder for data.
  184. If
  185. Show Notification
    Music from Deezer downloaded to iCloud. Open Files app to view contents.

Afficher en tant que code
Bêta

Chaque action de ce raccourci écrite en Cherri, un langage de programmation pour Raccourcis. Idéal pour comprendre son fonctionnement.

#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)
	}
}
Décompilé avec cherri 2.3.0 (GPL-2.0). Quelques corrections peuvent être nécessaires avant la compilation.

Notes et avis

Écrire un avis
–
sur 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Aucun avis pour le moment. Sois le premier à partager ton avis !

Publicité

Plus de tbb

Tout afficher

Ça pourrait aussi te plaire

Tout afficher
Publicité