1111
1212class VkAudio :
1313
14- __slots__ = ('_vk' ,)
14+ __slots__ = ('_vk' , 'user_id' )
1515
1616 def __init__ (self , vk ):
17+ self .user_id = vk .get_api ().users .get ()[0 ]['id' ]
1718 self ._vk = vk
1819
1920 def get (self , owner_id = None , album_id = None , offset = 0 ):
@@ -49,7 +50,7 @@ def get(self, owner_id=None, album_id=None, offset=0):
4950 'You don\' t have permissions to browse user\' s audio'
5051 )
5152
52- return scrap_data (response .text )
53+ return scrap_data (response .text , self . user_id )
5354
5455 def get_albums (self , owner_id , offset = 0 ):
5556 """ Получить список альбомов пользователя
@@ -99,7 +100,7 @@ def search_user(self, owner_id, q=''):
99100 )
100101
101102 return [
102- i for i in scrap_data (response .text )
103+ i for i in scrap_data (response .text , self . user_id )
103104 if RE_AUDIO .search (i ['id' ])
104105 ]
105106
@@ -119,10 +120,10 @@ def search(self, q='', offset=0):
119120 }
120121 )
121122
122- return scrap_data (response .text )
123+ return scrap_data (response .text , self . user_id )
123124
124125
125- def scrap_data (html ):
126+ def scrap_data (html , user_id ):
126127 """ Парсинг списка аудиозаписей из html странцы """
127128
128129 soup = BeautifulSoup (html , 'html.parser' )
@@ -133,7 +134,7 @@ def scrap_data(html):
133134 link = audio .select ('.ai_body' )[0 ].input ['value' ]
134135
135136 if 'audio_api_unavailable' in link :
136- link = decode_audio_url (link )
137+ link = decode_audio_url (link , user_id )
137138
138139 tracks .append ({
139140 'artist' : artist ,
0 commit comments