pars-hitmotop 0.1.1__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {pars_hitmotop-0.1.1 → pars_hitmotop-1.0.1}/PKG-INFO +64 -13
  2. pars_hitmotop-0.1.1/pars_hitmotop.egg-info/PKG-INFO → pars_hitmotop-1.0.1/README.md +48 -24
  3. pars_hitmotop-1.0.1/pars_hitmotop.egg-info/PKG-INFO +118 -0
  4. pars_hitmotop-1.0.1/pars_hitmotop.egg-info/SOURCES.txt +13 -0
  5. pars_hitmotop-1.0.1/pars_hitmotop.egg-info/requires.txt +4 -0
  6. pars_hitmotop-1.0.1/pars_hitmotop.egg-info/top_level.txt +1 -0
  7. {pars_hitmotop-0.1.1/pars_hitmotop → pars_hitmotop-1.0.1/parse_hitmos}/__init__.py +1 -1
  8. pars_hitmotop-1.0.1/parse_hitmos/entered_tracks.py +125 -0
  9. {pars_hitmotop-0.1.1/pars_hitmotop → pars_hitmotop-1.0.1/parse_hitmos}/excepts.py +8 -0
  10. pars_hitmotop-1.0.1/parse_hitmos/how_to_use.py +152 -0
  11. pars_hitmotop-1.0.1/parse_hitmos/rating_tracks_count.py +113 -0
  12. pars_hitmotop-1.0.1/parse_hitmos/rating_tracks_page.py +172 -0
  13. pars_hitmotop-1.0.1/setup.py +33 -0
  14. pars_hitmotop-0.1.1/README.md +0 -51
  15. pars_hitmotop-0.1.1/pars_hitmotop/entered_tracks.py +0 -121
  16. pars_hitmotop-0.1.1/pars_hitmotop/how_to_use.py +0 -58
  17. pars_hitmotop-0.1.1/pars_hitmotop/rating_tracks_count.py +0 -104
  18. pars_hitmotop-0.1.1/pars_hitmotop/rating_tracks_page.py +0 -150
  19. pars_hitmotop-0.1.1/pars_hitmotop.egg-info/SOURCES.txt +0 -13
  20. pars_hitmotop-0.1.1/pars_hitmotop.egg-info/requires.txt +0 -5
  21. pars_hitmotop-0.1.1/pars_hitmotop.egg-info/top_level.txt +0 -1
  22. pars_hitmotop-0.1.1/setup.py +0 -29
  23. {pars_hitmotop-0.1.1 → pars_hitmotop-1.0.1}/pars_hitmotop.egg-info/dependency_links.txt +0 -0
  24. {pars_hitmotop-0.1.1 → pars_hitmotop-1.0.1}/setup.cfg +0 -0
@@ -1,26 +1,39 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pars_hitmotop
3
- Version: 0.1.1
3
+ Version: 1.0.1
4
4
  Home-page: https://github.com/JoyHubN/pars_hitmos
5
- Download-URL: https://github.com/JoyHubN/pars_hitmos/arhive/v0.1.1.zip
6
- Author: Joy_079
5
+ Download-URL: https://github.com/JoyHubN/pars_hitmos/arhive/v1.0.1.zip
6
+ Author: JoyHubN
7
7
  Author-email: Prufu@yandex.ru
8
8
  Classifier: Programming Language :: Python
9
- Classifier: Programming Language :: Python :: 3.7
10
9
  Classifier: Programming Language :: Python :: 3.8
11
10
  Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: Implementation :: PyPy
15
14
  Description-Content-Type: text/markdown
15
+ Requires-Dist: beautifulsoup4==4.13.4
16
+ Requires-Dist: fake-useragent==2.2.0
17
+ Requires-Dist: requests==2.32.4
18
+ Requires-Dist: tenacity==9.1.2
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: download-url
25
+ Dynamic: home-page
26
+ Dynamic: requires-dist
16
27
 
17
28
  # Оглавление
