macbre/mediawiki-dump

Implement a simple parser of templates parameters

macbre opened this issue · 2 comments

https://lyrics.wikia.com/wiki/Hamfer%C3%B0?action=edit

{{ArtistHeader
|star       = Bronze
|homepage   = 
|facebook   = Hamferd
|myspace    = hamferd
|twitter    = hamferd
|wikipedia  = fo:Hamferð
|wikipedia2 = en:Hamferð
|country    = Faroe Islands
|state      = 
|hometown   = Tórshavn
}}

==[[Hamferð:Vilst Er Síðsta Fet (2010)|Vilst er síðsta fet (2010)]]==
{{Album Art||Vilst er síðsta fet}}
# '''[[Hamferð:Harra Guð Títt Dýra Navn Og Æra|Harra Guð títt dýra navn og æra]]'''
# '''[[Hamferð:Vráin|Vráin]]'''
# '''[[Hamferð:Aldan Revsar Eitt Vargahjarta|Aldan revsar eitt vargahjarta]]'''
# '''[[Hamferð:At Enda|At enda]]'''
{{clear}}

==[[Hamferð:Evst (2013)|Evst (2013)]]==
{{Album Art||Evst}}
# '''[[Hamferð:Evst|Evst]]'''
# '''[[Hamferð:Deyðir Varðar|Deyðir varðar]]'''
# '''[[Hamferð:Við Teimum Kvirru Gráu|Við teimum kvirru gráu]]'''
# '''[[Hamferð:At Jarða Tey Elskaðu|At jarða tey elskaðu]]'''
# '''[[Hamferð:Sinnisloysi|Sinnisloysi]]'''
# '''[[Hamferð:Ytst|Ytst]]'''
{{clear}}

==[[Hamferð:Támsins Likam (2018)|Támsins likam (2018)]]==
{{Album Art||Támsins likam}}
# '''[[Hamferð:Fylgisflog|Fylgisflog]]'''
# '''[[Hamferð:Stygd|Stygd]]'''
# '''[[Hamferð:Tvístevndur Meldur|Tvístevndur meldur]]'''
# '''[[Hamferð:Frosthvarv|Frosthvarv]]'''
# '''[[Hamferð:Hon Syndrast|Hon syndrast]]'''
# '''[[Hamferð:Vápn Í Anda|Vápn í anda]]'''
{{Clear}}

{{ArtistFooter
|fLetter     = H
|asin        = 
|iTunes      = 415357866
|allmusic    = mn0003690108
|discogs     = 3574951
|musicbrainz = 98e9584e-ace8-453e-8374-961584908f65
|spotify     = 4Okrb4EaAYXpRu2cx2ipa4
|youtube     = hamferdofficial
}}
{{MetalArchives|3540318967}}

Extract information like:

  • band's country
  • band's Spotify ID

Football

https://football.fandom.com/wiki/Michael_Owen

{{Infobox Biography
| playername = Michael Owen
| image = [[File:32371 231x264.jpg|150px]]
| fullname = Michael James Owen
| dateofbirth = {{Birth date and age|1979|12|14|df=y}}
| cityofbirth = Chester
| countryofbirth = {{Flagicon|ENG}} [[England]]
| dateofdeath = 
| cityofdeath = 
| countryofdeath = 
| height = {{height|m=1.75}}
| position = [[Striker]]
| currentclub = 
| clubnumber = 
| youthyears = 1991–1996
| youthclubs = [[Liverpool F.C.|Liverpool]]
| years = 1996–2004<br>2004–2005<br>2005–2009<br>2009–2012<br>2012–2013<br>Total
| clubs = [[Liverpool F.C.|Liverpool]]<br>[[Real Madrid C.F.|Real Madrid]]<br>[[Newcastle United F.C.|Newcastle United]]<br>[[Manchester United F.C.|Manchester United]]<br>[[Stoke City F.C.|Stoke City]]<br>
| caps(goals) = 216&nbsp;(118)<br>{{0}}35&nbsp;{{0}}(13)<br>{{0}}71&nbsp;{{0}}(26)<br>{{0}}31&nbsp;{{0}}{{0}}(5)<br>{{0}}{{0}}8&nbsp;{{0}}{{0}}(1)<br>'''362'''&nbsp;'''(163)'''
| nationalyears = 1997<br>1997<br>2006–2007<br>1998–2008<br>
| nationalteam = [[England national under-20 football team|England U-22]]<br>[[England national under-21 football team|England U-21]]<br>[[England B national football team|England B]]<br>[[England national football team|England]]
| nationalcaps(goals) = {{0}}{{0}}4&nbsp;{{0}}{{0}}(3)<br>{{0}}{{0}}1&nbsp;{{0}}{{0}}(1)<br>{{0}}{{0}}2&nbsp;{{0}}{{0}}(0)<br>{{0}}89&nbsp;{{0}}(40)
| manageryears = 
| managerclubs = 
}}
'''Michael James Owen''' (born 14 December 1979) is a former English [[association football|footballer]] who played as a [[Forward|striker]] for [[Liverpool F.C.|Liverpool]], [[Real Madrid C.F.|Real Madrid]], [[Newcastle United F.C.|Newcastle United]], [[Manchester United F.C.|Manchester United]] and [[Stoke City F.C.|Stoke City]], as well as for the [[England national football team|England national team]]. He is a regular pundit and co-commentator on BT Sport football coverage, and sometimes appears on BBC's ''Match of the Day'' as a pundit. Since retiring from football, he has become a successful racehorse breeder and owner.

==External links==
*[http://soccernet.espn.go.com/player/_/id/7930/michael-owen?cc=5739 ESPN Soccernet]
*[http://www.jockbio.com/Bios/Owen/Owen_numbers.html JockBio]
*[http://www.national-football-teams.com/v2/player.php?id=2190 National Football Teams]
*[http://www.fifa.com/worldfootball/statisticsandrecords/players/player=170722/ FIFA.com]
*[http://www.michaelowenofficial.com/ Michael Owen official website]
*[http://www.premierleague.com/page/PlayerProfile/0,,12306~5829,00.html Premier League]
*[http://www.soccerbase.com/players/player.sd?player_id=10509 Soccerbase]

{{England}}
{{England squad (FIFA World Cup 1998)}}
{{England squad (UEFA Euro 2000)}}
{{England squad (FIFA World Cup 2002)}}
{{England squad (UEFA Euro 2004)}}
{{England squad (FIFA World Cup 2006)}}

https://football.fandom.com/wiki/Newcastle_United_F.C.

{{Infobox Club
| clubname = Newcastle<br>United
| image    = [[File:Newcastle United FC.png|153px]]
| kitimage = [[File:Newcastle Utd 2018-19 home.png|80px]][[File:Newcastle Utd 2018-19 away.png|80px]][[File:Newcastle Utd 2018-19 third.png|80px]]
| fullname = Newcastle United Football Club
| nickname = The Magpies<br>The Toon, Geordies
| shortname = NUFC
| founded = 1881
| dissolved = 
| ground = [[St. James' Park]]
| capacity = 52,354
| owner = {{Flagicon|ENG}} [[Mike Ashley]]
| chairman = {{Flagicon|ENG}} Lee Charnley
| manager =  {{Flagicon|ESP}} [[Rafael Benítez]]
| coach = 
| currentleague = [[Premier League]]
| currentposition = 
| lastseason = [[Premier League 2017–18|2017–18]]
| lastleague = [[Premier League 2017–18|Premier League]]
| lastposition = 10th
| current = 2018-19
| website = http://www.nufc.co.uk
}}

'''Newcastle United Football Club''' (often abbreviated to '''NUFC''')

{{Fs player|no= 7|nat=ENG|pos=MF|name=[[Jacob Murphy]]}}
{{Fs player|no= 8|nat=ENG|pos=MF|name=[[Jonjo Shelvey]]}}
{{fs player|no=9|nat=VEN|pos=FW|name=[[Salomón Rondón]]|other=on loan from [[West Bromwich Albion F.C.|West Bromwich Albion]]}}
{{Fs player|no=10|nat=SEN|pos=MF|name=[[Mohamed Diamé]]}}

*{{Official website|http://www.nufc.co.uk/}}

https://football.fandom.com/wiki/Special:Export/Ole_Gunnar_Solskj%C3%A6r

https://github.com/earwig/mwparserfromhell#usage

>>> text = "I has a template! {{foo|bar|baz|eggs=spam}} See it?"
>>> wikicode = mwparserfromhell.parse(text)
>>> print(wikicode)
I has a template! {{foo|bar|baz|eggs=spam}} See it?
>>> templates = wikicode.filter_templates()
>>> print(templates)
['{{foo|bar|baz|eggs=spam}}']
>>> template = templates[0]
>>> print(template.name)
foo
>>> print(template.params)
['bar', 'baz', 'eggs=spam']
>>> print(template.get(1).value)
bar
>>> print(template.get("eggs").value)
spam