D3vl0per / Twitch-watcher

Automatic watching the twitch to get Valorant drop
MIT License
226 stars 66 forks source link

Add Check if valorant is dropped #55

Open guttir14 opened 4 years ago

guttir14 commented 4 years ago

just post request to gql.twitch.tv/gql with Autorization token ( {Authorization: "Oauth " + cookie.token} ) in header and with body:

{
    "operationName": "OnsiteNotifications_ListNotifications",
    "variables": {
        "limit": 3,
        "cursor": "",
        "language": "en"
    },
    "extensions": {
        "persistedQuery": {
            "version": 1,
            "sha256Hash": "b317b93ed481bf07c35defbcf01848f09744805ebb640734763298f9a7dfd64f"
        }
    }
}

If result contains "You just received the **VALORANT**" then valorant has been dropped and we can console.log('dropped') and process.exit()

Also, to easy get token you can use next script in your browser console:

newWin=window.open("about:blank","","width=350,height=10");newWin.document.write(JSON.stringify(Object({token:cookies["auth-token"]})))
guttir14 commented 4 years ago

Or just emulate click on notifications button

D3vl0per commented 4 years ago

Can you make a pull request please?