Skip to content

Commit e1bb8cc

Browse files
authored
Fix ad detection (#19)
Changes Spotify ad detection to use newly added data attribute. Attribute 'data-testid' was split into 'data-testid' ('now-playing-bar' during both playback and ads) and 'data-testadtype' ('ad-type-none' during playback, 'ad-type-ad' during ad). Tested locally on Chrome. Fixes #18
1 parent 12d04f6 commit e1bb8cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/spotishush.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
const mo = new MutationObserver(async (mutations) => {
6464
SpotiShush.debug('mutations:', mutations)
6565

66-
if (footerObj.getAttribute('data-testid') === 'now-playing-bar-ad-type-ad') {
66+
if (footerObj.getAttribute('data-testadtype') !== 'ad-type-none') {
6767
// This is an ad. Here's the simplified HTML snippet:
6868
//
6969
// <div class="...-scss ellipsis-one-line ...-scss" data-testid="track-info-name" as="div" dir="auto">

0 commit comments

Comments
 (0)