Skip to content

Commit

Permalink
updating the skip over method to handle 'still there popup'
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Fraser committed Oct 4, 2018
1 parent 3a0887c commit e8b4770
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ npm run test
```

## Release History

* 1.5.0
* Pull Request #4 Windows build script works now.
* Introducing skip logic for the YouTube `You Still There` popup notice which pauses playback
* 1.4.3
* Pull Request #2 introducing [electron-window-state](https://npmjs.com/package/electron-window-state).
* Redesigned loading screen.
Expand Down
3 changes: 3 additions & 0 deletions assets/menuicon-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/menuicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ app.on('ready', () => {
createWindow()
globalShortcuts()
createMenu()
skipOverAdverts()
skipOver()
})

// triggered when clicked the dock icon (osx)
Expand Down Expand Up @@ -153,15 +153,25 @@ function globalShortcuts () {
})
}

function skipOverAdverts () {
function skipOver () {
// YouTube Adverts - Will auto click skip button
setInterval(() => {
if (mainWindow) {
mainWindow.webContents.executeJavaScript(`
var skip = document.getElementsByClassName('videoAdUiSkipButton')[0]
if(typeof skip !== "undefined") { skip.click() }
var skip = document.querySelector('.videoAdUiSkipButton')
if (skip) { skip.click() }
`)
}
}, 1000)
}, 250)
// You Still There popup notice
setInterval(() => {
if (mainWindow) {
mainWindow.webContents.executeJavaScript(`
var stillThere = document.querySelector('.ytmusic-you-there-renderer .yt-button-renderer')
if (stillThere) { stillThere.click() }
`)
}
}, 250)
}

function createMenu () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "musictube-player",
"version": "v1.5.3",
"version": "v1.5.0",
"description": "MusicTube player is an electron wrapper application for YouTube Music with added media key support and notifications.",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit e8b4770

Please sign in to comment.