Commit dc9c73a4 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'hotline' into 'hotline#77976_lien_hypertexte_sur_les_auteurs'

Hotline

See merge request !2766
parents a8bf9228 42b0dd71
Pipeline #4709 passed with stage
in 50 minutes and 4 seconds
......@@ -52,12 +52,13 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
return '';
$suite = $this->httpGet($url_lire_la_suite);
return strip_tags($this->extractResumeFromHTML($suite));
return trim(strip_tags($this->extractResumeFromHTML($suite)));
}
public function getUrlLireLaSuite($data) {
$pos = ($pos = striPos($data,"summary")) ? $pos : striPos($data, 'resume');
if(!$pos)
return '';
......@@ -71,7 +72,7 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
if($pos = striPos($html, 'resMarkContent'))
return $this->extractResumeFormBlk($html);
if ($pos = striPos($html, "avisEdContent"))
if ($pos = striPos($html, 'id="Opinions"'))
return $this->extractLireLaSuiteDivAvisEditeurFromHTML($html);
if ($pos = striPos($html, "ficheResume"))
......@@ -122,7 +123,10 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
public function extractLireLaSuiteDivAvisEditeurFromHTML($html) {
$pos = strPos($html, "avisEdContent") + 15;
$pos = strPos($html, 'id="Opinions">') + 15;
$pos = strPos($html, '<div class="whiteContent', $pos) + 25;
$pos = strPos($html, '>', $pos) + 1;
$posfin = strPos($html, "</div>", $pos);
$resume = substr($html, $pos, ($posfin-$pos));
return trim($resume);
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ abstract class FnacTestCase extends PHPUnit_Framework_TestCase {
class FnactHarryPotterTest extends FnacTestCase {
class FnacHarryPotterTest extends FnacTestCase {
public function setup() {
parent::setUp();
......@@ -90,9 +90,9 @@ class FnacMilleniumTest extends FnacTestCase {
/** @test */
public function getResumeShouldFetchItFromPotterSuite() {
public function getResumeShouldFetchItFromMilleniumSuite() {
$resume = $this->_fnac->getResume('978-2-7427-6501-0');
$this->assertEquals('Une enquête sur un réseau de prostitution dévoile des secrets d\'espionnage et un lourd passé familial.',
$this->assertEquals('Tandis que Lisbeth Salander coule des journées supposées tranquilles aux Caraïbes',
$resume);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment