Skip to content

Instantly share code, notes, and snippets.

@makeding
Created Nov 12, 2020
Embed
What would you like to do?
check latest chrome version
# yarn add axios
# npm -i axios
let fs = require('fs')
let axios = require('axios')
let config = require('./config.json')
async function checkchromeversion() {
let system = ['Windows NT 10.0; Win64; x64', 'Windows NT 6.1; Win64; x64']
let data = await axios.get('https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages')
if (data.data) {
let v = data.data.split('\n')[1].split(' ')[1].split('-')[0]
console.log(v)
if (config.cr == undefined || config.cr !== v) {
let data = ['`Chrome/' + v + '`']
system.forEach(s => {
data.push('`Mozilla/5.0 (' + s + ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' + v + ' Safari/537.36`')
})
await send_tg(data.join('\n'))
config.cr = v
fs.writeFileSync(__dirname + '/config.json', JSON.stringify(config))
}
}
}
checkchromeversion()
async function send_tg(text) {
try {
await axios.post('https://api.telegram.org/bot' + config.token + '/sendmessage', {
chat_id: config.chat_id,
text: text,
parse_mode: 'markdown'
})
return true
} catch (error) {
console.error(error)
return false
}
}
{
"token": "",
"chat_id": "",
"cr": ""
}
@makeding
Copy link
Author

makeding commented Nov 12, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment