Skip to content

Commit 055b363

Browse files
committed
add readme and do some refactoring
1 parent 4e9e11f commit 055b363

File tree

4 files changed

+125
-6
lines changed

4 files changed

+125
-6
lines changed

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
11
# yandex2ytmusic
2-
Transfer playlists from yandex.music to youtube music
2+
3+
**[English](README_EN.md)**
4+
5+
Перенос понравившихся треков из Yandex.Музыка в YouTube Music.
6+
7+
## Интерфейс программы
8+
9+
```bash
10+
python main.py --help
11+
usage: main.py [-h] [--yandex YANDEX] [--output OUTPUT] [--youtube YOUTUBE]
12+
13+
Transfer tracks from Yandex.Music to YouTube Music
14+
15+
options:
16+
-h, --help show this help message and exit
17+
--yandex YANDEX Yandex Music token
18+
--output OUTPUT Output json file
19+
--youtube YOUTUBE Youtube Music credentials file. If file not exists, it will be created.
20+
```
21+
22+
## Использование
23+
24+
1. [Получить Yandex Music token](https://yandex-music.readthedocs.io/en/main/token.html). Легче всего это сделать с помошью приложения.
25+
2. Установить зависимости и запустить программу:
26+
```bash
27+
pip install -r requirements.txt
28+
python main.py --yandex <Yandex Music token>
29+
```
30+
3. При запуске программы перейти по предложенной ссылке для авторизации в YouTube Music, разрешить доступ к аккаунту и нажать `Enter` для продолжения.
31+
4. Дождаться завершения работы программы. Программа также экспортирует музыку Json в файл:
32+
33+
```json
34+
{
35+
// понравившиеся треки в Yandex Music
36+
"liked_tracks":[
37+
{
38+
"artist": "Исполнитнль",
39+
"name": "Название трека"
40+
}
41+
],
42+
// треки, которые не были найдены при переносе
43+
"not_found":[],
44+
// треки, при переносе которых произошла ошибка
45+
"errors":[]
46+
}
47+
```
48+
49+
## Используемые ресурсы
50+
51+
- yandex-music - не официальное python API Yandex.Music
52+
- ytmusicapi - не официальное python API YouTube Music
53+
54+
### P.s.
55+
56+
Написал этот скрипт, так как не нашел ничего подобного в сети.
57+
Буду рад pull реквестам и звездочкам :-)
58+

README_EN.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# yandex2ytmusic
2+
3+
**[Русский язык](README.md)**
4+
5+
Transfer liked tracks from Yandex.Music to YouTube Music.
6+
7+
## Program Interface
8+
9+
```bash
10+
python main.py --help
11+
usage: main.py [-h] [--yandex YANDEX] [--output OUTPUT] [--youtube YOUTUBE]
12+
13+
Transfer tracks from Yandex.Music to YouTube Music
14+
15+
options:
16+
-h, --help show this help message and exit
17+
--yandex YANDEX Yandex Music token
18+
--output OUTPUT Output json file
19+
--youtube YOUTUBE Youtube Music credentials file. If file not exists, it will be created.
20+
```
21+
22+
## Usage
23+
24+
1. [Get Yandex Music token](https://yandex-music.readthedocs.io/en/main/token.html). It is easiest to do this with the application.
25+
2. Install dependencies and run the program:
26+
27+
```bash
28+
pip install -r requirements.txt
29+
python main.py --yandex <Yandex Music token>
30+
```
31+
32+
3. When starting the program, follow the provided link to authorize in YouTube Music, allow access to the account, and press `Enter` to continue.
33+
4. Wait for the program to finish. The program will also export music data to a JSON file:
34+
35+
```json
36+
{
37+
// liked tracks in Yandex Music
38+
"liked_tracks":[
39+
{
40+
"artist": "Artist",
41+
"name": "Track Name"
42+
}
43+
],
44+
// tracks not found during transfer
45+
"not_found":[],
46+
// tracks that encountered an error during transfer
47+
"errors":[]
48+
}
49+
```
50+
51+
## Resources Used
52+
53+
- yandex-music - unofficial python API for Yandex.Music
54+
- ytmusicapi - unofficial python API for YouTube Music
55+
56+
### P.S.
57+
58+
I wrote this script because I couldn't find anything similar online.
59+
I'll be happy with pull requests and stars :-)

core/youtube.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from ytmusicapi import YTMusic, setup_oauth
2-
from .track import Track
3-
from typing import List, Tuple
41
import os
2+
53
from tqdm import tqdm
4+
from ytmusicapi import YTMusic, setup_oauth
5+
from typing import List, Tuple
6+
from .track import Track
67

78

89
class YoutubeImoirter:

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import argparse
2+
import json
3+
24
from core import YandexMusicExporter
35
from core import YoutubeImoirter
4-
import json
56

67

78
def parse_args() -> argparse.Namespace:
8-
parser = argparse.ArgumentParser(description='Train a model')
9+
parser = argparse.ArgumentParser(
10+
description='Transfer tracks from Yandex.Music to YouTube Music'
11+
)
912
parser.add_argument(
1013
'--yandex', type=str, help='Yandex Music token'
1114
)

0 commit comments

Comments
 (0)