Skip to content

Instantly share code, notes, and snippets.

@ParsaHarooni
Created January 8, 2018 11:39
Show Gist options
  • Select an option

  • Save ParsaHarooni/22776f79abc9ae3af203b41532910891 to your computer and use it in GitHub Desktop.

Select an option

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));
});
})
}
@xsanja
Copy link

xsanja commented Jun 16, 2021

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