Member-only story
Let’s build a TikTok scraping tool with Python!
Welcome back! Let’s go ahead and develop a TikTok scraping tool using Python, now this specific tool is a little bit different than the other one’s i’ve created. First off, we’ll be running this program from our terminal / command prompt which will essentially be our front end for this program. The system of this program is this: User runs this program in their terminal > inputs a link to a TikTok users profile > The program will output the number of followers, following and total likes on their profile. If all that sounds good to you then let’s get started!
First off
As always, if you have any suggestions, thoughts or just want to connect, feel free to contact / follow me on Twitter! Also, below is a link to some of my favorite resources for learning programming, Python, R, Data Science, etc.
Let’s begin!
Basic introduction you could probably skip that I copied from my other article
First things first, we will need to have Python installed, read my article here to make sure you have Python and some IDE installed. Next, I wrote an article on using Selenium in Python, Selenium is a web scraping package that allows us to mimic a web browser using Python, it might be best to read that article for more of an understanding on web scraping, but it’s not a necessity, you can read that article here.
Let’s get started!
Now that we have our Python environment setup, let’s open up a blank Python script. Let’s import the Selenium package that you hopefully preinstalled from the previous paragraph (just pip install selenium). Once installed, import the following packages:
#IMPORT THESE PACKAGES
import selenium
from selenium import webdriver
import pandas as pd
#OPTIONAL PACKAGE, BUY MAYBE NEEDED
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options