public function getScraper($id) { if (Sentry::check()) { $user = Sentry::getUser(); if ($user->isSuperUser()) { $data = Mirror::put($id); return View::make('debug', array('debug' => $data)); } } return 'You must be a super user for this feature.'; }
public static function scrapeAllAnimeWithNoEpisodes() { $animes = DB::table('series')->select('id', 'name')->get(); ob_implicit_flush(1); foreach ($animes as $anime) { $mirrors = DB::table('mirrors')->where("anime_id", "=", $anime->id)->select('id')->get(); if (empty($mirrors) && count($mirrors) === 0) { echo 'Started scraping anime: ' . $anime->name . '<br>'; echo Mirror::put($anime->id); } } return "<br> Scraped anime!"; }
return 'Not allowed!'; }); Route::get('/anime/scraper/{id}/{startep}', function ($id, $startep) { if (Sentry::check()) { $user = Sentry::getUser(); if ($user->isSuperUser()) { return Mirror::put($id, false, $startep); } } return 'Not allowed!'; }); Route::get('/anime/scraper/{id}', function ($id) { if (Sentry::check()) { $user = Sentry::getUser(); if ($user->isSuperUser()) { return Mirror::put($id); } } return 'Not allowed!'; }); Route::post('/watch/anime/mirror', function () { if (Request::ajax()) { $mirror = Mirror::find(Input::get('id')); if (!empty($mirror)) { return '<iframe frameborder="0" scrolling="no" width="100%" height="510" src="' . $mirror->src . '" allowfullscreen></iframe>'; } return 'Could not find the mirror in our database.'; } return 'AJAX requests only.'; }); Route::get('/anime/scraper/{id}', 'AnimeController@getScraper');
public function scrape() { Mirror::put($this->id, true, $this->episode); }