Ads by ProfitSence
Close

Get a Follower count from the TikTok website Python

Last Updated on Wednesday 5th Oct 2022

tiktok followers count

  • Beautiful Soup is a Python package for parsing HTML and XML documents.
  • It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree.
  • It commonly saves programmers hours or days of work.
  • Requests is a HTTP library for the Python programming language.
  • As per Docs, Requests is an elegant and simple HTTP library for Python, built for human beings.
			
					import requests
from bs4 import BeautifulSoup

url = "https://www.tiktok.com/@tiktok"

headers = {
    "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
}

soup = BeautifulSoup(requests.get(url, headers=headers).content, "html.parser")

			
	

tiktok follower counter

  • You Can Prettify the HTML Document
			
					print(soup.prettify())

			
	
			
					<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
  <style data-emotion="tiktok ">
  .......
  .....

			
	

tiktok count

  • Get TikTok Followers Count
			
					print(soup.select_one('[title="Followers"]').text)

			
	

You'll get the Followers Count

			
					59.9M

			
	

tiktok counter