Skip to content

Commit

Permalink
NetNaija filter bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmard authored and Ahmard committed Jan 20, 2021
1 parent 6ba77b6 commit 7e6664b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Video/Search/NetNaijaSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ public function get(int $pageNumber = 1): array
{
$searchResults = [];
//If movies is chosen, the we will scrape videos page and filter out movies
$isMoviesCategory = false;
if (self::CAT_MOVIES == $this->paramValues['{category}']) {
$isMoviesCategory = true;
$this->paramValues['{category}'] = self::CAT_VIDEOS;
}

$queryList = Client::get($this->getConstructedUrl($pageNumber))->execute();

$queryList->find('article[class="result"]')
->each(function (Elements $element) use (&$searchResults) {
->each(function (Elements $element) use (&$searchResults, $isMoviesCategory) {
$infoElement = $element->find('div.result-info h3');
$title = $infoElement->text();
//Handles movies filter
if (self::CAT_MOVIES == $this->paramValues['{category}']) {
if (false === strpos($title, 'Movie:')) {
if ($isMoviesCategory) {
if (false === strpos($title, 'Movie')) {
return false;
}
}
Expand Down

0 comments on commit 7e6664b

Please sign in to comment.