@@ -161,10 +161,13 @@ def search_user(self, owner_id=None, q=''):
161161 )
162162 )
163163
164- return [
165- i for i in scrap_data (response .text , self .user_id )
166- if i ['owner_id' ] == owner_id
167- ]
164+ tracks = scrap_data (
165+ response .text ,
166+ self .user_id ,
167+ filter_root_el = {'class_' : 'AudioSerp__foundOwned' }
168+ )
169+
170+ return [track for track in tracks if track ['owner_id' ] == owner_id ]
168171
169172 def search (self , q , count = 50 ):
170173 """ Искать аудиозаписи
@@ -203,13 +206,18 @@ def search_iter(self, q, offset=0):
203206 offset += 50
204207
205208
206- def scrap_data (html , user_id ):
209+ def scrap_data (html , user_id , filter_root_el = None ):
207210 """ Парсинг списка аудиозаписей из html страницы """
208211
212+ if filter_root_el is None :
213+ filter_root_el = {'id' : 'au_search_items' }
214+
209215 soup = BeautifulSoup (html , 'html.parser' )
210216 tracks = []
211217
212- for audio in soup .find_all ('div' , {'class' : 'audio_item' }):
218+ root_el = soup .find (** filter_root_el )
219+
220+ for audio in root_el .find_all ('div' , {'class' : 'audio_item' }):
213221 if 'audio_item_disabled' in audio ['class' ]:
214222 continue
215223
@@ -249,7 +257,9 @@ def scrap_albums(html):
249257 full_id = tuple (int (i ) for i in RE_ALBUM_ID .search (link ).groups ())
250258
251259 stats_text = album .select_one ('.audioPlaylistsPage__stats' ).text
252- plays = int (stats_text .split (maxsplit = 1 )[0 ])
260+
261+ # "1 011 прослушиваний"
262+ plays = int (stats_text .rsplit (' ' , 1 )[0 ].replace (' ' , '' ))
253263
254264 albums .append ({
255265 'id' : full_id [1 ],
0 commit comments