abba23 / spotify-adblock

Adblocker for Spotify
https://github.com/abba23/spotify-adblock
1.83k stars 89 forks source link

UI empty square (bottom banner) #12

Closed danieldodi closed 3 years ago

danieldodi commented 3 years ago

Is there any way to remove this bottom empty banner?

image

abba23 commented 3 years ago

Not using this adblocker, but you could do it by modifying xpui.js (e.g. search for {adsEnabled:!0} and remove the !) in <path to Spotify>/Apps/xpui.spa, which is just a zip file. You would have to repeat that process after every Spotify update though.

NoNameForMee commented 3 years ago

Dear @abba23 thanks for this information! I too was looking for a way to get rid of that annoying empty banner..

Wrote a quick bash script which some may find useful (it requires permissions to change content in Spotify directory however it does not check that it has those permissions):

#!/bin/bash
sPATH=$(dirname $(realpath -L $(which spotify)))  # absolute path to Spotify
cd ${sPATH}/Apps/
cp xpui.spa ~/xpui.spa_bak  # create a backup, in home folder, in case of trouble
unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:0}/' > xpui.js
zip --update xpui.spa xpui.js
rm xpui.js
snbk97 commented 3 years ago

@NoNameForMee Currently the banner shows a 0 at the bottom left for me. I've changed the sed expression a bit 's/adsEnabled:a/adsEnabled:false/'

Zzombiee2361 commented 3 years ago

Here's a script based on @NoNameForMee's script and @snbk97 change. It also include an option to restore and checks for permission.

Edit: Added support for flatpak

Edit 2: Fixed sed expression

#!/bin/bash
if which spotify > /dev/null; then
    sPATH=$(dirname $(realpath -L $(which spotify)))  # absolute path to Spotify
elif flatpak list | grep --q com.spotify.Client; then
    sPATH="$(flatpak --installations)/app/com.spotify.Client/current/active/files/extra/share/spotify"
else
    echo "Spotify not found"
    exit 0
fi
cd ${sPATH}/Apps/

if [ "$1" == 'restore' ]; then
    if [ -w xpui.spa_bak ] && [ -w . ]; then
        rm -f xpui.spa
        mv xpui.spa_bak xpui.spa
        echo "Restore success"
    else
        [ -f xpui.spa_bak ] && echo "Permission denied" || echo "Backup not found"
    fi
    exit 0
fi

if [ -w xpui.spa ] && [ -w . ]; then
    cp xpui.spa xpui.spa_bak  # create a backup, in case of trouble
    unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js
    zip --update xpui.spa xpui.js
    rm xpui.js
    echo "Success"
else
    [ -f xpui.spa ] && echo "Permission denied" || echo "File not found"
fi

Usage

# to remove ad banner
sudo ./remove_spotify_banner.sh

# restore from backup, in case of trouble
sudo ./remove_spotify_banner.sh restore
abinlatheef commented 2 years ago

I still have the zero. I tried all the three sed commands by @NoNameForMee @snbk97 @Zzombiee2361 . Is it a problem on my end?

Zzombiee2361 commented 2 years ago

@abinlatheef if you ran @NoNameForMee's script without @snbk97's change, your xpui.js is already modified and running my script won't change a thing. Restore the file and run the script again. You can do that with my script e.g. sudo ./remove_banner.sh restore && ./remove_banner.sh

abinlatheef commented 2 years ago

@Zzombiee2361 Thank you very much bro. It worked like a charm.

jpmvferreira commented 2 years ago

I'm running Manjaro with spotify-adblock-git installed from the AUR and I don't have such a file, only a folder named xpui with a lot of files inside, neither is called xpui.spa and one is called xpui.js (a massive one line 1.5 Mb file) and other named xpui.css.

In the file xpui.js removing the ! as mentioned before also shows up a 0 in the bottom as others have mentioned, however changing it to adsEnabled:false works.

Just mentioning this because the previous scripts all consider the Apps folder, not sure if this is due a new update or something to do with being installed from the AUR.

realnc commented 2 years ago

To automate this on Gentoo Linux, you can add a post_src_install() hook that patches the spa file. Create this file:

/etc/portage/env/media-sound/spotify

with this in it:

