Refactored CinemaCity repertoire fetcher.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Paper\CinemaCinemaCity;
|
||||
use App\Paper\CinemaHelios;
|
||||
use App\Paper\CinemaMultikino;
|
||||
use DiDom\Document;
|
||||
@@ -21,65 +22,31 @@ class Repertoire extends Controller
|
||||
|
||||
public function today_cinemacity()
|
||||
{
|
||||
$date = date('d/m/Y');
|
||||
$repertuarText = $this->cinemacityRepertuar($date);
|
||||
// $this->main->sendPrint('', $repertuarText, $this->icon, $this->icon);
|
||||
|
||||
$cinemacity = new CinemaCinemaCity();
|
||||
$cinemacity->setCinemaId(1010912);
|
||||
$cinemacity->setDay(date('Y-m-d'));
|
||||
$repertuarText = $cinemacity->convertToPrint();
|
||||
|
||||
$this->main->sendPrint('', $repertuarText, $this->icon);
|
||||
return back();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function tomorrow_cinemacity()
|
||||
{
|
||||
$date = new \DateTime();
|
||||
$date->modify('+1 day');
|
||||
$repertuarText = $this->cinemacityRepertuar($date->format('d/m/Y'));
|
||||
// $this->main->sendPrint('', $repertuarText, $this->icon, $this->icon);
|
||||
$cinemacity = new CinemaCinemaCity();
|
||||
$cinemacity->setCinemaId(1010912);
|
||||
$cinemacity->setDay(date_create()->modify('+1 day')->format('Y-m-d'));
|
||||
$repertuarText = $cinemacity->convertToPrint();
|
||||
|
||||
$this->main->sendPrint('', $repertuarText, $this->icon);
|
||||
return back();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function cinemacityRepertuar($date)
|
||||
{
|
||||
$url = 'https://www.cinema-city.pl/scheduleInfo?locationId=1010308&date=' . $date . '&venueTypeId=0&hideSite=false&openedFromPopup=1';
|
||||
|
||||
$document = new Document($url, true);
|
||||
$text = "Repertuar Cinema-City\n";
|
||||
$text .= str_replace('/', '-', $date) . "\n\n";
|
||||
|
||||
$movies = $document->find('table tbody tr');
|
||||
foreach ($movies as $movie) {
|
||||
// dump($movie);
|
||||
$text .= $movie->find('.featureLink')[0]->text() . "\n";
|
||||
$hours = [];
|
||||
foreach ($movie->find('.prsnt a') as $projection) {
|
||||
$hours[] = trim($projection->text());
|
||||
}
|
||||
$text .= implode(', ', $hours) . "\n\n";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
// private function multikinoRepertuar($date)
|
||||
// {
|
||||
//
|
||||
// $text = '';
|
||||
// $repertuar = json_decode(file_get_contents('https://multikino.pl/pl/repertoire/cinema/seances?id=4&from=' . $date));
|
||||
// $text .= "Repertuar Multikino Gdańsk\n";
|
||||
// $text .= $date . "\n\n";
|
||||
//
|
||||
// foreach ($repertuar->results as $movie) {
|
||||
// $text .= $movie->title . "\n";
|
||||
// $text .= $movie->print_version . "\n";
|
||||
//
|
||||
// $hours = [];
|
||||
// foreach ($movie->seances as $seans) {
|
||||
// $hours[] = date('H:i', strtotime($seans->beginning_date));
|
||||
// }
|
||||
// $text .= implode(', ', $hours) . "\n\n";
|
||||
// }
|
||||
//
|
||||
// return $text;
|
||||
// }
|
||||
|
||||
public function today_multikino()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user