Repository: amgxv/SpotifyAdBlocker-macOS Branch: master Commit: 3e9c7a7f5d9d Files: 6 Total size: 5.6 KB Directory structure: gitextract_wep5kx1e/ ├── README.md ├── hosts/ │ ├── hosts.txt │ └── old_hosts.txt ├── install.sh ├── uninstall.sh └── update.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: README.md ================================================ # SpotifyAdBlocker-macOS ## DISCLAIMER : I can't maintain this project anymore as I don't have a Mac. PR will be reviewed and accepted. --- Script based on [Ruvelro/Spotihosts](https://github.com/ruvelro/Spotihosts) which adds a few lines to hosts file to block Spotify ads. ## Install Run this at the Terminal : `sudo bash -c "$(curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/install.sh)"` ### Uninstall Run this at the Terminal : `sudo bash -c "$(curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/uninstall.sh)"` ### Update Run this at the Terminal : `sudo bash -c "$(curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/update.sh)"` ### How can I assure that hosts are enabled or deleted? * Open your Terminal * Run ```cat /private/etc/hosts``` * If you can see the following [hosts](https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/hosts/hosts.txt) below ```#[Spotify Ad-Block Hosts]``` line you have the correct hosts configured. * If you want to fully assure that hosts are completely removed from your system, check if there are hosts remaining from other Spotyblock versions * You can edit this hosts file with your favorite text editor, you'll need admin privileges to edit this file ================================================ FILE: hosts/hosts.txt ================================================ 0.0.0.0 adeventtracker.spotify.com :: adeventtracker.spotify.com 0.0.0.0 ads-fa.spotify.com :: ads-fa.spotify.com 0.0.0.0 analytics.spotify.com :: analytics.spotify.com 0.0.0.0 audio2.spotify.com :: audio2.spotify.com 0.0.0.0 b.scorecardresearch.com :: b.scorecardresearch.com 0.0.0.0 bounceexchange.com :: bounceexchange.com 0.0.0.0 bs.serving-sys.com :: bs.serving-sys.com 0.0.0.0 content.bitsontherun.com :: content.bitsontherun.com 0.0.0.0 core.insightexpressai.com :: core.insightexpressai.com 0.0.0.0 crashdump.spotify.com :: crashdump.spotify.com 0.0.0.0 desktop.spotify.com :: desktop.spotify.com 0.0.0.0 ds.serving-sys.com :: ds.serving-sys.com 0.0.0.0 gtssl2-ocsp.geotrust.com :: gtssl2-ocsp.geotrust.com 0.0.0.0 log.spotify.com :: log.spotify.com 0.0.0.0 media-match.com :: media-match.com 0.0.0.0 omaze.com :: omaze.com 0.0.0.0 redirector.gvt1.com :: redirector.gvt1.com 0.0.0.0 s0.2mdn.net :: s0.2mdn.net 0.0.0.0 v.jwpcdn.com :: v.jwpcdn.com 0.0.0.0 weblb-wg.gslb.spotify.com :: weblb-wg.gslb.spotify.com 0.0.0.0 www.omaze.com :: www.omaze.com ================================================ FILE: hosts/old_hosts.txt ================================================ 0.0.0.0 adeventtracker.spotify.com :: adeventtracker.spotify.com 0.0.0.0 ads-fa.spotify.com :: ads-fa.spotify.com 0.0.0.0 analytics.spotify.com :: analytics.spotify.com 0.0.0.0 audio2.spotify.com :: audio2.spotify.com 0.0.0.0 b.scorecardresearch.com :: b.scorecardresearch.com 0.0.0.0 bounceexchange.com :: bounceexchange.com 0.0.0.0 bs.serving-sys.com :: bs.serving-sys.com 0.0.0.0 content.bitsontherun.com :: content.bitsontherun.com 0.0.0.0 core.insightexpressai.com :: core.insightexpressai.com 0.0.0.0 crashdump.spotify.com :: crashdump.spotify.com 0.0.0.0 desktop.spotify.com :: desktop.spotify.com 0.0.0.0 ds.serving-sys.com :: ds.serving-sys.com 0.0.0.0 gtssl2-ocsp.geotrust.com :: gtssl2-ocsp.geotrust.com 0.0.0.0 log.spotify.com :: log.spotify.com 0.0.0.0 media-match.com :: media-match.com 0.0.0.0 omaze.com :: omaze.com 0.0.0.0 redirector.gvt1.com :: redirector.gvt1.com 0.0.0.0 s0.2mdn.net :: s0.2mdn.net 0.0.0.0 v.jwpcdn.com :: v.jwpcdn.com 0.0.0.0 weblb-wg.gslb.spotify.com :: weblb-wg.gslb.spotify.com 0.0.0.0 www.omaze.com :: www.omaze.com .0.0.0 omaze.com 0.0.0.0 spclient.wg.spotify.com ================================================ FILE: install.sh ================================================ #!/usr/bin/env bash if [ "$EUID" -ne 0 ]; then printf "\nThis script needs to be run as root.\nPassword will be asked...\n" sudo "$0" exit fi clear printf "\nThis script will edit your hosts file... \n" printf "\nDo you want to continue? [y|n] \n" read -r conf if [[ $conf = Y ]] || [[ $conf = y ]]; then clear if grep -q "Spotify Ad-Block Hosts" "/private/etc/hosts"; then printf "You have already ran this script\n" read -rp " Press enter to exit" clear exit 0 fi echo -e "#[Spotify Ad-Block Hosts]" >> "/private/etc/hosts" curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/hosts/hosts.txt -o /tmp/spotyblockhosts while read -r line do echo -e $line >> "/private/etc/hosts" done < "/tmp/spotyblockhosts" rm /tmp/spotyblockhosts killall mDNSResponder killall mDNSResponderHelper elif [[ $conf = N ]] || [[ $conf = n ]]; then clear exit 0 else printf "\nInvalid value, program will exit...\n" read -rp " Press enter to exit" exit 1 fi if grep -q "Spotify Ad-Block Hosts" "/private/etc/hosts"; then clear printf "Hosts file modified successfully! Enjoy Spotify without Ads\n" read -rp " Press enter to exit" clear else clear printf "Error modifying hosts file :c\n" read -rp " Press enter to exit" clear fi ================================================ FILE: uninstall.sh ================================================ #!/usr/bin/env bash echo "Uninstalling Spotyblock..." sudo sed -i -e "/#\[Spotify Ad-Block Hosts\]/d" "/private/etc/hosts" curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/hosts/hosts.txt -o /tmp/spotyblockhosts curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/hosts/old_hosts.txt -o /tmp/spotyblockoldhosts while read -r line do sudo sed -i -e "/$line/d" "/private/etc/hosts" done < "/tmp/spotyblockhosts" while read -r line do sudo sed -i -e "/$line/d" "/private/etc/hosts" done < "/tmp/spotyblockoldhosts" rm /tmp/spotyblockhosts rm /tmp/spotyblockoldhosts sudo killall mDNSResponder sudo killall mDNSResponderHelper ================================================ FILE: update.sh ================================================ #!/usr/bin/env bash bash <(curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/uninstall.sh) bash <(curl -Ss https://raw.githubusercontent.com/amgxv/SpotifyAdBlocker-macOS/master/install.sh)