pars-hitmotop 0.0.4__tar.gz → 0.0.5__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.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pars_hitmotop
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/PY079/pars_hitmotop
6
6
  Author: Joy_079
7
7
  Author-email: Prufu@yandex.ru
8
8
  License: UNKNOWN
9
- Download-URL: https://github.com/PY079/pars_hitmotop/arhive/v0.0.4.zip
9
+ Download-URL: https://github.com/PY079/pars_hitmotop/arhive/v0.0.5.zip
10
10
  Description: # Оглавление
11
11
  0. [Оглавление](https://github.com/PY079/pars_hitmotop#оглавление)
12
12
  1. [Что именно парсит?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-именно-парсит)
@@ -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.4'
6
+ __version__= '0.0.5'
@@ -34,11 +34,11 @@ class EnteredTrack:
34
34
  else:
35
35
  __user = fake_useragent.UserAgent().random
36
36
  __headers = {"user-agent": __user}
37
-
37
+ __url1= requests.get('https://hitmos.me/', headers=__headers, allow_redirects=True).url
38
38
 
39
- _url = f"https://rus.hitmotop.com/search?q={self.music_name}"
39
+ _url = f"{__url1}search?q={self.music_name}"
40
40
  _response = requests.get(_url, headers=__headers)
41
- _soup = BeautifulSoup(_response.text, "lxml")
41
+ _soup = BeautifulSoup(_response.text, "html.parser")
42
42
 
43
43
 
44
44
  if _soup.find('h2',class_='tracks__title content-item-title'):
@@ -52,7 +52,7 @@ class EnteredTrack:
52
52
  _track_duration = [i.text.strip() for i in _soup.find_all("div", class_="track__fulltime")]
53
53
  _track_pictures = [f"{i.get('style')[23:-3]}" for i in _soup.find_all("div", class_="track__img")]
54
54
  _track_urls_dow = [i.get('href') for i in _soup.find_all('a', class_='track__download-btn')]
55
- _track_url = [f"https://rus.hitmotop.com{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
55
+ _track_url = [f"{_url}{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
56
56
 
57
57
  _items = []
58
58
  for idx in range(min(len(_track_titles), self.amount)):
@@ -31,17 +31,20 @@ param: count - число от 1 до 48, кол-во треков
31
31
 
32
32
  __user = fake_useragent.UserAgent().random
33
33
  __headers = {'user-agent': __user}
34
+ __url1= requests.get('https://hitmos.me/', headers=__headers, allow_redirects=True).url
35
+
36
+ _url = f"{__url1}search?q={self.music_name}"
34
37
 
35
- url = 'https://rus.hitmotop.com/songs/top-rated'
38
+ url = f'{_url}songs/top-rated'
36
39
  response = requests.get(url, headers=__headers)
37
- _soup = BeautifulSoup(response.text, 'lxml')
40
+ _soup = BeautifulSoup(response.text, 'html.parser')
38
41
 
39
42
  _track_titles = [i.text.strip() for i in _soup.find_all("div", class_="track__title")]
40
43
  _track_artists = [i.text.strip() for i in _soup.find_all("div", class_="track__desc")]
41
44
  _track_duration = [i.text.strip() for i in _soup.find_all("div", class_="track__fulltime")]
42
45
  _track_pictures = [f"{i.get('style')[23:-3]}" for i in _soup.find_all("div", class_="track__img")]
43
46
  _track_urls_dow = [i.get('href') for i in _soup.find_all('a', class_='track__download-btn')]
44
- _track_url = [f"https://rus.hitmotop.com{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
47
+ _track_url = [f"{_url}{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
45
48
 
46
49
  _items = []
47
50
 
@@ -30,18 +30,21 @@ class RatingPage:
30
30
 
31
31
  __user = fake_useragent.UserAgent().random
32
32
  __headers = {'user-agent': __user}
33
+ __url1= requests.get('https://hitmos.me/', headers=__headers, allow_redirects=True).url
34
+
35
+ _url = f"{__url1}search?q={self.music_name}"
33
36
  if self.page_count == 1:
34
37
  __list = []
35
- url = 'https://rus.hitmotop.com/songs/top-rated'
38
+ url = f'{_url}songs/top-rated'
36
39
  response = requests.get(url, headers=__headers)
37
- _soup = BeautifulSoup(response.text, 'lxml')
40
+ _soup = BeautifulSoup(response.text, 'html.parser')
38
41
 
39
42
  _track_titles = [i.text.strip() for i in _soup.find_all("div", class_="track__title")]
40
43
  _track_artists = [i.text.strip() for i in _soup.find_all("div", class_="track__desc")]
41
44
  _track_duration = [i.text.strip() for i in _soup.find_all("div", class_="track__fulltime")]
42
45
  _track_pictures = [f"{i.get('style')[23:-3]}" for i in _soup.find_all("div", class_="track__img")]
43
46
  _track_urls_dow = [i.get('href') for i in _soup.find_all('a', class_='track__download-btn')]
44
- _track_url = [f"https://rus.hitmotop.com{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
47
+ _track_url = [f"{_url}{tra_url.get('href')}" for tra_url in _soup.find_all('a', class_='track__info-l')]
45
48
 
46
49
  for idx in range(min(len(_track_titles), 48)):
47
50
  if self.get_redirect_url and len(_track_urls_dow[idx])>0:
@@ -69,7 +72,7 @@ class RatingPage:
69
72
 
70
73
  __list = []
71
74
 
72
- url = 'https://rur.hitmotop.com/songs/top-rated/start/'
75
+ url = f'{_url}top-rated/start/'
73
76
 
74
77
  items = []
75
78
  for page in range(0, self.page_count, 48):
@@ -80,9 +83,9 @@ class RatingPage:
80
83
  track_titles = [i.text.strip() for i in soup.find_all("div", class_="track__title")]
81
84
  track_artists = [i.text.strip() for i in soup.find_all("div", class_="track__desc")]
82
85
  track_duration = [i.text.strip() for i in soup.find_all("div", class_="track__fulltime")]
83
- track_pictures = [f"https://rur.hitmotop.com{i.get('style')[23:-3]}" for i in soup.find_all("div", class_="track__img")]
86
+ track_pictures = [f"{_url}{i.get('style')[23:-3]}" for i in soup.find_all("div", class_="track__img")]
84
87
  track_urls_dow = [f"{track_dow_url.get('href')}" for track_dow_url in soup.find_all('a', class_='track__download-btn')]
85
- track_url = [f"https://rur.hitmotop.com{tra_url.get('href')}" for tra_url in soup.find_all('a', class_='track__info-l')]
88
+ track_url = [f"{_url}{tra_url.get('href')}" for tra_url in soup.find_all('a', class_='track__info-l')]
86
89
 
87
90
 
88
91
 
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pars-hitmotop
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/PY079/pars_hitmotop
6
6
  Author: Joy_079
7
7
  Author-email: Prufu@yandex.ru
8
8
  License: UNKNOWN
9
- Download-URL: https://github.com/PY079/pars_hitmotop/arhive/v0.0.4.zip
9
+ Download-URL: https://github.com/PY079/pars_hitmotop/arhive/v0.0.5.zip
10
10
  Description: # Оглавление
11
11
  0. [Оглавление](https://github.com/PY079/pars_hitmotop#оглавление)
12
12
  1. [Что именно парсит?](https://github.com/PY079/pars_hitmotop/blob/main/README.md#что-именно-парсит)
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup
2
2
 
3
- version='0.0.4'
3
+ version='0.0.5'
4
4
  with open('README.md', encoding='utf-8') as f:
5
5
  long_description=f.read()
6
6
 
File without changes
File without changes