Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Fix #62: Fix Google+ +1 share count
Browse files Browse the repository at this point in the history
  • Loading branch information
eyecatchup committed Jan 19, 2014
1 parent 52f64a8 commit 31f8b9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SEOstats/Services/Social.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Stephan Schmitz <[email protected]>
* @copyright Copyright (c) 2010 - present Stephan Schmitz
* @license http://eyecatchup.mit-license.org/ MIT License
* @updated 2013/12/16
* @updated 2014/01/19
*/

use SEOstats\SEOstats as SEOstats;
Expand Down Expand Up @@ -36,9 +36,9 @@ public static function getGooglePlusShares($url = false)
$url = parent::getUrl($url);
$dataUrl = sprintf(Config\Services::GOOGLE_PLUSONE_URL, urlencode($url));
$html = parent::_getPage($dataUrl);
@preg_match_all('#c: (.*?)\.0#si', $html, $matches);
@preg_match_all('/window\.__SSR\s\=\s\{c:\s(\d+?)\./', $html, $match, PREG_SET_ORDER);

return isset($matches[1][0]) ? intval($matches[1][0]) : parent::noDataDefaultValue();
return (1 === sizeof($match) && 2 === sizeof($match[0])) ? intval($match[0][1]) : parent::noDataDefaultValue();
}

/**
Expand Down

0 comments on commit 31f8b9a

Please sign in to comment.