This is a simple Tiktok crawler that can be used to download videos from Tiktok. It uses the Tiktok API to get the video URL and then downloads the video using the requests library. It can download video from multiple hashtags or download by sound.
- Python 3.11
To install the required libraries, run the following command:
# Create a virtual environment and install the required libraries
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Install playwright
playwright installThen add the following environment variables to your .env file:
MS_TOKEN=<your "ms_token" value from your tiktok cookie>
Before running the script, makesure to update configs.py with the tiktok hashtags you want to download videos from and time range.
To run the script, simply run the following command:
python main.py- If you get the following error:
playwright._impl._errors.Error: Page.evaluate: ReferenceError: opts is not defined
=> Makesure to use Python 3.11 and re-run the installation steps.
- If you get the following error:
ImportError: No module named '_ctypes' when using Value from module multiprocessing
=> Install the following package:
sudo apt-get install libffi-dev
pyenv uninstall 3.11.9
pyenv install 3.11This project is created by @DAN3002. If you have any questions or suggestions, please feel free to contact me.