Skip to content

Commit

Permalink
[SymfonyCasts] Added new bridge (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
Park0 committed Feb 28, 2021
1 parent 569276f commit a5f2175
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions bridges/SymfonyCastsBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

class SymfonyCastsBridge extends BridgeAbstract {
const NAME = 'SymfonyCasts Bridge';
const URI = 'https://symfonycasts.com/';
const DESCRIPTION = 'Follow new updates on symfonycasts.com';
const MAINTAINER = 'Park0';
const CACHE_TIMEOUT = 3600;

public function collectData() {
$html = getSimpleHTMLDOM('https://symfonycasts.com/updates/find')
or returnServerError('Unable to get page.');
$dives = $html->find('div');

/* @var simple_html_dom $div */
foreach ($dives as $div) {
$id = $div->getAttribute('data-mark-update-id-value');
$type = $div->find('h5', 0);
$title = $div->find('span', 0);
$dateString = $div->find('h5.font-gray', 0);
$href = $div->find('a', 0);
$url = 'https://symfonycasts.com' . $href->getAttribute('href');

$item = array(); // Create an empty item
$item['uid'] = $id;
$item['title'] = $title->innertext;
$item['timestamp'] = $dateString->innertext;
$item['content'] = $type->plaintext . '<a href="' . $url . '">' . $title . '</a>';
$item['uri'] = $url;
$this->items[] = $item; // Add item to the list
}

}
}

0 comments on commit a5f2175

Please sign in to comment.