post_src_install() {
    elog "Patching xpui.spa to remove ad box."
    cd "${ED}"/opt/spotify/spotify-client/Apps || die
    unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0}/adsEnabled:false}/' > xpui.js || die
    zip --update xpui.spa xpui.js || die
    rm xpui.js || die
}

Now just reinstall spotify (emerge -a1 spotify) and it should be patched.

liukliukliuk commented 1 year ago

To automate this in Fedora 36+ with lpf package

#!/bin/bash
cd /usr/lib64/spotify-client/Apps/
cp xpui.spa ~/xpui.spa_bak  # create a backup, in home folder, in case of trouble
unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js
zip --update xpui.spa xpui.js
rm xpui.js
ghost commented 1 year ago

Guys, is there an equally practical way to remove the Upgrade button?

xd

I tried this method, but it seems that the xpui.sa file they provide hides more elements than expected, for example in the Settings tab.

Could someone take a look at it? Thanks!

semka95 commented 1 year ago

@soonan5, try to use spicetify-cli, you can create custom css and hide anything.

ghost commented 1 year ago

I've already used spicetify-cli, but I am not looking to make extreme changes to the interface, I just want to get rid of the Upgrade button, which has become bigger with a new Spotify update (⌣̩̩́_⌣̩̩̀)

sun95n commented 1 year ago

It's much easier than you think, even without making drastic changes to the interface. Just follow the detailed installation instructions for your platform.

Then edit user.css located in /usr/share/spotify/Apps/xpui/ (this directory may be different depending on your version of Spotify).

/*BOTTOM BANNER*/
.main-leaderboardComponent-container {
  display: none;
}

/*CONTEXT MENU DOWNLOAD BUTTON*/
.main-contextMenu-disabled:not([as=a]) {
  display: none;
}

/*CONTEXT MENU UPGRADE TO PREMIUM BUTTON*/
.main-contextMenu-menuItem [href="https://www.spotify.com/premium/?ref=desktop_loggedin_upgrade_menu"] {
  display: none;
}

/*DOWNLOAD BUTTON*/
.x-downloadButton-DownloadButton{
  display: none;
}

/*SPONSORED BANNER*/
.WiPggcPDzbwGxoxwLWFf {
  display: none;
}

/*UPGRADE BUTTON*/
.main-topBar-UpgradeButton {
  display: none;
}

Also, if you don't like the new Experimental Features and Sidebar Config buttons, you can hide them by editing config-xpui.ini located in $HOME/.config/spicetify

sidebar_config = 0
home_config = 0
experimental_features = 0

After that make sure to apply changes: spicetify apply

If you decide to do the latter, edit user.css again (the spicetify apply command resets this file to default).

That would be all, this wonderful repository does the rest!

Perhaps you can consider this as an alternative to the previously proposed script, although both work fine, it's more comfortable to work on a CSS base than on a harcoded one.

pakosaan commented 1 year ago

To automate this in Fedora 36+ with lpf package

#!/bin/bash
cd /usr/lib64/spotify-client/Apps/
cp xpui.spa ~/xpui.spa_bak  # create a backup, in home folder, in case of trouble
unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js
zip --update xpui.spa xpui.js
rm xpui.js

does this still work

pakosaan commented 1 year ago

It's much easier than you think, even without making drastic changes to the interface. Just follow the detailed installation instructions for your platform.

Then edit user.css located in /usr/share/spotify/Apps/xpui/ (This directory may be different depending on your version of Spotify)

/*CONTEXT MENU UPGRADE TO PREMIUM BUTTON*/
.main-contextMenu-menuItem [href="https://www.spotify.com/premium/"] {
  display: none;
}

/*BOTTOM BANNER*/
.main-leaderboardComponent-container {
  display: none;
}

/*UPGRADE BUTTON*/
.main-topBar-UpgradeButton {
  display: none;
}

Also, if you don't like the new Your Episodes, Experimental Features, and Sidebar Settings buttons, you can hide them by editing config-xpui.ini located in $HOME/.config/spicetify

sidebar_config        = 0
experimental_features = 0

After that make sure to apply changes: spicetify apply

003 ep

That would be all, this wonderful repository does the rest!

Perhaps you can consider this as an alternative to the previously proposed script, although both work fine, it's more comfortable to work on a CSS base than on a harcoded one.

