How to extract data from a Wikipedia article?

前端 未结 2 857
时光说笑
时光说笑 2021-02-03 14:09

I have a question regarding parsing data from Wikipedia for my Android app. I have a script that can download the XML by reading the source from http://en.wikipedia.org/w/

2条回答
  •  余生分开走
    2021-02-03 14:50

    action=parse doesn't work well with per-section parse, consider this shoert example:

    Foo is a barreally!
    == References ==
    
    

    Parsing just the zeroth section will result in red error message about without while parsing the first one will result in empty references list.

    However, there's a better solution: action=mobileview is not only free from this problem, but it's also specifically intended for mobile apps and gives you mobile-optimized HTML.

提交回复
热议问题