18
- 0. [Оглавление](https://github.com/PY079/pars_hitmotop#оглавление)
19
29
  1. [Что именно парсит?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-именно-парсит)
20
30
  2. [Как использовать модуль entered_tracks](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-entered_tracks)
21
31
  3. [Как использовать модуль rating_tracks_count](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_count)
22
32
  4. [Как использовать модуль rating_tracks_page](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_page)
23
33
  5. [Что можно достать при запросе?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-можно-достать-при-запросе)
34
+ 6. [Сколько времени понадобиться для запросов?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#сколько-времени-понадобиться-для-получения-всех-нужных-данных-с-сайта)
35
+ * [Рейтинговые треки (по страницам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-по-страницам)
36
+ * [Рейтинговые треки и введенные треки (по трекам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-и-введенные-треки-по-трекам)
24
37
  ____
25
38
  Этот проект парсит [музыкальный сайт](https://hitmos.me/)
26
39
  ____
@@ -31,22 +44,22 @@ ____
31
44
  ____
32
45
  ## Как использовать модуль *entered_tracks*
33
46
  ```
34
- from pars_hitmotop.entered_tracks import EnteredTrack
35
- result=EnteredTrack('linkin park',10)
47
+ from parse_hitmos.entered_tracks import EnteredTrack
48
+ result = EnteredTrack('linkin park',10)
36
49
  ```
37
50
  1 аргументом (music_name) передается название песни или автора. 2 Аргументом (count) передается количество треков
38
51
  ____
39
52
  ## Как использовать модуль *rating_tracks_count*
40
53
  ```
41
- from pars_hitmotop.rating_tracks_count import RatingCount
42
- result=RatingCount(10)
54
+ from parse_hitmos.rating_tracks_count import RatingCount
55
+ result = RatingCount(10)
43
56
  ```
44
57
  1 аргументом (count) передается количество песен
45
58
  ____
46
59
  ## Как использовать модуль *rating_tracks_page*
47
60
  ```
48
- from pars_hitmotop.rating_tracks_page import RatingPage
49
- result=RatingPage(10)
61
+ from parse_hitmos.rating_tracks_page import RatingPage
62
+ result = RatingPage(10)
50
63
  ```
51
64
  1 аргументом (count) передается количество страниц (max 11)
52
65
  ____
@@ -62,6 +75,44 @@ ____
62
75
  |result.get_picture_url|Получить ссылку на обложку трека|
63
76
  |result.get_url_track|Получить ссылку трек|
64
77
  |result.get_all|Получить все данные в виде словаря|
65
- |result.get_author_title|Получить лист в виде автор - название|
78
+ |result.get_author_title|Получить лист в виде автор название|
79
+
80
+ ____
81
+ # Сколько времени понадобиться для получения всех нужных данных с сайта
82
+ ## Рейтинговые треки (по страницам)
83
+
84
+ | Время | Прямые ссылки | Кол-во треков |
85
+ |:---------|:---------|:---------|
86
+ | 5с — 6с | `False` | 11 страниц (~528) |
87
+ | 5с — 6с | `False` | 10 страниц (~480) |
88
+ | 4с — 6с | `False` | 9 страниц (~432) |
89
+ | 4с — 6с | `False` | 8 страниц (~384) |
90
+ | 4с — 5с | `False` | 7 страниц (~336) |
91
+ | 3с — 4с | `False` | 6 страниц (~288) |
92
+ | 3с — 4с | `False` | 5 страниц (~240) |
93
+ | 2с — 4с | `False` | 4 страниц (~192) |
94
+ | 2с — 3с | `False` | 3 страниц (~144) |
95
+ | 1с — 2с | `False` | 2 страниц (~96) |
96
+ | 1с — 2c | `False` | 1 страниц (~48) |
97
+ | 126с — 223с (~2.1м — ~4м) | `True` | 11 страниц (~528) |
98
+ | 116с — 139с (~2м) | `True` | 10 страниц (~480) |
99
+ | 106с — 131с (~1.6м — 2м) | `True` | 9 страниц (~432) |
100
+ | 97с — 185с (~1.6м — 2м) | `True` | 8 страниц (~384) |
101
+ | 76с — 94с (~1.2м — ~1.5м) | `True` | 7 страниц (~336) |
102
+ | 66с — 74с (~1м — ~1.23) | `True` | 6 страниц (~288) |
103
+ | 54с — 61с | `True` | 5 страниц (~240) |
104
+ | 43с — 49с | `True` | 4 страниц (~192) |
105
+ | 32с — 49с | `True` | 3 страниц (~144) |
106
+ | 25с — 27с | `True` | 2 страниц (~96) |
107
+ | 14с — 20с | `True` | 1 страниц (~48) |
108
+
109
+
110
+ ## Рейтинговые треки и введенные треки (по трекам)
111
+ | Время | Прямые ссылки | Кол-во треков |
112
+ |:---------|:---------|:---------|
113
+ | 1с — ~3с | `False` | 48 |
114
+ | 1с — 2с | `False` | 1 |
115
+ | 23с — 28с | `True` | 48 |
116
+ | 3с — 4с | `True` | 1 |
66
117
 
67
118
  ____
@@ -1,26 +1,12 @@
1
- Metadata-Version: 2.1
2
- Name: pars-hitmotop
3
- Version: 0.1.1
4
- Home-page: https://github.com/JoyHubN/pars_hitmos
5
- Download-URL: https://github.com/JoyHubN/pars_hitmos/arhive/v0.1.1.zip
6
- Author: Joy_079
7
- Author-email: Prufu@yandex.ru
8
- Classifier: Programming Language :: Python
9
- Classifier: Programming Language :: Python :: 3.7
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: Implementation :: PyPy
15
- Description-Content-Type: text/markdown
16
-
17
1
  # Оглавление
18
- 0. [Оглавление](https://github.com/PY079/pars_hitmotop#оглавление)
19
2
  1. [Что именно парсит?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-именно-парсит)
20
3
  2. [Как использовать модуль entered_tracks](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-entered_tracks)
21
4
  3. [Как использовать модуль rating_tracks_count](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_count)
22
5
  4. [Как использовать модуль rating_tracks_page](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_page)
23
6
  5. [Что можно достать при запросе?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-можно-достать-при-запросе)
7
+ 6. [Сколько времени понадобиться для запросов?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#сколько-времени-понадобиться-для-получения-всех-нужных-данных-с-сайта)
8
+ * [Рейтинговые треки (по страницам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-по-страницам)
9
+ * [Рейтинговые треки и введенные треки (по трекам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-и-введенные-треки-по-трекам)
24
10
  ____
25
11
  Этот проект парсит [музыкальный сайт](https://hitmos.me/)
26
12
  ____
@@ -31,22 +17,22 @@ ____
31
17
  ____
32
18
  ## Как использовать модуль *entered_tracks*
33
19
  ```
34
- from pars_hitmotop.entered_tracks import EnteredTrack
35
- result=EnteredTrack('linkin park',10)
20
+ from parse_hitmos.entered_tracks import EnteredTrack
21
+ result = EnteredTrack('linkin park',10)
36
22
  ```
37
23
  1 аргументом (music_name) передается название песни или автора. 2 Аргументом (count) передается количество треков
38
24
  ____
39
25
  ## Как использовать модуль *rating_tracks_count*
40
26
  ```
41
- from pars_hitmotop.rating_tracks_count import RatingCount
42
- result=RatingCount(10)
27
+ from parse_hitmos.rating_tracks_count import RatingCount
28
+ result = RatingCount(10)
43
29
  ```
44
30
  1 аргументом (count) передается количество песен
45
31
  ____
46
32
  ## Как использовать модуль *rating_tracks_page*
47
33
  ```
48
- from pars_hitmotop.rating_tracks_page import RatingPage
49
- result=RatingPage(10)
34
+ from parse_hitmos.rating_tracks_page import RatingPage
35
+ result = RatingPage(10)
50
36
  ```
51
37
  1 аргументом (count) передается количество страниц (max 11)
52
38
  ____
@@ -62,6 +48,44 @@ ____
62
48
  |result.get_picture_url|Получить ссылку на обложку трека|
63
49
  |result.get_url_track|Получить ссылку трек|
64
50
  |result.get_all|Получить все данные в виде словаря|
65
- |result.get_author_title|Получить лист в виде автор - название|
51
+ |result.get_author_title|Получить лист в виде автор название|
52
+
53
+ ____
54
+ # Сколько времени понадобиться для получения всех нужных данных с сайта
55
+ ## Рейтинговые треки (по страницам)
56
+
57
+ | Время | Прямые ссылки | Кол-во треков |
58
+ |:---------|:---------|:---------|
59
+ | 5с — 6с | `False` | 11 страниц (~528) |
60
+ | 5с — 6с | `False` | 10 страниц (~480) |
61
+ | 4с — 6с | `False` | 9 страниц (~432) |
62
+ | 4с — 6с | `False` | 8 страниц (~384) |
63
+ | 4с — 5с | `False` | 7 страниц (~336) |
64
+ | 3с — 4с | `False` | 6 страниц (~288) |
65
+ | 3с — 4с | `False` | 5 страниц (~240) |
66
+ | 2с — 4с | `False` | 4 страниц (~192) |
67
+ | 2с — 3с | `False` | 3 страниц (~144) |
68
+ | 1с — 2с | `False` | 2 страниц (~96) |
69
+ | 1с — 2c | `False` | 1 страниц (~48) |
70
+ | 126с — 223с (~2.1м — ~4м) | `True` | 11 страниц (~528) |
71
+ | 116с — 139с (~2м) | `True` | 10 страниц (~480) |
72
+ | 106с — 131с (~1.6м — 2м) | `True` | 9 страниц (~432) |
73
+ | 97с — 185с (~1.6м — 2м) | `True` | 8 страниц (~384) |
74
+ | 76с — 94с (~1.2м — ~1.5м) | `True` | 7 страниц (~336) |
75
+ | 66с — 74с (~1м — ~1.23) | `True` | 6 страниц (~288) |
76
+ | 54с — 61с | `True` | 5 страниц (~240) |
77
+ | 43с — 49с | `True` | 4 страниц (~192) |
78
+ | 32с — 49с | `True` | 3 страниц (~144) |
79
+ | 25с — 27с | `True` | 2 страниц (~96) |
80
+ | 14с — 20с | `True` | 1 страниц (~48) |
81
+
82
+
83
+ ## Рейтинговые треки и введенные треки (по трекам)
84
+ | Время | Прямые ссылки | Кол-во треков |
85
+ |:---------|:---------|:---------|
86
+ | 1с — ~3с | `False` | 48 |
87
+ | 1с — 2с | `False` | 1 |
88
+ | 23с — 28с | `True` | 48 |
89
+ | 3с — 4с | `True` | 1 |
66
90
 
67
91
  ____
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: pars_hitmotop
3
+ Version: 1.0.1
4
+ Home-page: https://github.com/JoyHubN/pars_hitmos
5
+ Download-URL: https://github.com/JoyHubN/pars_hitmos/arhive/v1.0.1.zip
6
+ Author: JoyHubN
7
+ Author-email: Prufu@yandex.ru
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: beautifulsoup4==4.13.4
16
+ Requires-Dist: fake-useragent==2.2.0
17
+ Requires-Dist: requests==2.32.4
18
+ Requires-Dist: tenacity==9.1.2
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: download-url
25
+ Dynamic: home-page
26
+ Dynamic: requires-dist
27
+
28
+ # Оглавление
29
+ 1. [Что именно парсит?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-именно-парсит)
30
+ 2. [Как использовать модуль entered_tracks](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-entered_tracks)
31
+ 3. [Как использовать модуль rating_tracks_count](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_count)
32
+ 4. [Как использовать модуль rating_tracks_page](https://github.com/PY079/pars_hitmotop/blob/main/README.md#как-использовать-модуль-rating_tracks_page)
33
+ 5. [Что можно достать при запросе?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-можно-достать-при-запросе)
34
+ 6. [Сколько времени понадобиться для запросов?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#сколько-времени-понадобиться-для-получения-всех-нужных-данных-с-сайта)
35
+ * [Рейтинговые треки (по страницам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-по-страницам)
36
+ * [Рейтинговые треки и введенные треки (по трекам)](https://github.com/JoyHubN/pars_hitmos/blob/main/README.md#рейтинговые-треки-и-введенные-треки-по-трекам)
37
+ ____
38
+ Этот проект парсит [музыкальный сайт](https://hitmos.me/)
39
+ ____
40
+ # Что именно парсит?
41
+ 1. [Рейтинговые треки](https://hitmos.me/songs/top-rated) от 1 до 48;
42
+ 2. Тоже [рейтинговые треки](https://hitmos.me/songs/top-rated) но можно выбрать количество страниц, с которых будет произведен парсинг;
43
+ 3. Треки введенные пользователем. Парсит от 1 трека до конечной страницы (на одной странице 48 треков)
44
+ ____
45
+ ## Как использовать модуль *entered_tracks*
46
+ ```
47
+ from parse_hitmos.entered_tracks import EnteredTrack
48
+ result = EnteredTrack('linkin park',10)
49
+ ```
50
+ 1 аргументом (music_name) передается название песни или автора. 2 Аргументом (count) передается количество треков
51
+ ____
52
+ ## Как использовать модуль *rating_tracks_count*
53
+ ```
54
+ from parse_hitmos.rating_tracks_count import RatingCount
55
+ result = RatingCount(10)
56
+ ```
57
+ 1 аргументом (count) передается количество песен
58
+ ____
59
+ ## Как использовать модуль *rating_tracks_page*
60
+ ```
61
+ from parse_hitmos.rating_tracks_page import RatingPage
62
+ result = RatingPage(10)
63
+ ```
64
+ 1 аргументом (count) передается количество страниц (max 11)
65
+ ____
66
+ # Что можно достать при запросе?
67
+ Все возвращается в виде list
68
+ | Метод | Описание |
69
+ |----------------|:---------|
70
+ | result.get_author | Получить автора трека|
71
+ |result.get_title| Получить название трека|
72
+ |result.get_url_down|Получить ссылку на скачивание трека|
73
+ |result.direct_download_link|Получить прямую ссылку на скачивание трека|
74
+ |result.get_duration|Получить продолжительность трека|
75
+ |result.get_picture_url|Получить ссылку на обложку трека|
76
+ |result.get_url_track|Получить ссылку трек|
77
+ |result.get_all|Получить все данные в виде словаря|
78
+ |result.get_author_title|Получить лист в виде автор — название|
79
+
80
+ ____
81
+ # Сколько времени понадобиться для получения всех нужных данных с сайта
82
+ ## Рейтинговые треки (по страницам)
83
+
84
+ | Время | Прямые ссылки | Кол-во треков |
85
+ |:---------|:---------|:---------|
86
+ | 5с — 6с | `False` | 11 страниц (~528) |
87
+ | 5с — 6с | `False` | 10 страниц (~480) |
88
+ | 4с — 6с | `False` | 9 страниц (~432) |
89
+ | 4с — 6с | `False` | 8 страниц (~384) |
90
+ | 4с — 5с | `False` | 7 страниц (~336) |
91
+ | 3с — 4с | `False` | 6 страниц (~288) |
92
+ | 3с — 4с | `False` | 5 страниц (~240) |
93
+ | 2с — 4с | `False` | 4 страниц (~192) |
94
+ | 2с — 3с | `False` | 3 страниц (~144) |
95
+ | 1с — 2с | `False` | 2 страниц (~96) |
96
+ | 1с — 2c | `False` | 1 страниц (~48) |
97
+ | 126с — 223с (~2.1м — ~4м) | `True` | 11 страниц (~528) |
98
+ | 116с — 139с (~2м) | `True` | 10 страниц (~480) |
99
+ | 106с — 131с (~1.6м — 2м) | `True` | 9 страниц (~432) |
100
+ | 97с — 185с (~1.6м — 2м) | `True` | 8 страниц (~384) |
101
+ | 76с — 94с (~1.2м — ~1.5м) | `True` | 7 страниц (~336) |
102
+ | 66с — 74с (~1м — ~1.23) | `True` | 6 страниц (~288) |
103
+ | 54с — 61с | `True` | 5 страниц (~240) |
104
+ | 43с — 49с | `True` | 4 страниц (~192) |
105
+ | 32с — 49с | `True` | 3 страниц (~144) |
106
+ | 25с — 27с | `True` | 2 страниц (~96) |
107
+ | 14с — 20с | `True` | 1 страниц (~48) |
108
+
109
+
110
+ ## Рейтинговые треки и введенные треки (по трекам)
111
+ | Время | Прямые ссылки | Кол-во треков |
112
+ |:---------|:---------|:---------|
113
+ | 1с — ~3с | `False` | 48 |
114
+ | 1с — 2с | `False` | 1 |
115
+ | 23с — 28с | `True` | 48 |
116
+ | 3с — 4с | `True` | 1 |
117
+
118
+ ____
@@ -0,0 +1,13 @@
1
+ README.md
2
+ setup.py
3
+ pars_hitmotop.egg-info/PKG-INFO
4
+ pars_hitmotop.egg-info/SOURCES.txt
5
+ pars_hitmotop.egg-info/dependency_links.txt
6
+ pars_hitmotop.egg-info/requires.txt
7
+ pars_hitmotop.egg-info/top_level.txt
8
+ parse_hitmos/__init__.py
9
+ parse_hitmos/entered_tracks.py
10
+ parse_hitmos/excepts.py
11
+ parse_hitmos/how_to_use.py
12
+ parse_hitmos/rating_tracks_count.py
13
+ parse_hitmos/rating_tracks_page.py
@@ -0,0 +1,4 @@
1
+ beautifulsoup4==4.13.4
2
+ fake-useragent==2.2.0
3
+ requests==2.32.4
4
+ tenacity==9.1.2
@@ -0,0 +1 @@
1
+ parse_hitmos
@@ -3,4 +3,4 @@ from .rating_tracks_count import RatingCount
3
3
  from .rating_tracks_page import RatingPage
4
4
 
5
5
  __author__ = 'Joy_079'
6
- __version__= '0.0.5'
6
+ __version__= '1.0.0'
@@ -0,0 +1,125 @@
1
+ from bs4 import BeautifulSoup
2
+ from urllib.parse import quote
3
+
4
+ from parse_hitmos.tools.retry_func import safe_get, safe_head
5
+ from parse_hitmos.tools.headers import get_headers
6
+ from parse_hitmos.tools.base_session import BaseSessionHandlerInputTracks
7
+ from parse_hitmos.excepts import NoFoundTrack, MaxTrack, MusicName, AmountErr, RedirectErr
8
+ from parse_hitmos.tools.replace_symbol import replace_symbol_in_title
9
+
10
+
11
+ class EnteredTrack(BaseSessionHandlerInputTracks):
12
+ """
13
+ Треки из запроса\n
14
+ :param music_name: Название и автор трека в одной строке.
15
+ :param amount: Количество треков, которое нужно вывести. Max 48.
16
+ :param get_redirect_url: True-получить прямую ссылку на скачивание трека, но увеличивает время выполнения\n
17
+ :type music_name: str
18
+ :type amount: int
19
+ :type get_redirect_url: bool
20
+
21
+ .. note:: Установка get_redirect_url=True может значительно увеличить время выполнения.\n
22
+ Методы:\n
23
+ - get_author -> list[str]: автор трека
24
+ - get_title -> list[str]: название трека
25
+ - get_url_down -> list[str]: ссылка на скачивание трека
26
+ - direct_download_link -> list[str]: прямая ссылка на скачивание трека
27
+ - get_duration -> list[str]: длительность трека
28
+ - get_picture_url -> list[str]: ссылка на обложку трека
29
+ - get_url_track -> list[str]: ссылка на трек
30
+ """
31
+
32
+ def __init__(self, music_name:str, amount: int, get_redirect_url=False):
33
+ if not isinstance(music_name, str): raise MusicName
34
+ if not isinstance(amount, int): raise AmountErr
35
+ if not isinstance(get_redirect_url, bool): raise RedirectErr
36
+
37
+ self.music_name = music_name
38
+ self.amount = int(amount)
39
+
40
+ super().__init__()
41
+
42
+ self.get_redirect_url = get_redirect_url
43
+ self.get_info
44
+
45
+ @property
46
+ def get_info(self):
47
+
48
+ if self.amount > 48:
49
+ raise MaxTrack
50
+ else:
51
+
52
+
53
+ __headers = get_headers()
54
+ __search_url = self.search_url+quote(self.music_name)
55
+ __response = safe_get(self, __search_url, headers=__headers)
56
+ __soup = BeautifulSoup(__response.text, "html.parser")
57
+
58
+ if __soup.find('h2', class_='tracks__title content-item-title'):
59
+ raise NoFoundTrack
60
+
61
+ _track_titles = [i.text.strip() for i in __soup.find_all("div", class_="track__title")]
62
+ _track_artists = [i.text.strip() for i in __soup.find_all("div", class_="track__desc")]
63
+ _track_duration = [i.text.strip() for i in __soup.find_all("div", class_="track__fulltime")]
64
+ _track_pictures = [f"{i.get('style')[23:-3]}" for i in __soup.find_all("div", class_="track__img")]
65
+ _track_urls_dow = [i.get('href') for i in __soup.find_all('a', class_='track__download-btn')]
66
+ _track_url = [f"{self.base_url[:-1]}{tra_url.get('href')}" for tra_url in __soup.find_all('a', class_='track__info-l')]
67
+
68
+
69
+ _items = []
70
+ for idx in range(self.amount if len(_track_titles) > self.amount else len(_track_titles)):
71
+ if self.get_redirect_url and len(_track_urls_dow[idx]) > 0:
72
+ direct_download_link = safe_head(self, _track_urls_dow[idx], headers=__headers, allow_redirects=True).url
73
+ else: direct_download_link = None
74
+
75
+ item = {
76
+ 'author': _track_artists[idx],
77
+ 'title': replace_symbol_in_title(_track_titles[idx]),
78
+ 'url_down': _track_urls_dow[idx],
79
+ 'direct_download_link': direct_download_link,
80
+ 'duration_track': _track_duration[idx],
81
+ 'picture_url': _track_pictures[idx],
82
+ 'url_track': _track_url[idx]
83
+ }
84
+ _items.append(item)
85
+
86
+ self.count_tracks = len(_items)
87
+ self.data = {"items": _items}
88
+ return self.data
89
+
90
+ @property
91
+ def get_author(self) -> list[str]:
92
+ return [item['author'] for item in self.data['items']]
93
+
94
+ @property
95
+ def get_title(self) -> list[str]:
96
+ return [item['title'] for item in self.data['items']]
97
+
98
+ @property
99
+ def get_url_down(self) -> list[str]:
100
+ return [item['url_down'] for item in self.data['items']]
101
+
102
+ @property
103
+ def direct_download_link(self) -> list[str]:
104
+ return [item['direct_download_link'] for item in self.data['items']]
105
+
106
+ @property
107
+ def get_duration(self) -> list[str]:
108
+ return [item['duration_track'] for item in self.data['items']]
109
+
110
+ @property
111
+ def get_picture_url(self) -> list[str]:
112
+ return [item['picture_url'] for item in self.data['items']]
113
+
114
+ @property
115
+ def get_url_track(self) -> list[str]:
116
+ return [item['url_track'] for item in self.data['items']]
117
+
118
+ @property
119
+ def get_all(self) -> list[str]: return self.data
120
+
121
+ @property
122
+ def get_author_title(self) -> list[str]:
123
+ __author = self.get_author
124
+ __title = self.get_title
125
+ return [f'{__author[i]} - {__title[i]}' for i in range(self.count_tracks)]
@@ -63,5 +63,13 @@ class RedirectErr(Exception):
63
63
  def __init__(self):
64
64
  self.err = 'Accepts only the bool type'
65
65
 
66
+ def __str__(self):
67
+ return self.err
68
+
69
+
70
+ class MaxAttempts(Exception):
71
+ def __init__(self, max_attempts):
72
+ self.err = f"Failed to create session after {max_attempts} attempts"
73
+
66
74
  def __str__(self):
67
75
  return self.err
@@ -0,0 +1,152 @@
1
+ import sys, os, urllib.request, pathlib
2
+ from parse_hitmos import EnteredTrack, RatingPage, RatingCount
3
+ from parse_hitmos.tools.headers import get_headers
4
+
5
+ def downl(url, info):
6
+ req = urllib.request.Request(url, headers=get_headers())
7
+ with urllib.request.urlopen(req) as response, open(f'{PATH_DOWNLOAD_MUSIC}/{info}.mp3', "wb") as f:
8
+ f.write(response.read())
9
+
10
+ cwd = pathlib.Path.cwd()
11
+ PATH_DOWNLOAD_MUSIC = pathlib.Path.joinpath(cwd, 'download_music')
12
+
13
+ if not os.path.isdir(PATH_DOWNLOAD_MUSIC): os.mkdir(PATH_DOWNLOAD_MUSIC)
14
+
15
+ result_entered_tracks = EnteredTrack('linkin park', 10, True)
16
+ result_rating_count = RatingCount(1, True)
17
+ result_rating_page = RatingPage(1, True)
18
+
19
+ def print_new_line():
20
+ print('\n------------------------\n')
21
+
22
+
23
+ # Получить количество треков
24
+ amount_ET = result_entered_tracks.count_tracks
25
+ amount_RC = result_rating_count.count_tracks
26
+ amount_RP = result_rating_page.count_tracks
27
+
28
+ print(f'{amount_ET=}\n{amount_RC=}\n{amount_RP=}\n')
29
+ print_new_line()
30
+
31
+ # Получить автора треков
32
+ author_ET = result_entered_tracks.get_author
33
+ author_RC = result_rating_count.get_author
34
+ author_RP = result_rating_page.get_author
35
+
36
+ print(f'{author_ET=}\n{author_RC=}\n{author_RP=}\n')
37
+ print_new_line()
38
+
39
+ # Получить названия треков
40
+ title_ET = result_entered_tracks.get_title
41
+ title_RC = result_rating_count.get_title
42
+ title_RP = result_rating_page.get_title
43
+
44
+ print(f'{title_ET=}\n{title_RC=}\n{title_RP=}\n')
45
+ print_new_line()
46
+
47
+
48
+ # Получить ссылки на скачивания треков
49
+ url_down_ET = result_entered_tracks.get_url_down
50
+ url_down_RC = result_rating_count.get_url_down
51
+ url_down_RP = result_rating_page.get_url_down
52
+
53
+ print(f'{url_down_ET=}\n{url_down_RC=}\n{url_down_RP=}\n')
54
+ print_new_line()
55
+
56
+ # Получить прямую ссылку на скачивание треков
57
+ url_down_dir_ET = result_entered_tracks.direct_download_link
58
+ url_down_dir_RC = result_rating_count.direct_download_link
59
+ url_down_dir_RP = result_rating_page.direct_download_link
60
+
61
+ print(f'{url_down_dir_ET=}\n{url_down_dir_RC=}\n{url_down_dir_RP=}\n')
62
+ print_new_line()
63
+
64
+ # Получить длительность треков
65
+ duration_ET = result_entered_tracks.get_duration
66
+ duration_RC = result_rating_count.get_duration
67
+ duration_RP = result_rating_page.get_duration
68
+
69
+ print(f'{duration_ET=}\n{duration_RC=}\n{duration_RP=}\n')
70
+ print_new_line()
71
+
72
+ # Получить обложки треков
73
+ picture_ET = result_entered_tracks.get_picture_url
74
+ picture_RC = result_rating_count.get_picture_url
75
+ picture_RP = result_rating_page.get_picture_url
76
+
77
+ print(f'{picture_ET=}\n{picture_RC=}\n{picture_RP=}\n')
78
+ print_new_line()
79
+
80
+ # Получить ссылки на треки
81
+ url_tracks_ET = result_entered_tracks.get_url_track
82
+ url_tracks_RC = result_rating_count.get_url_track
83
+ url_tracks_RP = result_rating_page.get_url_track
84
+
85
+ print(f'{url_tracks_ET=}\n{url_tracks_RC=}\n{url_tracks_RP=}\n')
86
+ print_new_line()
87
+
88
+
89
+ # Получить все данные
90
+ all_data_ET = result_entered_tracks.get_all
91
+ all_data_RC = result_rating_count.get_all
92
+ all_data_RP = result_rating_page.get_all
93
+
94
+ print(f'{all_data_ET=}\n{all_data_RC=}\n{all_data_RP=}\n')
95
+ print_new_line()
96
+
97
+
98
+ # Получить автор - название
99
+ info_ET = result_entered_tracks.get_author_title
100
+ info_RC = result_rating_count.get_author_title
101
+ info_RP = result_rating_page.get_author_title
102
+
103
+ print(f'{info_ET=}\n{info_RC=}\n{info_RP=}\n')
104
+ print_new_line()
105
+
106
+ # Скачать найденные треки треки
107
+ def down_music_ET():
108
+ for _ in range(amount_ET):
109
+
110
+ if url_down_dir_ET[_] != None:
111
+ print(info_ET[_])
112
+ print(f'Скачиваю по ссылке: {url_down_dir_ET[_]}')
113
+ downl(url_down_dir_ET[_], info_ET[_])
114
+
115
+ else:
116
+ print(title_ET[_])
117
+ print(f'Скачиваю hitmotop\n{url_tracks_ET[_]}')
118
+ downl(url_tracks_ET[_], info_ET[_])
119
+
120
+ def down_music_RC():
121
+ for _ in range(amount_RC):
122
+
123
+ if url_down_dir_RC[_] != None:
124
+ print(info_RC[_])
125
+ print(f'Скачиваю по ссылке: {url_down_dir_RC[_]}')
126
+ downl(url_down_dir_RC[_], info_RC[_])
127
+
128
+ else:
129
+ print(title_RC[_])
130
+ print(f'Скачиваю hitmotop\n{url_tracks_RC[_]}')
131
+ downl(url_tracks_RC[_], info_RC[_])
132
+
133
+ def down_music_RP():
134
+ for _ in range(amount_RP):
135
+
136
+ if url_down_dir_RP[_] != None:
137
+ print(info_RP[_])
138
+ print(f'Скачиваю по ссылке: {url_down_dir_RP[_]}')
139
+ downl(url_down_dir_RP[_], info_RP[_])
140
+
141
+ else:
142
+ print(title_RP[_])
143
+ print(f'Скачиваю hitmotop\n{url_tracks_RP[_]}')
144
+ downl(url_tracks_RP[_], info_RP[_])
145
+
146
+
147
+ print_new_line()
148
+ down_music_ET()
149
+ print_new_line()
150
+ down_music_RC()
151
+ print_new_line()
152
+ down_music_RP()