Created
January 8, 2018 11:39
-
-
Save ParsaHarooni/22776f79abc9ae3af203b41532910891 to your computer and use it in GitHub Desktop.
Get telegram channel member count.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install request | |
// npm install cheerio | |
const request = require("request"); | |
const cheerio = require("cheerio") | |
function getMembersCount(channel) { | |
return new Promise((resolve, reject) => { | |
request(`https://t.me/${channel}/?pagehidden=false`, (error, resp, body) => { | |
const data = cheerio.load(body, {normalizeWhitespace:true}); | |
let info = data('.tgme_page_extra').text(); | |
info = info.replace(" members", "").replace(" ", "").replace(" ", ""); | |
resolve(parseInt(info)); | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Parsa
Is this code still working without authentication?