Examine stats about video usage on Wikipedia.

Makes use of two files regularly produced by Brian Wolff:

import io
import requests
import re
import html5lib
import pandas as pd

Import English Wikipedia-used videos

df = pd.read_html("https://tools.wmflabs.org/bawolff/usedVideos.htm")
df[0].describe()
Page name Commons videos on that page Local videos Commons long GIFs Local long GIFs
count 14430 11448 225 2870 101
unique 14430 9838 207 1749 94
top Plumed whistling duck Commercial-LBJ1964ElectionAdDaisyGirl.ogv A Visit to the Seaside (1908).webm Korean war 1950-1953.gif GeometricTortoise.gif
freq 1 16 5 205 4

pandas reads an HTML table into a list of dataframes, so get a shallow copy/reference to just the first one

vdf = df[0].copy()
vdf.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 14430 entries, 0 to 14429
Data columns (total 5 columns):
Page name                      14430 non-null object
Commons videos on that page    11448 non-null object
Local videos                   225 non-null object
Commons long GIFs              2870 non-null object
Local long GIFs                101 non-null object
dtypes: object(5)
memory usage: 563.8+ KB
vdf['Commons videos on that page'].value_counts()[:30]
Commercial-LBJ1964ElectionAdDaisyGirl.ogv                         16
Raising the Flag on Iwo Jima (color).ogv                          12
Funeral of 26 Baku Commissars, 1920.webm                           9
CollateralMurder.ogv                                               9
Drosophila falleni infected with Howardula aoronymphium.webm       8
Apollo 15 feather and hammer drop.ogv                              7
Journey of Sound to the Brain.ogv                                  7
Devdas 1936.webm                                                   7
Who's Out There (1973).ogv                                         7
Shakinghands high.ogv                                              7
SeaSnails.ogv                                                      7
Clip from My Man Godfrey.ogv                                       6
SFP 186 - Flug ueber Berlin.ogv                                    6
The Impact Of Wikipedia.webm                                       6
Stormwater Management with trees.webm                              6
Saganaki at the Parthenon Restaurant in Chicago.MOV.webm           6
Gluten ataxia eng.ogv                                              6
Rock Rock Rock(1956).ogv                                           6
August 25, 1968, Hippies in Lincoln Park, Chicago.webm             6
1946-10-08 21 Nazi Chiefs Guilty.ogv                               6
1946-07-15 Philippines Independence Proclaimed.ogv                 6
ABC Decimal Currency.ogv                                           6
Slohokej liga HD Mladi Jesenice HDD Bled.webm                      5
1961-04-13 Tale Of Century - Eichmann Tried For War Crimes.ogv     5
Bullet Wiki.ogv                                                    5
Friedlaender.webmsd.webm                                           5
First flights in aviation history.ogv                              5
Chapchar Kut cheraw dance 2014.webm                                5
Mdis depart anot.ogv                                               5
Tyto furcata, three chicks hissing and clicking, USA.ogv           5
Name: Commons videos on that page, dtype: int64
vdf['Commons long GIFs'].value_counts()[:30]
Korean war 1950-1953.gif                                                                     205
Indo-European migrations.gif                                                                 156
Asteroid-Bennu-OSIRIS-RExArrival-GifAnimation-20181203.gif                                    51
Protein translation.gif                                                                       38
Byzantine Empire animated.gif                                                                 24
Linguistic map Southwestern Europe-en.gif                                                     22
ADN animation.gif                                                                             14
US Slave Free 1789-1861.gif                                                                   13
2004 Indonesia Tsunami Complete.gif                                                           12
Canada provinces evolution 2.gif                                                              11
Mug and Torus morph.gif                                                                       10
Hussites.gif                                                                                  10
Volume rendered CT scan of abdominal and pelvic blood vessels (smaller).gif                    8
Translational motion.gif                                                                       7
ConstellationGPS.gif                                                                           7
EC-EU-enlargement animation.gif                                                                7
Colonisation2.gif                                                                              7
NaF.gif                                                                                        7
Political Evolution of Central America and the Caribbean 1700 and on.gif                       7
Balkans Animation 1800-2008.gif                                                                6
Floyd1999RadarPANYNJDMP.gif                                                                    6
Territorial expansion of Vietnam from Lý dynasty to Nguyễn dynasty (1009–1834).gif             6
Gas OPR.gif                                                                                    6
Animation of moons of Pluto - Front view.gif, Animation of moons of Pluto - Side view.gif      6
World ocean map.gif                                                                            6
Tugra Mahmuds II.gif                                                                           6
Coral atoll formation animation.gif                                                            6
RomaniaBorderHistoryAnnimation 1859-2010.gif                                                   6
Franks expansion.gif                                                                           6
Europe WattPerCapita animated sequence 1992-2014.gif                                           6
Name: Commons long GIFs, dtype: int64
vdf[vdf['Commons videos on that page'].str.contains('webm', flags=re.IGNORECASE, regex=True, na=False)].info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5782 entries, 0 to 14429
Data columns (total 5 columns):
Page name                      5782 non-null object
Commons videos on that page    5782 non-null object
Local videos                   7 non-null object
Commons long GIFs              94 non-null object
Local long GIFs                0 non-null object
dtypes: object(5)
memory usage: 271.0+ KB
alldf = pd.read_html("https://tools.wmflabs.org/bawolff/usedVideosCommons.htm")
filesdf = alldf[0].copy()
filesdf.head(10)
File name Number of usages Pages it is used on
0 Wikipedia ridotto.ogv 573611 cywiki:Wicipedia:Tiwtorial; enwiki:User:Murph1...
1 The Impact of Wikipedia Poongothai Balasubrama... 97495 cawiki:Viquipèdia:Bus turístic/People/Content;...
2 Wikimedia Italia - WikiGuida 3 - Wikisource.ogv 18771 cawikisource:Ajuda:Pàgines de transcripció; en...
3 How to write in Nepali wiki.ogv 17500 dtywiki:विकिपिडिया:स्वशिक्षा; dtywiki::विकिपिड...
4 Citing sources tutorial, part 1.ogv 9495 arwiki:ويكيبيديا:تدريب/الجزء الرئيسي/الاستشهاد...
5 Welcomebanner.gif 9241 abwiki:Участник:Bugboy52.40; abwiki:Алахәыла а...
6 Abirami talks about Tamil Wikipedia.ogv 7539 tawiki:வார்ப்புரு:Welcome-anon; tawiki:பயனர் ப...
7 Lang-es.gif 7535 arwiki:مستخدم:Jasonzhuocn; arwiki:مستخدم:Justw...
8 Fa-WikipediaManual libtheora.ogv 6389 azbwiki:ویکی‌پدیا:اؤزاؤیرنمه; dewiki::Persisch...
9 Lang-en.gif 3837 arwikiversity:قالب:كلية اللغة الإنجليزية/قوالب...

Extract file extension of each media file and create new column for it

filesdf['FileType'] = filesdf['File name'].apply(lambda x: x.split('.')[-1])
filesdf['FileType'].value_counts()
webm    20755
ogv     18375
gif      5494
GIF        60
WebM       16
OGV         7
Gif         3
ogg         1
OGG         1
Webm        1
Name: FileType, dtype: int64