Remove last.fm duplicates
Select all code below and move this script on your bookmarks tab, rename it as you want:
javascript:( function ( ) { var found = 0 ; var num = 5 ; var sections = Array . from ( document . getElementsByTagName ( 'tbody' ) ) ; function replaceQueryParam ( param , newval , search ) { var regex = new RegExp ( '([?;&])' + param + '[^&;]*[;&]?' ) ; var query = search . replace ( regex , '$1' ) . replace ( / &$/ , '' ) ; return ( query . length > 2 ? query + '&' : '?' ) + ( newval ? param + '=' + newval : '' ) ; } ; function gup ( name , url ) { if ( ! url ) url = location . href ; name = name . replace ( / [\[]/ , '\\\[' ) . replace ( / [\]]/ , '\\\]' ) ; var regexS = '[\\?&]' + name + '=([^&#]*)' ; % 20 var % 20 regex % 20 = % 20n ew % 20 RegExp ( % 20 regexS % 20 ) ; % 20 var % 20 results % 20 = % 20 regex . exec ( % 20 url % 20 ) ; % 20 return % 20 results % 20 == % 20n ull % 20 ?% 20n ull % 20 :% 20 results [ 1 ] ; % 20 } ; % 20 % 20 sections . forEach ( function % 20 ( section ) % 20 { % 20 var % 20 els % 20 = % 20 Array . from ( section . rows ) ; % 20 var % 20n ames % 20 = % 20 els . map ( function % 20 ( el ) % 20 { % 20 var % 20n mEl % 20 = % 20 el . querySelector ( '.chartlist-name' ) ; % 20 var % 20 artEl % 20 = % 20 el . querySelector ( '.chartlist-artist' ) ; % 20 return % 20n mEl % 20 && % 20 artEl % 20 && % 20n mEl . textContent . replace ( / \s+/ g, % 20 '%20' ) . trim ( ) + ':' + artEl . textContent . replace ( / \s+/ g, % 20 '%20' ) . trim ( ) ; % 20 } ) ; % 20 % 20n ames . forEach ( function % 20 ( name , % 20 i , % 20n ames ) % 20 { % 20 if % 20 ( ! names . slice ( i % 20 + % 201 , % 20 i % 20 + % 201 % 20 + % 20n um ) . includes ( name ) ) % 20 return ; % 20 var % 20 delBtn % 20 = % 20 els [ i ] . querySelector ( '[data-ajax-form-sets-state=' deleted ']' ) ; % 20 if % 20 ( delBtn ) % 20 { % 20 delBtn . click ( ) ; % 20 found ++ ; % 20 } ; % 20 } ) ; % 20 } ) ; % 20 % 20 if % 20 ( found % 20 > % 200 ) % 20 setTimeout ( function ( ) % 20 { % 20 location . reload ( ) ; % 20 } , % 205000 ) ; % 20 else % 20 window . location % 20 = % 20 window . location . pathname % 20 + % 20 replaceQueryParam ( 'page' , % 20 gup ( 'page' , % 20 window . location . href ) % 20 - % 201 , % 20 window . location . search ) ; } ) ( ) ;
Open your library on https://www.last.fm/user/{username}/library
Go to last/specific page in library
Click on your script bookmark
?????????
PROFIT!!1