Add handling for insta's tap to play interstitial

This commit is contained in:
Max Goodhart
2021-03-06 21:32:44 -08:00
parent 441897ad3e
commit e961bc21b7

View File

@@ -202,10 +202,32 @@ const periscopeHacks = {
},
}
const igHacks = {
isMatch() {
return location.host === 'www.instagram.com'
},
async onLoad() {
const playButton = await Promise.race([
waitForQuery('button'),
waitForQuery('video'),
sleep(1000),
])
if (
playButton.tagName === 'BUTTON' &&
playButton.textContent === 'Tap to play'
) {
playButton.click()
}
},
}
async function findVideo(kind) {
if (periscopeHacks.isMatch()) {
await periscopeHacks.onLoad()
}
if (igHacks.isMatch()) {
await igHacks.onLoad()
}
const { video, iframe } = await waitForVideo(kind)
if (!video) {