There is no user.css file. can we add to xpui.css file instead

liukliukliuk commented 1 year ago

To automate this in Fedora 36+ with lpf package

#!/bin/bash
cd /usr/lib64/spotify-client/Apps/
cp xpui.spa ~/xpui.spa_bak  # create a backup, in home folder, in case of trouble
unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js
zip --update xpui.spa xpui.js
rm xpui.js

does this still work

it should

sun95n commented 1 year ago

There is no user.css file. can we add to xpui.css file instead

Try to create it. You can also read Themes.

liukliukliuk commented 1 year ago

Well, the new update that supposedly removed the banner actually made mine show up again. And the script doesn't work anymore to remove it. :/

abba23 commented 1 year ago

Well, the new update that supposedly removed the banner actually made mine show up again.

There was no such update.

And the script doesn't work anymore to remove it. :/

The scripts only modify your Spotify installation and are completely independent of this project. If a script you're using doesn't work, it's not because of (any changes to) spotify-adblock. The likely explanation is that you installed a Spotify update that changed something in its Javascript code, so the script would have to be modified.

ErrorNoInternet commented 1 year ago

Well, the new update that supposedly removed the banner actually made mine show up again. And the script doesn't work anymore to remove it. :/

Also happening to me, I had just installed the Flatpak version and noticed the script wasn't working. Try removing the brackets in the sed part of the script (around line 26):

-    unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js
+    unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js
liukliukliuk commented 1 year ago

Well, the new update that supposedly removed the banner actually made mine show up again. And the script doesn't work anymore to remove it. :/

Also happening to me, I just installed the Flatpak version and had found that the script wasn't working. Try removing the brackets in the sed part of the script (around line 26):

-    unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js
+    unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js

worked for me now, thank you :3

almera-vs commented 1 year ago

I'm trying to run the script, but all I get is this blank screen, not sure what I'm doing wrong blank screen

dxcvvxd commented 1 year ago

here on artix on latest (at the moment) spotify update, the absolute path is over at /opt/spotify edit: thanks @liukliukliuk for the working remove sed part.

sun95n commented 1 year ago

For users of the new look of Spotify. I edited my comment to fix #149

I guess that's it for now. If you find something equally annoying, you can let me know or try to fix it using spicetify enable-devtools

liukliukliuk commented 1 year ago

Someone e-mailed us with the script with the new absolute file path

#!/bin/bash
cd /opt/spotify/Apps/

if [ "$1" == 'restore' ]; then
    if [ -w xpui.spa_bak ] && [ -w . ]; then
        rm -f xpui.spa
        mv xpui.spa_bak xpui.spa
        echo "Restore success"
    else
        [ -f xpui.spa_bak ] && echo "Permission denied" || echo "Backup not found"
    fi
    exit 0
fi

if [ -w xpui.spa ] && [ -w . ]; then
    cp xpui.spa xpui.spa_bak  # create a backup, in case of trouble
    unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js
    zip --update xpui.spa xpui.js
    rm xpui.js
    echo "Success"
else
    [ -f xpui.spa ] && echo "Permission denied" || echo "File not found"
fi

usage: save this to a sh file, make it executable and then run it with sudo. e.g: sudo ./remove_banner.sh restore && sudo ./remove_banner.sh Just putting this here for convenience. Thanks for the work and cheers!

pakosaan commented 1 year ago

Anyway to remove the blackbox bar from the flatpak version of spotify

F-36 commented 10 months ago

Someone e-mailed us with the script with the new absolute file path

cd /opt/spotify/Apps/

I don't have anything there, only in /usr/share/spotify/Apps.

unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js
zip --update xpui.spa xpui.js

Did that and nothing changed.

pakosaan commented 10 months ago

Someone e-mailed us with the script with the new absolute file path

cd /opt/spotify/Apps/

I don't have anything there, only in /usr/share/spotify/Apps.

unzip -p xpui.spa xpui.js | sed 's/adsEnabled:\!0/adsEnabled:false/' > xpui.js
zip --update xpui.spa xpui.js

Did that and nothing changed.

Did the banner removed or not? can you please tell things you did?

trinaldi commented 9 months ago

@semka95 Instructions is working pretty well. Thanks!