Tools and commands for automated youtube testing

Install selenium for python3 in your system

sudo pip3 install -U selenium 

Then you need chromedriver, in Ubuntu or Debian the name is different,

sudo apt search chromedriver

Would make you find the right package name. In Ubuntu this is:

sudo apt install firefox-geckodriver chromium-chromedriver

Here is suggested (but not necessary) also firefox-geckodriver in the case you want to modify the script ‘autowatcher.py’ to use Firefox.

The two scripts: autowatcher.py and opener.py

Differences

Execution

Execute the scripts for automatic connection:

python3 bin/autowatcher.py config/example.txt

Optionally, if your chrome has a different pathname (chromium, google-chrome), you can use the environment variable:

CHROME=/usr/bin/google-chrome python3 bin/autowatcher.py config/example.txt

This run the initial experiment, and save a few evidence in:

How to use it

As part of our initial test, we had a list of youtube video. This list is meant to be watched by selenium, recorded by youtube.tracking.exposed, and the outcomes are two:

Our first usage

20164 ۞  ~/Dev/yttrex/methodology$ more config/*
::::::::::::::
config/example.txt
::::::::::::::
https://www.youtube.com/watch?v=qaM80BjvLuA
https://www.youtube.com/watch?v=6McuxV0Krxw
::::::::::::::
config/fanpage.txt
::::::::::::::
https://www.youtube.com/watch?v=qTUeLqdzQWQ
https://www.youtube.com/watch?v=NpZLioKkN40
https://www.youtube.com/watch?v=PQoHvj_NCr0
https://www.youtube.com/watch?v=NpZLioKkN40
https://www.youtube.com/watch?v=BazmarBhi6g
::::::::::::::
config/fqdn.txt
::::::::::::::
https://www.youtube.com/watch?v=_9AzpWcXXYc
https://www.youtube.com/watch?v=julKflWoINM
https://www.youtube.com/watch?v=YrJT_diME8g
https://www.youtube.com/watch?v=4H0mdfD36uM
https://www.youtube.com/watch?v=zMO6QXrI2P4
::::::::::::::
config/pupia.txt
::::::::::::::
https://www.youtube.com/watch?v=3vzRGbuQlG0
https://www.youtube.com/watch?v=7xbMnOzXwgg
https://www.youtube.com/watch?v=l9iDoAq2Gt0
https://www.youtube.com/watch?v=4H0mdfD36uM
https://www.youtube.com/watch?v=Q-DFgTwISOs
::::::::::::::
config/repubblica.txt
::::::::::::::
https://www.youtube.com/watch?v=4I7pmACLEhY
https://www.youtube.com/watch?v=klM1h_vtx24
https://www.youtube.com/watch?v=D_7rWrDYZWw
https://www.youtube.com/watch?v=HVO_1KdLJ3U
https://www.youtube.com/watch?v=t3LHjuudCDU

As shared in the github pull request for this feature, we will test this tool with this method:

The first execution might often fail this way:

20167 ۞  ~/Dev/yttrex/methodology$ python3 bin/autowatcher.py config/fqdn.txt 
You should copy the master directory in yttrex/methodology/profiles/fqdn

The master directory is located in profiles/MASTER

20168 ۞  ~/Dev/yttrex/methodology$ cd profiles/
20169 ۞  ~/Dev/yttrex/methodology/profiles$ cp -r MASTER/ fqdn
20170 ۞  ~/Dev/yttrex/methodology/profiles$ cd ..

Then you can run the command:

20171 ۞  ~/Dev/yttrex/methodology$ python3 bin/autowatcher.py config/fqdn.tx

To open more than one directory in parallel run the command:

20171 ۞  ~/Dev/yttrex/methodology$ (python3 bin/autowatcher.py config/fqdn.txt & );(python3 bin/autowatcher.py config/repubblica.txt & );

This should:

The directory snaps/ keep the snapshots:

20090 ۞  ~/Dev/yttrex/methodology$ ls -l snaps/
total 40
drwxr-xr-x 2 oo oo  4096 fev 25 11:06 example
drwxr-xr-x 2 oo oo  4096 fev 26 12:50 fanpage
drwxr-xr-x 2 oo oo 20480 fev 26 12:50 fqdn
drwxr-xr-x 2 oo oo  4096 fev 26 12:50 pupia
drwxr-xr-x 2 oo oo  4096 fev 26 12:30 repubblica
20091 ۞  ~/Dev/yttrex/methodology$ ls -l snaps/fanpage/
total 32224
-rw-r--r-- 1 oo oo  987781 fev 26 12:45 fanpage-1-preview.png
-rw-r--r-- 1 oo oo  732432 fev 26 12:46 fanpage-1-snap-10.png
-rw-r--r-- 1 oo oo  960302 fev 26 12:46 fanpage-1-snap-11.png
-rw-r--r-- 1 oo oo  492212 fev 26 12:46 fanpage-1-snap-12.png
-rw-r--r-- 1 oo oo  432037 fev 26 12:46 fanpage-1-snap-13.png
-rw-r--r-- 1 oo oo  641378 fev 26 12:46 fanpage-1-snap-14.png
-rw-r--r-- 1 oo oo  405199 fev 26 12:46 fanpage-1-snap-15.png
-rw-r--r-- 1 oo oo  468967 fev 26 12:47 fanpage-1-snap-16.png
-rw-r--r-- 1 oo oo  572512 fev 26 12:47 fanpage-1-snap-17.png
-rw-r--r-- 1 oo oo  762689 fev 26 12:47 fanpage-1-snap-18.png
-rw-r--r-- 1 oo oo  496448 fev 26 12:47 fanpage-1-snap-19.png
-rw-r--r-- 1 oo oo  689359 fev 26 12:45 fanpage-1-snap-1.png
...

How to access and use the data collected

To access the data that each directory recorded, you need to open that specific directory running this command:

20168 ۞ chromium-browser –user-data-dir=profiles/repubblica/

Then you need to open the Youtube tracking exposed extension and download the CSV file TBC