Forum:Accessing Plaintext Description of Article

Greetings, is there any way at all of generating a simple plain-text return of the first section of a Memory-Alpha article?

This is as close a construction as I've been able to come: http://memory-alpha.org/index.php?title=USS_Enterprise_(NCC-1701-A)&action=raw&ctype=text/css&prop=sections&section=0

but that generates: (last-line description linebreaks added to avoid horizontal scrollbar of death)

The USS Enterprise (NCC-1701-A) was the second starship commissioned by the Federation with the name Enterprise. She was constructed at the San Francisco Fleet Yards and commissioned at the Earth Spacedock facility in 2286.

When I'd prefer to have the plain-text that meta-content "description" generates of the regular page header. Which is:

The USS Enterprise (NCC-1701-A) was the second Constitution-class starship commissioned by the Federation with the name Enterprise. She was constructed at the San Francisco Fleet Yards and commissioned at the Earth Spacedock facility in 2286.

Yes, I am "lazy" and don't want to have to build a wiki-formatting stripper/parser (keep Constitution but throwout ShipClass, keep possessive apostrophes but not the rest, etc). All I want is that first smidgen of the article in plain-text but my research into the API and index.php?action=raw don't seem to indicate a method of achieving that.

For those curious. I would like a utility that does a lookup of a Memory-Alpha article and returns a plain-text brief description (usually the first paragraph fits the bill) and a link to the full article.

Help is appreciated, thanks. -- Eipy 09:22, September 14, 2010 (UTC)


 * If the meta-content description contains what you need, then why don't you just have your utility request the regular version of the article and grab the value of exactly that attribute? :) -- Cid Highwind 12:30, September 14, 2010 (UTC)

Very fair question! I know, right, especially since my program can already do that!? But... it's not for me it's for James T. Kirk, it's for Worf, it's for Riker & Picard too (not to mention Star Trek parodies and pop culture references (television) (and all the rest). It seems inefficient and wasteful to download all of Worf's 91.97 KB page, when all I want is 0.85 KB (or less than 870 bytes). Quite piggy of me to ask for everything when all I want is a sample.

My application is still pretty fast but why be 108% greedy? And well, it could be that my server has been lagging on the DL a bit. -- Eipy 17:10, September 14, 2010 (UTC)


 * OK, that's sensible. I found the additional parameter "templates=expand" in the index.php documentation - this at least partially resolves the template issue: http://memory-alpha.org/index.php?title=USS_Enterprise_(NCC-1701-A)&action=raw&templates=expand&ctype=text/css&prop=sections&section=0 -- Cid Highwind 18:15, September 14, 2010 (UTC)
 * Hm, that's different but still not quite down to plain-text. Though, I realize, maybe stripping the wiki-text formatting mightn't be that hard (famous last words).  It seems I could strip all non-single apostrophes, HTML tags, square brackets and anything in the first parameter, all content in curly brackets.  I'll wait to see if there are other suggestions before I try and mock that up. Eipy 18:39, September 14, 2010 (UTC)