diff --git a/bridges/RadioMelodieBridge.php b/bridges/RadioMelodieBridge.php
index 6807f589..703eb6e0 100644
--- a/bridges/RadioMelodieBridge.php
+++ b/bridges/RadioMelodieBridge.php
@@ -12,12 +12,7 @@ class RadioMelodieBridge extends BridgeAbstract {
public function collectData(){
$html = getSimpleHTMLDOM(self::URI . '/actu/')
or returnServerError('Could not request Radio Melodie.');
- $list = $html->find('div[class=displayList]', 0)->children();
-
- $dateFormat = '%A %e %B %Y à %H:%M';
- // Set locale and Timezone to parse the date
- setlocale (LC_TIME, 'fr_FR.utf8');
- date_default_timezone_set('Europe/Paris');
+ $list = $html->find('div[class=listArticles]', 0)->children();
foreach($list as $element) {
if($element->tag == 'a') {
@@ -34,7 +29,7 @@ class RadioMelodieBridge extends BridgeAbstract {
$picture = array();
// Get the Main picture URL
- $picture[] = self::URI . $article->find('div[id=pictureTitleSupport]', 0)->find('img', 0)->src;
+ $picture[] = self::URI . $article->find('figure[class=photoviewer]', 0)->find('img', 0)->src;
$audioHTML = $article->find('audio');
// Add the audio element to the enclosure
@@ -57,26 +52,14 @@ class RadioMelodieBridge extends BridgeAbstract {
$article->save();
}
- // Remove Radio Melodie Logo
- $logoHTML = $article->find('div[id=logoArticleRM]', 0);
- $logoHTML->outertext = '';
- $article->save();
-
- $author = $article->find('p[class=AuthorName]', 0)->plaintext;
+ // Extract the author
+ $author = $article->find('div[class=author]', 0)->children(1)->children(0)->plaintext;
// Handle date to timestamp
- $dateHTML = $article->find('p[class=date]', 0)->plaintext;
- preg_match('/\| ([^-]*)( - .*|)$/', $dateHTML, $matches);
+ $dateHTML = $article->find('div[class=author]', 0)->children(1)->plaintext;
+ preg_match('/([a-z]{4,10}[ ]{1,2}[0-9]{1,2} [\p{L}]{4,10} [0-9]{4} à [0-9]{2}:[0-9]{2})/mus', $dateHTML, $matches);
$dateText = $matches[1];
- $dateArray = strptime($dateText, $dateFormat);
- $timestamp = mktime(
- $dateArray['tm_hour'],
- $dateArray['tm_min'],
- $dateArray['tm_sec'],
- $dateArray['tm_mon'] + 1,
- $dateArray['tm_mday'],
- $dateArray['tm_year'] + 1900
- );
+ $timestamp = $this->parseDate($dateText);
$item['enclosures'] = array_merge($picture, $audio);
$item['author'] = $author;
@@ -86,22 +69,15 @@ class RadioMelodieBridge extends BridgeAbstract {
$item['timestamp'] = $timestamp;
}
- // Header Image
- $header = '';
-
- // Remove the Date and Author part
- $textDOM->find('div[class=AuthorDate]', 0)->outertext = '';
-
- // Remove Facebook javascript
- $textDOM->find('script[src^=https://connect.facebook.net]', 0)->outertext = '';
+ // Remove the share article part
+ $textDOM->find('div[class=share]', 0)->outertext = '';
// Rewrite relative Links
$textDOM = defaultLinkTo($textDOM, self::URI . '/');
$article->save();
- //$this->rewriteAudioPlayers($textDOM);
$text = $textDOM->innertext;
- $item['content'] = '