This script can be used to map out the channel landscape surrounding specific YouTube videos. It was developed as part of a programming project at TU Berlin. If you want to learn more about the project and how the generated graphs were evaluated, you may read the project report.
- Download and install the latest versions of Python and Pip.
- Register for the YouTube Data API and retrieve your API key.
-
Clone the repository to your local machine as follows:
git clone https://github.com/ashiven/youtube-networks.git
-
Navigate to the youtube-networks directory.
cd ./youtube-networks -
Install the necessary dependencies.
pip install --user -r requirements.txt
-
Insert your API key(s) into the script.
nano ./src/main.py
-
Enter the following command to run the script:
python ./src/main.py -s <link to a youtube video>
parameter alias type description default --help-hBoolean Shows argument usage --seed-sString The initial YouTube link None --depth-dInteger The number of depth layers to calculate for the tree 2 --width-wInteger The number of related videos per video 3 --apikey-aString The API key to be used (if not provided, the first key from the list will be used) None --labels-lString Label description of the tree: title,videoId,channelId,channelNametitle--graph-gBoolean Convert the tree into a network graph False --force-fBoolean Calculate a large tree saved in a logfile until API key quota is reached False --aggressive-ABoolean Do the same as -f, exhausting all available API keysFalse --maxdepth-mInteger Max depth for tree compilation (must be a multiple of -d)10000 --importtrees-iString Path to a logfile (will convert its contents into a network graph) None --titles-tString Path to a logfile (will extract the video titles for further topic analysis) None