marabesi / social-crawler

此软件包最新版本(v0.0.1)没有提供许可证信息。

通过社交网络轻松查找电子邮件

v0.0.1 2018-10-21 17:34 UTC

This package is not auto-updated.

Last update: 2024-09-18 06:43:36 UTC


README

Codacy Badge Build Status

社交爬虫

从社交网络中查找电子邮件!

依赖关系

  • Google URL
  • Monolog

在Instagram中查找Gmail中的电子邮件

定义您要查找的电子邮件以及您想要搜索的位置,在我们的例子中,我们将从Instagram中查找Gmail中的电子邮件:

$factory = new \SocialCrawler\Domain\Factory();
$email = $factory->create(\SocialCrawler\Domain\Gmail::GMAIL);

$source =  new \SocialCrawler\Domain\Source\Instagram();

然后,只需使用 GoogleUrl 执行搜索。

$engine = new \GoogleUrl();
$search = new \SocialCrawler\Domain\Container($engine, $source);

$result = $search->retrieveDataFromSource($email, $page)
    ->getResultSet();

作为最后一步,遍历结果以获取电子邮件。

foreach ($result as $object) {
    try {
        print $email->find($object->getTitle()) . '<br/>';
    } catch (\Exception $exception) {
        //print "Couldn't find email in the object in the title ({$object->getTitle()}) <br/>";
    } finally {
        try {
           print $email->find($object->getSnippet()) . '<br/>';
        } catch (\Exception $exception) {
            //print "Couldn't find email in the object in the snippet ({$object->getSnippet()}) <br/>";
        }
    }
}