-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessMovie.php
More file actions
30 lines (24 loc) · 1.26 KB
/
ProcessMovie.php
File metadata and controls
30 lines (24 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace MovieParser\IMDB\Matcher;
class ProcessMovie
{
public function process(string $response) : array
{
$match = \Atrox\Matcher::multi([
'id' => \Atrox\Matcher::single('//meta[@property="pageId"]/@content'),
'title' => \Atrox\Matcher::single('//h1/text()'),
'year' => \Atrox\Matcher::single('//span[@id="titleYear"]/a/text()'),
'rating' => \Atrox\Matcher::single('//span[@itemprop="ratingValue"]/text()'),
'ratingCount' => \Atrox\Matcher::single('//span[@itemprop="ratingCount"]/text()'),
'poster' => \Atrox\Matcher::single('//div[@class="poster"]/a/img/@src'),
'description' => \Atrox\Matcher::single('//div[@class="summary_text"]/text()'),
'genres' => \Atrox\Matcher::multi('//h4[contains(text(), "Genres")]/following-sibling::a/text()'),
'links' => \Atrox\Matcher::multi('//div[@class="quicklinkSectionItem"]/a[@class="quicklink"]/@href'),
'season' => \Atrox\Matcher::single('//div[@class="button_panel navigation_panel"]/div/div/div/div/text()[1]'),
'episode' => \Atrox\Matcher::single('//div[@class="button_panel navigation_panel"]/div/div/div/div/text()[2]'),
'show' => \Atrox\Matcher::single('//div[@class="titleParent"]/a/@href'),
])
->fromHtml();
return $match($response);
}
}