Skip to content

Instantly share code, notes, and snippets.

@ParsaHarooni
Created January 8, 2018 11:39
Show Gist options
  • Save ParsaHarooni/22776f79abc9ae3af203b41532910891 to your computer and use it in GitHub Desktop.
Save ParsaHarooni/22776f79abc9ae3af203b41532910891 to your computer and use it in GitHub Desktop.
Get telegram channel member count.
// 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));
});
})
}
@sunnykandev
Copy link

Hi, Parsa
Is this code still working without authentication?

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