diff --git a/scrape.py b/scrape.py index 4c7b26e..2a49339 100755 --- a/scrape.py +++ b/scrape.py @@ -219,12 +219,20 @@ def Get_Tracks_Info(url, limit = 100): # Grab the like count like_elem = track_elem.find(class_='sc-button-like') if like_elem: - track.likes = Human_Str_To_Int(str(like_elem.string.strip())) + like_elem_text = str(like_elem.string.strip()) + if 'like' in like_elem_text.lower(): + track.likes = 0 + else: + track.likes = Human_Str_To_Int(like_elem_text) # Grab the repost count repost_elem = track_elem.find(class_='sc-button-repost') if repost_elem: - track.reposts = Human_Str_To_Int(str(repost_elem.string.strip())) + repost_elem_text = str(repost_elem.string.strip()) + if 'repost' in repost_elem_text.lower(): + track.reposts = 0 + else: + track.reposts = Human_Str_To_Int(repost_elem_text) # Finally add the track to the dictionary tracks[track.url] = track