Hi Nick,

I made a Quarry query to do this for you: https://quarry.wmflabs.org/query/25400

You will have to fork it and remove the "LIMIT 10" to get it to run on
all the English Wikipedia articles. It may take too long or produce
too much data, in which case please ask on this list for someone who
can run it for you.

USE enwiki_p;

SELECT page_title as article, COUNT(DISTINCT pli.pl_from) as inlinks,
COUNT(DISTINCT plo.pl_title) as outlinks
FROM page

JOIN pagelinks AS pli ON page.page_title = pli.pl_title AND pli.pl_namespace = 0
AND page.page_namespace = 0 AND page.page_is_redirect = 0

JOIN pagelinks AS plo ON page.page_id = plo.pl_from AND plo.pl_namespace = 0
AND page.page_namespace = 0 AND page.page_is_redirect = 0

GROUP BY article

Refs.: https://www.mediawiki.org/wiki/Manual:Pagelinks_table

> From: Nick Bell <bhin...@gmail.com>
> Subject: [Analytics] Ingoing and outgoing internal links enquiry
>  Dear Analytics Team,
> I’m doing a project on Wikipedia for my Maths degree, and I was hoping you
> could help me acquire some data about Wikipedia.
> I would like to get the number of incoming internal links and outgoing
> internal links for every page, if possible. I could limit this if needs be,
> as I am aware this totals around 11 million values.
> I have minimal programming experience, so if this is unreasonable or
> impossible please let me know. I very much appreciate your time considering
> my request.
> Many thanks,
> Nicholas Bell
> Mathematics Undergraduate
> University of Bristol

Analytics mailing list

Reply via email to