コード例 #1
0
ファイル: YouTube.php プロジェクト: pmill/php-extract
 /**
  * @param Crawler $crawler
  * @return ExtractedOwner
  */
 public function extractOwner(Crawler $crawler)
 {
     $owner = new ExtractedOwner();
     $owner->setName(trim(implode("", $crawler->filter(".yt-user-info")->extract(array('_text')))));
     $owner->setAvatarByUrl(trim(implode("", $crawler->filter(".yt-thumb-clip img")->extract(array('data-thumb')))));
     return $owner;
 }
コード例 #2
0
ファイル: BehanceProject.php プロジェクト: pmill/php-extract
 /**
  * @param Crawler $crawler
  * @return ExtractedOwner
  */
 public function extractOwner(Crawler $crawler)
 {
     $owner = new ExtractedOwner();
     $owner->setAvatarByUrl($crawler->filter('.project-owner-info img.profile-list-image')->attr('src'));
     $owner->setName(StringHelper::filterText($crawler, '.project-owner-info .profile-list-name a'));
     return $owner;
 }
コード例 #3
0
ファイル: Flickr.php プロジェクト: pmill/php-extract
 /**
  * @param Crawler $crawler
  * @return ExtractedOwner
  */
 public function extractOwner(Crawler $crawler)
 {
     $ownerImageProperty = $crawler->filter('.photo-attribution .avatar')->attr('style');
     preg_match("/background-image: url\\((.*)\\);/", $ownerImageProperty, $ownerImageOutput);
     $owner = new ExtractedOwner();
     if (count($ownerImageOutput) == 2) {
         $owner->setAvatarByUrl($ownerImageOutput[1]);
     }
     $owner->setName(StringHelper::filterText($crawler, '.owner-name:first-child'));
     return $owner;
 }
コード例 #4
0
ファイル: Vimeo.php プロジェクト: pmill/php-extract
 /**
  * @param Crawler $crawler
  * @param $oembedData
  * @return ExtractedOwner
  */
 public function extractOwner(Crawler $crawler, $oembedData)
 {
     $owner = new ExtractedOwner();
     if (is_array($oembedData) && isset($oembedData['author_name'])) {
         $owner->setName($oembedData['author_name']);
     } else {
         $owner->setName(trim(implode("", $crawler->filter("*[rel='author']")->extract(array('_text')))));
     }
     $owner->setAvatarByUrl(trim(implode("", $crawler->filter(".portrait_lg")->extract(array('srcset')))));
     return $owner;
 }