Page MenuHomePhabricator

Warnings for extract (HTML may be malformed...)
Closed, DuplicatePublic

Description

Hi,

I display the wiki extract of famous people on my site.
It worked well but for some time, the extract appears only for a part of people.
The message returned is:

"HTML may be malformed and / or unbalanced and may be omitted inline images.Use: http://www.mediawiki.org/wiki/Extension:TextExtracts#Caveats."

Here is a request that returns this message:
https://fr.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&titles=Abdou_Diouf

And another with which, the extract is displayed well:
https://fr.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&titles=Susan_Boyle

Thanks for your help.

Event Timeline

@Agold10: The warning is always shown, I think?
Is the actual problem that the extract is empty, and not that you get a warning? If so, please rephrase the task summary. Thanks!

The warning is present on all the requests.
The extract is returned for most of the queries
However, the extract is sometimes empty. (The Wikipedia page for these queries does exist.)

My problem is that the extract is empty

I did not notice the problem so far because the extract is displayed on most of my pages.

Now, some new pages of my site don't display the extract. I haven't touched my php code below.

$url='https://'.$lang.'.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&titles='.$q;
$wikiInfo= httpGet($url);
$searchResponse=json_decode($wikiInfo,true);

if(count($searchResponse)==0){
$q=str_replace(" ","_",$q);	

$url='https://'.$lang.'.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&titles='.$q;
$wikiInfo= httpGet($url);
$searchResponse=json_decode($wikiInfo,true);
}

$searchResponse=$searchResponse['query']['pages'];
if (!empty($searchResponse))
{
	foreach($searchResponse as $value){
		$wikiResponse=$value;
	}
}

Thank you.