Unofficial Yandex Music API

Overview

YM-API - Unofficial Swift Yandex Music Library

Fully ported Yandex Music API Swift implementation.

Russian Readme (Readme на русском)

Thanks to MarshalX for his Yandex Music API research and the python library.

Content

Introduction

The library provides an interface for interacting with the Yandex Music API.

macOs 10.14+ and iOS 10.0+ are supported by the module.

Yandex personal data access

Constant values CLIENT_ID и CLIENT_SECRET were borrowed from the Yandex Music official application at Microsoft Store. Since the API is private and only used internally, it is impossible to register own application for now on [oauth.yandex.ru] (https://oauth.yandex.ru), and therefore, use your own constant values.

Setup

YM-API is available with CocoaPods. To install a module, just add the module name to the Podfile:

  • iOS
platform :ios, '10.0'
...
pod "YM-API"
  • macOS
platform :osx, '10.14'
...
pod "YM-API"

Getting started

You can interact with the API throw YMClient instance.

You can initialize the client in 2 ways:

Basic, at first lauch or logout state

import YM_API

let client = YMClient.initialize(device: YMDevice, lang: ApiLanguage)

device parameter - Device info. Essentially needed during working with play queues

let device = YMDevice(os: "iOS", osVer: 14.6, manufacturer: "Apple",
    model: iPhone8,4, clid: "app-store", 
    deviceId: UUID().uuidString.replacingOccurrences(of: "-", with: "").lowercased(),
    uuid: UUID().uuidString.replacingOccurrences(of: "-", with: "").lowercased())

lang parameter - Yandex Music localization. There are 7 options to choose from:

enum ApiLanguage: String {
    case en//English
    case uz//Uzbek
    case uk//Ukrainian
    case us//English (US)
    case ru//Russian
    case kk//Kazakh
    case hy//Armenian
}

Extended, if there is an active session

import YM_API

let client = YMClient.initialize(device: YMDevice, lang: ApiLanguage, uid: Int, token: String)

uid parameter - Account ID token parameter - Account token

To work with the service in the absence of an active session, you must sign in.

Login by login and password:

client.authByCredentials(login: String, pass: String, captchaAnswer: nil, 
    captchaKey: nil, captchaCallback: nil) { result in
    //Actions with the result of the query
}

Usage examples

If you have an initialized client with authorized session, you can use all available methods from the API.

Retrieving a list of generated daily playlists in the context of the feed

client.getFeed { result in
    guard let feed = try? result.get() else {return}
    let playlists = feed.generatedPlaylists
}

Retrieving playlist tracks data

Option with calling a function from a playlist track instance

playlist.tracks?[index].fetchTrack(completion: { result in
    //Actions with track data
})

Option with calling a function from a client instance

let trackIds = playlist.tracks?.map{ track in return track.trackId }
client.getTracks(trackIds: trackIds, positions: false) { result in
    //Actions with tracks data
}

Retrieving the track download link

var track: Track!
... acquiring track data...
track.getDownloadLink(codec: .mp3, bitrate: .kbps_192) {result in
    //Actions with download link
}

Application example

An application for iOS (10.0+) was created for this API. It implements a working minimum: playlists generated by Yandex, displaying its content, playing songs including local play queue, the ability to like or dislike them, display the 'my collection' tracks with the ability to listen and search tracks. Its source code is publicly available.

Visit this page, to see the example application source.

Setup application ways

This application can be installed on your device for testing in several ways:

Free and simple

You need mac and XCode. Plus you need to have a basic developer account (without paid license) and the Apple device added to it. Update the pod dependencies in the project and just compile the sample application project for your device. The installed application will be available for 7 days due to the limitations of the basic developer account.

Advanced and paid

You need mac and and a developer account with a paid license. Необходимо иметь мак и аккаунт разработчика с проплаченной лицензией. On the Apple Developer site you need to prepare the infrastructure for uploading: certificates, application ID (basic capabilities set), provision profiles set. So you can use the application not only on your personal device (App Store Connect public testing throw TestFlight) and not for 7 days. P.S. And if you want to show the whole breadth of your soul and, perhaps, thank the creator, you can upload the application to TestFlight for open testing and share the link, which I will post here =)

Getting help

If you find problems or want to suggest a new feature in the API itself create an issue

I don't plan to add anything to the application itself - it is an example of using the API

License

You can copy, distribute and modify the software provided that modifications are described and licensed free of charge in accordance with c LGPL-3. Artworks derivatives (including modifications or anything statically linked to the library) may only be distributed in accordance with the LGPL-3, but applications that use a library, optional.

You might also like...
🎶 Control Apple Music right from your macOS menu bar.
🎶 Control Apple Music right from your macOS menu bar.

About Music Bar is macOS application that places music controls right in your menu bar. Installation Download and unzip the latest release. Drag the a

macOS app that allows the control of Spotify and AppleMusic/iTunes music playback from the menu bar.
macOS app that allows the control of Spotify and AppleMusic/iTunes music playback from the menu bar.

PlayStatus is a simple macOS app that allows the control of Spotify, Apple Music(macOS 10.15+) and iTunes including iTunes Radio/Beats1 playback from

:musical_note: A Mac app wrapper for music.youtube.com
:musical_note: A Mac app wrapper for music.youtube.com

A simple Mac app wrapper using WKWebView for YouTube Music that allows YouTube Music to run as a standalone process. Features Media Keys Keyboard shor

A charmful decade with many colors patterns, disco music, and other cultural expressions that we refer to as vintage
A charmful decade with many colors patterns, disco music, and other cultural expressions that we refer to as vintage

MontyHallProblem Welcome to the 70s! 🕺 That is a charmful decade with many colors patterns, disco music, and other cultural expressions that we refer

App for searching music and films in iTunes
App for searching music and films in iTunes

inMovies App description: This is an app for searching contnent such as films and music in iTunes. Running the app brings you to page with following c

Custom iOS music player view
Custom iOS music player view

InteractivePlayerView Custom iOS music player view Screen About InteractivePlayerView is an IBDesignableView (Custom View) which has its own progress,

Cool Animated music indicator view written in Swift
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Analyser BPM in Swift for your music/sounds/records, whatever..
Analyser BPM in Swift for your music/sounds/records, whatever..

BPM-Analyser Analyser BPM in Swift for your music/sounds/records, whatever.. Powered with Superpowered Preview: How To: Copy theese files to your proj

🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.
🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.

Made by Applikey Solutions Find this project on Dribbble Table of Contents Purpose Features Supported OS & SDK Versions Installation Usage Demo Releas

Comments
  • Update Likes.swift

    Update Likes.swift

    Error with type name (atrist -> artist)

    Спасибо за Ваш труд!

    Нашел ошибку в названии типа и из-за чего не получалось поставить и убрать лайк артисту

    opened by PSVCodes 0
Releases(0.6.3)
  • 0.6.3(May 23, 2022)

    New API methods

    • Import tracks for new playlist method (including import status check method)
    • User info retrieve method by UID or login (can be executed without active session)

    API related changes

    • Updated User class, adopting for user search method (statistics and socialProfiles fields)
    • New SocialProfile class
    • New UserStatistics class
    • New PlaylistImportStatus class

    Sample app changes

    • Fast track skip crash fix
    • My playlists retrieve and play its tracks support
    • Main radio stations full support
    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(Mar 14, 2022)

    API related changes

    • New sign in method (passport.yandex) YMClient's instance.authByCredentials
    • Artist likes fix;
    • Tracks' JSON parser fix
    • Radios' JSON parser fix

    Sample app changes

    • Small UI fixes
    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Nov 3, 2021)

    New API methods

    • New authorization system (passport.yandex);
    • 'Recently listened' request;
    • 'Feed promotions info' request;
    • Search history (get, clear or add search query to the history);
    • Labels (artists, albums)

    API related changes

    • XPassportObj class for new athentication system;
    • Updated methods for retrieving user avatar;
    • Listen history related classes: ListenHistory, ListenHistoryItem, ListenHistoryContextType;
    • Updated Promotion class;
    • Updated YMDevice class;
    • New SearchFeedback and SearchHistoryItem classes;
    • New SearchHistoryItem and SearchFeedback classes

    Sample app changes

    • Adopted for iPhone X and newer display;
    • Other small UI fixes

    Other changes

    • Method client.authByCredentials marked as deprecated. It remains working as long as Yandex supports it
    Source code(tar.gz)
    Source code(zip)
Owner
null
Classical music front-end for Apple Music: iOS app

concertino_ios Concertino is a classical music front-end for Apple Music. It's splitted in several projects. This one provides only the iOS app. (Ther

Open Opus 107 Dec 22, 2022
iOS music player app that downloads music from the internet, even YouTube

About YouTag is an iOS music player app that downloads music from the internet, even YouTube, and manages it in a local library. Music videos can also

null 263 Jan 8, 2023
A pure Swift Spotify Music App in Apple Music style

HBMusic A pure Swift Spotify Music App in Apple Music style. How to run pod inst

haoboxuxu 6 Dec 29, 2021
MusicTheoryKit: a swift module that provides an easy-to-use API for most commonly used music terms

MusicTheoryKit Introduction MusicTheoryKit is a Swift framework that provides an easy-to-use API for most commonly used music terms. Create notes, ass

Jin Zhang 4 Feb 8, 2022
MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

MusicKit MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift. Examples Functional harmony let C5 = Pitch(midi: 72

Ben Guo 591 Oct 18, 2022
Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern and MVVM architecture.

Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern ?? and MVVM architecture ?? . Made with love ❤️ by Sameer Nawaz

Sameer Nawaz 120 Jan 4, 2023
Music Player for iOS which looks & feels like classic player

Prodigal Music Player APP looks and feels like a classic device. Bring back the good old player to life. Screenshots Home Page Album Gallery Home Page

bob.sun 40 Nov 11, 2022
A real-time, votable, democratized music queue on iPad and iPhone using Spotify

Queue'd Music Queue'd is the best way to enjoy music with your friends. Add your favorite songs to a shared music queue at your favorite bars, restaur

Ryan Daulton 88 Dec 2, 2022
MuVis is a macOS, iOS, iPadOS app for real-time music visualization.

MuVis MuVis is an open-source multiplatform app (using SwiftUI, Swift, and Xcode) for music visualization. It renders informative (and musically usefu

Keith Bromley 7 Oct 10, 2022
YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos.

YiVideoEditor YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos. YiVideoE

coderyi 97 Dec 14, 2022