From 6fa1f349d914821e513c91100e51e8c07d00e993 Mon Sep 17 00:00:00 2001 From: Simon Alberny Date: Wed, 7 Jun 2023 22:35:54 +0200 Subject: [PATCH] Add AllocineFRSortiesBridge (#3421) --- bridges/AllocineFRSortiesBridge.php | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bridges/AllocineFRSortiesBridge.php diff --git a/bridges/AllocineFRSortiesBridge.php b/bridges/AllocineFRSortiesBridge.php new file mode 100644 index 00000000..b77c2f9b --- /dev/null +++ b/bridges/AllocineFRSortiesBridge.php @@ -0,0 +1,41 @@ +getURI()); + + foreach ($html->find('section.section.section-wrap', 0)->find('li.mdl') as $element) { + $item = []; + + $thumb = $element->find('figure.thumbnail', 0); + $meta = $element->find('div.meta-body', 0); + $synopsis = $element->find('div.synopsis', 0); + + $title = $element->find('a[class*=meta-title-link]', 0); + $content = trim(defaultLinkTo($thumb->outertext . $meta->outertext . $synopsis->outertext, static::URI)); + + // Replace image 'src' with the one in 'data-src' + $content = preg_replace('@src="data:image/gif;base64,[A-Za-z0-9=+\/]*"@', '', $content); + $content = preg_replace('@data-src=@', 'src=', $content); + + $item['content'] = $content; + $item['title'] = trim($title->innertext); + $item['uri'] = static::BASE_URI . '/' . substr($title->href, 1); + $this->items[] = $item; + } + } +}