mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-02-16 15:19:55 +03:00
[HinduTamilBridge] refactor (#4146)
* [HinduTamilBridge] refactor * [HinduTamilBridge] fixed lint * [HinduTamilBridge] fixed lint 2 * Update HinduTamilBridge.php
This commit is contained in:
parent
4539eb69aa
commit
da8cfdf179
1 changed files with 13 additions and 14 deletions
|
@ -63,18 +63,18 @@ class HinduTamilBridge extends FeedExpander
|
||||||
protected function parseItem($item)
|
protected function parseItem($item)
|
||||||
{
|
{
|
||||||
$dom = getSimpleHTMLDOMCached($item['uri']);
|
$dom = getSimpleHTMLDOMCached($item['uri']);
|
||||||
|
|
||||||
$date = $dom->find('p span.date', 1);
|
|
||||||
if ($date) {
|
|
||||||
$item['timestamp'] = $this->convertToRFC3339($date->plaintext);
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = $dom->find('#pgContentPrint', 0);
|
$content = $dom->find('#pgContentPrint', 0);
|
||||||
if (!$content) {
|
|
||||||
|
if ($content === null) {
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = $dom->find('#LoadArticle figure', 0);
|
$date = $dom->find('p span.date', 1);
|
||||||
|
if ($date) {
|
||||||
|
$item['timestamp'] = $this->toRFC3339($date->plaintext);
|
||||||
|
}
|
||||||
|
|
||||||
|
$image = $dom->find('#LoadArticle figure', 0) ?? '';
|
||||||
$item['content'] = $image . $this->cleanContent($content);
|
$item['content'] = $image . $this->cleanContent($content);
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
|
@ -89,15 +89,14 @@ class HinduTamilBridge extends FeedExpander
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function convertToRFC3339($DateString)
|
private function toRFC3339($dateString)
|
||||||
{
|
{
|
||||||
$timestamp = strtotime(trim($DateString));
|
$timestamp = strtotime(trim($dateString));
|
||||||
|
|
||||||
if ($timestamp !== false) {
|
if ($timestamp === false) {
|
||||||
$rfc3339DateTime = date('Y-m-d\TH:i:s', $timestamp) . '+05:30';
|
|
||||||
return $rfc3339DateTime;
|
|
||||||
} else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return date('Y-m-d\TH:i:s', $timestamp) . '+05:30';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue