Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

История поиска #314

Open
glebliutsko opened this issue May 5, 2020 · 0 comments
Open

История поиска #314

glebliutsko opened this issue May 5, 2020 · 0 comments
Labels
feature Новая функция или улучшение старой hacktoberfest https://hacktoberfest.com/

Comments

@glebliutsko
Copy link
Contributor

glebliutsko commented May 5, 2020

Эндпоинты

Получение истории поиска

Запрос

GET /users/{user_id}/search-history

Ответ

Массив объектов состоящих из

  • type - тип объекта
    • playlist
    • album
    • track
    • artist
    • может еще есть
  • track, album, playlist или artist - сам объект

Пример ответа

Пример ответа
{
    "invocationInfo": {
        "hostname": "music-stable-back-sas-2.sas.yp-c.yandex.net",
        "req-id": "1588697486107258-3337857724107898824",
        "exec-duration-millis": "16"
    },
    "result": [
        {
            "type": "playlist",
            "playlist": {
                "owner": {
                    "uid": 457553308,
                    "login": "yamusic-bestsongs",
                    "name": "Яндекс.Музыка",
                    "sex": "unknown",
                    "verified": true
                },
                "available": true,
                "uid": 457553308,
                "kind": 6771074,
                "title": "Лучшее: Крепкий Cон",
                "description": "Крепкий Cон: самые популярные треки на Яндекс.Музыке",
                "descriptionFormatted": "Крепкий Cон: самые популярные треки на Яндекс.Музыке",
                "revision": 0,
                "snapshot": 1,
                "trackCount": 20,
                "visibility": "public",
                "collective": false,
                "created": "2019-04-27T02:45:16+00:00",
                "modified": "2020-05-05T02:21:30+00:00",
                "isBanner": false,
                "isPremiere": false,
                "idForFrom": "artist_top",
                "durationMs": 6270400,
                "cover": {
                    "type": "pic",
                    "uri": "avatars.yandex.net/get-music-content/99892/9a0076e8.a.8131017-1/%%",
                    "custom": false
                },
                "ogImage": "avatars.yandex.net/get-music-content/99892/9a0076e8.a.8131017-1/%%",
                "tags": [],
                "likesCount": 271,
                "prerolls": []
            }
        },
        {
            "type": "track",
            "track": {
                "id": "2223238",
                "realId": "2223238",
                "title": "End Credits",
                "version": "из фильма «Пираты Карибского моря: На странных берегах»",
                "major": {
                    "id": 1,
                    "name": "UNIVERSAL_MUSIC"
                },
                "available": true,
                "availableForPremiumUsers": true,
                "availableFullWithoutPermission": false,
                "durationMs": 119980,
                "storageDir": "61078_97070586.2914928.2223238",
                "fileSize": 2880155,
                "normalization": {
                    "gain": -7.13,
                    "peak": 32766
                },
                "previewDurationMs": 30000,
                "artists": [
                    {
                        "id": 11818,
                        "name": "Hans Zimmer",
                        "various": false,
                        "composer": true,
                        "cover": {
                            "type": "from-album-cover",
                            "prefix": "64e21f1a.a.9613697-1",
                            "uri": "avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%"
                        },
                        "genres": []
                    }
                ],
                "albums": [
                    {
                        "id": 3865684,
                        "title": "«Пираты Карибского моря: На странных берегах»",
                        "type": "compilation",
                        "metaType": "music",
                        "version": "саундтрек к фильму",
                        "year": 2011,
                        "releaseDate": "2011-01-01T00:00:00+03:00",
                        "coverUri": "avatars.yandex.net/get-music-content/49876/42bd997c.a.3865684-1/%%",
                        "ogImage": "avatars.yandex.net/get-music-content/49876/42bd997c.a.3865684-1/%%",
                        "genre": "films",
                        "buy": [],
                        "trackCount": 18,
                        "recent": false,
                        "veryImportant": false,
                        "artists": [
                            {
                                "id": 171,
                                "name": "сборник",
                                "various": true,
                                "composer": false,
                                "cover": {
                                    "type": "from-album-cover",
                                    "prefix": "b1beebeb.a.9369597-1",
                                    "uri": "avatars.yandex.net/get-music-content/2114230/b1beebeb.a.9369597-1/%%"
                                },
                                "genres": []
                            }
                        ],
                        "labels": [
                            {
                                "id": 905559,
                                "name": "Walt Disney Records"
                            }
                        ],
                        "available": true,
                        "availableForPremiumUsers": true,
                        "availableForMobile": true,
                        "availablePartially": false,
                        "bests": [
                            2223233,
                            2223234,
                            2223238
                        ],
                        "trackPosition": {
                            "volume": 1,
                            "index": 11
                        }
                    }
                ],
                "coverUri": "avatars.yandex.net/get-music-content/49876/42bd997c.a.3865684-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/49876/42bd997c.a.3865684-1/%%",
                "lyricsAvailable": false,
                "type": "music",
                "rememberPosition": false
            }
        },
        {
            "type": "track",
            "track": {
                "id": "275704",
                "realId": "275704",
                "title": "Jack Sparrow",
                "version": "из фильма «Пираты Карибского моря: Сундук мертвеца»",
                "major": {
                    "id": 1,
                    "name": "UNIVERSAL_MUSIC"
                },
                "available": true,
                "availableForPremiumUsers": true,
                "availableFullWithoutPermission": false,
                "durationMs": 366260,
                "storageDir": "47032_0ec1e87f.313722.1.275704",
                "fileSize": 8790307,
                "normalization": {
                    "gain": -4.92,
                    "peak": 32649
                },
                "previewDurationMs": 30000,
                "artists": [
                    {
                        "id": 11818,
                        "name": "Hans Zimmer",
                        "various": false,
                        "composer": true,
                        "cover": {
                            "type": "from-album-cover",
                            "prefix": "64e21f1a.a.9613697-1",
                            "uri": "avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%"
                        },
                        "genres": []
                    }
                ],
                "albums": [
                    {
                        "id": 3869588,
                        "title": "Пираты Карибского моря: Сундук мертвеца",
                        "version": "Оригинальный саундтрек",
                        "year": 2006,
                        "releaseDate": "2006-01-01T00:00:00+03:00",
                        "coverUri": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                        "ogImage": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                        "genre": "films",
                        "buy": [],
                        "trackCount": 12,
                        "recent": false,
                        "veryImportant": false,
                        "artists": [
                            {
                                "id": 11818,
                                "name": "Hans Zimmer",
                                "various": false,
                                "composer": true,
                                "cover": {
                                    "type": "from-album-cover",
                                    "prefix": "64e21f1a.a.9613697-1",
                                    "uri": "avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%"
                                },
                                "genres": []
                            }
                        ],
                        "labels": [
                            {
                                "id": 905559,
                                "name": "Walt Disney Records"
                            }
                        ],
                        "available": true,
                        "availableForPremiumUsers": true,
                        "availableForMobile": true,
                        "availablePartially": false,
                        "bests": [
                            275712,
                            275711,
                            275704
                        ],
                        "trackPosition": {
                            "volume": 1,
                            "index": 1
                        }
                    }
                ],
                "coverUri": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                "lyricsAvailable": false,
                "type": "music",
                "rememberPosition": false
            }
        },
        {
            "type": "track",
            "track": {
                "id": "30922666",
                "realId": "30922666",
                "title": "Пираты Карибского Моря",
                "major": {
                    "id": 39,
                    "name": "ORCHARD"
                },
                "available": true,
                "availableForPremiumUsers": true,
                "availableFullWithoutPermission": false,
                "durationMs": 87120,
                "storageDir": "107262_ed4024f4.45749725.1.30922666",
                "fileSize": 2091466,
                "normalization": {
                    "gain": -7.22,
                    "peak": 32766
                },
                "previewDurationMs": 30000,
                "artists": [
                    {
                        "id": 1036724,
                        "name": "Antoine Barry",
                        "various": false,
                        "composer": false,
                        "genres": []
                    }
                ],
                "albums": [
                    {
                        "id": 3742447,
                        "title": "кино и телевидения саундтреков",
                        "type": "compilation",
                        "metaType": "music",
                        "year": 2013,
                        "releaseDate": "2013-02-09T00:00:00+04:00",
                        "coverUri": "avatars.yandex.net/get-music-content/33216/a8b97bea.a.3742447-1/%%",
                        "ogImage": "avatars.yandex.net/get-music-content/33216/a8b97bea.a.3742447-1/%%",
                        "genre": "soundtrack",
                        "buy": [],
                        "trackCount": 29,
                        "recent": false,
                        "veryImportant": false,
                        "artists": [
                            {
                                "id": 171,
                                "name": "сборник",
                                "various": true,
                                "composer": false,
                                "cover": {
                                    "type": "from-album-cover",
                                    "prefix": "b1beebeb.a.9369597-1",
                                    "uri": "avatars.yandex.net/get-music-content/2114230/b1beebeb.a.9369597-1/%%"
                                },
                                "genres": []
                            }
                        ],
                        "labels": [
                            {
                                "id": 492790,
                                "name": "Electromate"
                            }
                        ],
                        "available": true,
                        "availableForPremiumUsers": true,
                        "availableForMobile": true,
                        "availablePartially": false,
                        "bests": [
                            30922673,
                            30922670,
                            30922666
                        ],
                        "trackPosition": {
                            "volume": 1,
                            "index": 5
                        }
                    }
                ],
                "coverUri": "avatars.yandex.net/get-music-content/33216/a8b97bea.a.3742447-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/33216/a8b97bea.a.3742447-1/%%",
                "lyricsAvailable": false,
                "type": "music",
                "rememberPosition": false
            }
        },
        {
            "type": "album",
            "album": {
                "id": 3869588,
                "title": "Пираты Карибского моря: Сундук мертвеца",
                "version": "Оригинальный саундтрек",
                "year": 2006,
                "releaseDate": "2006-01-01T00:00:00+03:00",
                "coverUri": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/98892/c59e4e02.a.3869588-1/%%",
                "genre": "films",
                "buy": [],
                "trackCount": 12,
                "recent": false,
                "veryImportant": false,
                "artists": [
                    {
                        "id": 11818,
                        "name": "Hans Zimmer",
                        "various": false,
                        "composer": true,
                        "cover": {
                            "type": "from-album-cover",
                            "prefix": "64e21f1a.a.9613697-1",
                            "uri": "avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%"
                        },
                        "genres": []
                    }
                ],
                "labels": [
                    {
                        "id": 905559,
                        "name": "Walt Disney Records"
                    }
                ],
                "available": true,
                "availableForPremiumUsers": true,
                "availableForMobile": true,
                "availablePartially": false,
                "bests": [
                    275712,
                    275711,
                    275704
                ]
            }
        },
        {
            "type": "album",
            "album": {
                "id": 3869554,
                "title": "Пираты Карибского моря: На краю света",
                "version": "Оригинальный саундтрек",
                "year": 2007,
                "releaseDate": "2007-01-01T00:00:00+03:00",
                "coverUri": "avatars.yandex.net/get-music-content/63210/d1a0cb31.a.3869554-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/63210/d1a0cb31.a.3869554-1/%%",
                "genre": "films",
                "buy": [],
                "trackCount": 13,
                "recent": false,
                "veryImportant": false,
                "artists": [
                    {
                        "id": 11818,
                        "name": "Hans Zimmer",
                        "various": false,
                        "composer": true,
                        "cover": {
                            "type": "from-album-cover",
                            "prefix": "64e21f1a.a.9613697-1",
                            "uri": "avatars.yandex.net/get-music-content/2373979/64e21f1a.a.9613697-1/%%"
                        },
                        "genres": []
                    }
                ],
                "labels": [
                    {
                        "id": 905559,
                        "name": "Walt Disney Records"
                    }
                ],
                "available": true,
                "availableForPremiumUsers": true,
                "availableForMobile": true,
                "availablePartially": false,
                "bests": [
                    292263,
                    292272,
                    292264
                ]
            }
        },
        {
            "type": "artist",
            "artist": {
                "id": "358612",
                "name": "ДДТ",
                "various": false,
                "composer": false,
                "cover": {
                    "type": "from-artist-photos",
                    "prefix": "313bd317.p.358612/",
                    "uri": "avatars.yandex.net/get-music-content/117546/313bd317.p.358612/%%"
                },
                "ogImage": "avatars.yandex.net/get-music-content/117546/313bd317.p.358612/%%",
                "genres": [
                    "rusrock"
                ],
                "counts": {
                    "tracks": 244,
                    "directAlbums": 23,
                    "alsoAlbums": 9,
                    "alsoTracks": 25
                },
                "available": true,
                "ratings": {
                    "week": 64,
                    "month": 54,
                    "day": 67
                },
                "links": [
                    {
                        "title": "ddt.ru",
                        "href": "http://www.ddt.ru/",
                        "type": "official"
                    },
                    {
                        "title": "ddt",
                        "href": "http://vk.com/ddt",
                        "type": "social",
                        "socialNetwork": "vk"
                    },
                    {
                        "title": "ddt_band/",
                        "href": "https://www.instagram.com/ddt_band/",
                        "type": "social",
                        "socialNetwork": "instagram"
                    },
                    {
                        "title": "officialddt/",
                        "href": "https://www.facebook.com/officialddt/",
                        "type": "social",
                        "socialNetwork": "facebook"
                    },
                    {
                        "title": "user/officialddt",
                        "href": "http://www.youtube.com/user/officialddt",
                        "type": "social",
                        "socialNetwork": "youtube"
                    }
                ],
                "ticketsAvailable": false
            }
        },
        {
            "type": "track",
            "track": {
                "id": "65166023",
                "realId": "65166023",
                "title": "Не норм",
                "major": {
                    "id": 39,
                    "name": "ORCHARD"
                },
                "available": true,
                "availableForPremiumUsers": true,
                "availableFullWithoutPermission": false,
                "durationMs": 207180,
                "storageDir": "1771317_6e33c1f9.97810148.2.65166023",
                "fileSize": 4972877,
                "normalization": {
                    "gain": -9.54,
                    "peak": 32766
                },
                "previewDurationMs": 30000,
                "artists": [
                    {
                        "id": 762002,
                        "name": "Anacondaz",
                        "various": false,
                        "composer": false,
                        "cover": {
                            "type": "from-artist-photos",
                            "prefix": "d1c75476.p.762002/",
                            "uri": "avatars.yandex.net/get-music-content/193823/d1c75476.p.762002/%%"
                        },
                        "genres": []
                    }
                ],
                "albums": [
                    {
                        "id": 10528190,
                        "title": "Не норм",
                        "type": "single",
                        "metaType": "music",
                        "year": 2020,
                        "releaseDate": "2020-05-05T00:00:00+03:00",
                        "coverUri": "avatars.yandex.net/get-music-content/2811629/aa73ef2f.a.10528190-1/%%",
                        "ogImage": "avatars.yandex.net/get-music-content/2811629/aa73ef2f.a.10528190-1/%%",
                        "genre": "rusrap",
                        "buy": [],
                        "trackCount": 1,
                        "recent": false,
                        "veryImportant": false,
                        "artists": [
                            {
                                "id": 762002,
                                "name": "Anacondaz",
                                "various": false,
                                "composer": false,
                                "cover": {
                                    "type": "from-artist-photos",
                                    "prefix": "d1c75476.p.762002/",
                                    "uri": "avatars.yandex.net/get-music-content/193823/d1c75476.p.762002/%%"
                                },
                                "genres": []
                            }
                        ],
                        "labels": [
                            {
                                "id": 1974135,
                                "name": "Anacondaz"
                            }
                        ],
                        "available": true,
                        "availableForPremiumUsers": true,
                        "availableForMobile": true,
                        "availablePartially": false,
                        "bests": [],
                        "trackPosition": {
                            "volume": 1,
                            "index": 1
                        }
                    }
                ],
                "coverUri": "avatars.yandex.net/get-music-content/2811629/aa73ef2f.a.10528190-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/2811629/aa73ef2f.a.10528190-1/%%",
                "lyricsAvailable": false,
                "type": "music",
                "rememberPosition": false
            }
        },
        {
            "type": "track",
            "track": {
                "id": "220499",
                "realId": "220499",
                "title": "Riders on the Storm",
                "major": {
                    "id": 4,
                    "name": "WARNER"
                },
                "available": true,
                "availableForPremiumUsers": true,
                "availableFullWithoutPermission": false,
                "durationMs": 434760,
                "storageDir": "235803_90322a3d.53985347.1.220499",
                "fileSize": 10434768,
                "normalization": {
                    "gain": -4.41,
                    "peak": 32766
                },
                "previewDurationMs": 30000,
                "artists": [
                    {
                        "id": 29060,
                        "name": "The Doors",
                        "various": false,
                        "composer": false,
                        "cover": {
                            "type": "from-artist-photos",
                            "prefix": "287ac4b2.p.29060/",
                            "uri": "avatars.yandex.net/get-music-content/33216/287ac4b2.p.29060/%%"
                        },
                        "genres": []
                    }
                ],
                "albums": [
                    {
                        "id": 1957004,
                        "title": "Weird Scenes Inside the Gold Mine",
                        "contentWarning": "explicit",
                        "year": 2014,
                        "releaseDate": "2014-04-19T00:00:00+04:00",
                        "coverUri": "avatars.yandex.net/get-music-content/33216/88203673.a.1957004-1/%%",
                        "ogImage": "avatars.yandex.net/get-music-content/33216/88203673.a.1957004-1/%%",
                        "genre": "rock",
                        "buy": [],
                        "trackCount": 22,
                        "recent": false,
                        "veryImportant": false,
                        "artists": [
                            {
                                "id": 29060,
                                "name": "The Doors",
                                "various": false,
                                "composer": false,
                                "cover": {
                                    "type": "from-artist-photos",
                                    "prefix": "287ac4b2.p.29060/",
                                    "uri": "avatars.yandex.net/get-music-content/33216/287ac4b2.p.29060/%%"
                                },
                                "genres": []
                            }
                        ],
                        "labels": [
                            {
                                "id": 445702,
                                "name": "Rhino Entertainment Company"
                            },
                            {
                                "id": 445444,
                                "name": "Elektra"
                            }
                        ],
                        "available": true,
                        "availableForPremiumUsers": true,
                        "availableForMobile": true,
                        "availablePartially": false,
                        "bests": [
                            220499,
                            221493,
                            220494
                        ],
                        "trackPosition": {
                            "volume": 2,
                            "index": 7
                        }
                    }
                ],
                "coverUri": "avatars.yandex.net/get-music-content/33216/88203673.a.1957004-1/%%",
                "ogImage": "avatars.yandex.net/get-music-content/33216/88203673.a.1957004-1/%%",
                "lyricsAvailable": true,
                "type": "music",
                "rememberPosition": false
            }
        }
    ]
}

Feedback (Сохранение в историю)

Запрос

POST /search/feedback

{
   "absoluteBlockPosition":3,
   "absolutePosition":3,
   "blockPosition":1,
   "blockType":"album",
   "clickType":"navigate",
   "clientNow":"2020-05-05T23:06:49.906+03:00",
   "entityId":"album:4440406",
   "page":0,
   "position":0,
   "query":"beliver",
   "searchRequestId":"music-stable-back-vla-22.vla.yp-c.yandex.net-1588698367499402-7678694071821572946-1588698367505",
   "timestamp":"2020-05-05T23:06:49.906+03:00"
}

Скорей всего часть полей опциональна.
Описание некоторых полей.

  • query - поисковой запрос
  • clickType - тип перехода
    • navigate - переход на страницу альбома, плейлиста, исполнителя и т.п.
    • play - запуск проигрывания трека
    • like - установка отметки "Мне нравится" на трек, альбом, плейлист и т.п.
  • entityId - Идентификатор добавляемого объекта (альбома, трека и т.п.)

Пример ответа

Пример ответа
{
    "invocationInfo": {
        "hostname": "music-stable-back-vla-22.vla.yp-c.yandex.net",
        "req-id": "1588699268380759-10725128718899105902",
        "exec-duration-millis": "18"
    },
    "result": "ok"
}

Очистка истории

Запрос

GET /users/{user_id}/search-history/clear

Пример ответа

Пример ответа
{
    "invocationInfo": {
        "hostname": "music-stable-back-sas-4.sas.yp-c.yandex.net",
        "req-id": "1588699409862176-7852265321543631160",
        "exec-duration-millis": "6"
    },
    "result": "ok"
}
@MarshalX MarshalX added the feature Новая функция или улучшение старой label Feb 2, 2021
@MarshalX MarshalX added the hacktoberfest https://hacktoberfest.com/ label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Новая функция или улучшение старой hacktoberfest https://hacktoberfest.com/
Projects
None yet
Development

No branches or pull requests

2 participants