/reclaim-tiktok

Primary LanguageJupyter Notebook

Reclaim TikTok

This project aims to provide real-time insights into trending narratives of right-wing content on TikTok. It also assess the dark-reach of right-wing content which is especially interesting as TikTok offers a highly individualized user experience.

The code was developed during a hackathon sprint and yet needs to be refactored to meet quality standards and best practices.

Motivation

Rising popularity right- wing parties and views Europe-wide. One of the reasons lies in successful usage of varying social media channels. Democratic political parties and actors are left behind in the always-on campaigning.

TikTok is especially problematic as young people get indoctrinated by extreme right narratives. EU paralement election results (age 16-24 years) offer a first glimpse into this issue.

Frontend

Results are displayed in a dashboard and users can also interact with the data via a custom chatbot accessing our database.

Frontend visualization

Technical Architecture

Technical Architecture

Disclaimer

This code is developed by our Team Reclaim TikTok for the AI for Impact Hackathon. The code, including any associated documentation, data etc., is the intellectual property of our Team.

Usage Restrictions

This code shall not be used, copied, modified, or distributed without the explicit written consent of us. Any use of this code without permission is prohibited.

Setup

Conda installation

Run:

conda env create -f environment.yml

Install Repo

Install our reklaim-tiktok package to ensure imports are working.

pip install -e .

Unofficial TikTok API

To work with the Unofficial TikTok API:

python -m playwright install

Azure SQL Database

We need to ensure that we have ODBC installed.

SEE:

Windows

Linux

macOS

Pre-commit hook

To maintain a clean and standardized environment and codebase please use pre-commit hooks (see the Development section for more details). To use pre-commit hooks we need to run:

pre-commit install

FFMPEG

For using the speech to text module (2): Make sure you have ffmeg installed and the IMAGEIO_FFMPEG_EXE enironment variable is set to the installation path (which ffmpeg).

Usage

Make sure to create a .env file in the working directory with all defined environment variables. See Notion for details.

Development

Styling and formatting

black . # In place formatter, adheres mostly to PEP8
flake8  # Code linter with stylistic conventions adhering to PEP8
isort . # Sorts and formats imports in python files

Make commands

You can use make to execute targets defined in the Makefile. If make is not installed, run sudo apt install make.

# See available make commands
make help
# Execute several clean commands
make clean
# Execute style formatting
make style
# Execute all pre-commit hooks
make pre-commit

Configs

The development tools are configured in the following files. While trying to adhere to standards, we made some exceptions and ignored some directories.

.flake8 # flake8
pyproject.toml # black, isort, pytest
Makefile # make
.pre-commit-config

IDE settings (VScode, Pycharm)

You can also change settings in your IDE to do auto formatting (black) on save and run flake8 on save if you do not want to run them via terminal. Here are articles to setup black on Pycharm, black on VScode, flake8 on VScode.