dimanche 2 juillet 2017

How to organize many crawler functions?

I build a little statistics service with Laravel. I crawl some sites and get stats from there for my application. For example I get the subscriber count from YouTube and Twitter.

public function getYouTubeStats() {}
public function getTwitterStats() {}
public function getFacebookStats() {}
...

So right now I have one controller with 20 or 30 functions where every crawler needs his own function because obviously every external site is different. But I don't think such a large controller is good for future development. So my question is how could I organize this?

I could make an own controller for every crawler. But I can't get the functions from other controllers in my main crawl-controller. For example I need the function getStats() from YouTubeController in the MainCrawler controller. I don't think there is an easy way to do this?

Or should I make a new Model for every service?

$youtube = new YouTubeStat::getStats();
$twitter = new TwitterStat::getStats();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire