mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
parent
66568e3a39
commit
4f75591060
398 changed files with 58607 additions and 56442 deletions
|
@ -1,37 +1,41 @@
|
|||
<?php
|
||||
class NYTBridge extends FeedExpander {
|
||||
|
||||
const MAINTAINER = 'IceWreck';
|
||||
const NAME = 'New York Times Bridge';
|
||||
const URI = 'https://www.nytimes.com/';
|
||||
const CACHE_TIMEOUT = 900; // 15 minutes
|
||||
const DESCRIPTION = 'RSS feed for the New York Times';
|
||||
class NYTBridge extends FeedExpander
|
||||
{
|
||||
const MAINTAINER = 'IceWreck';
|
||||
const NAME = 'New York Times Bridge';
|
||||
const URI = 'https://www.nytimes.com/';
|
||||
const CACHE_TIMEOUT = 900; // 15 minutes
|
||||
const DESCRIPTION = 'RSS feed for the New York Times';
|
||||
|
||||
public function collectData(){
|
||||
$this->collectExpandableDatas('https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml', 40);
|
||||
}
|
||||
public function collectData()
|
||||
{
|
||||
$this->collectExpandableDatas('https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml', 40);
|
||||
}
|
||||
|
||||
protected function parseItem($newsItem){
|
||||
$item = parent::parseItem($newsItem);
|
||||
$article = '';
|
||||
protected function parseItem($newsItem)
|
||||
{
|
||||
$item = parent::parseItem($newsItem);
|
||||
$article = '';
|
||||
|
||||
// $articlePage gets the entire page's contents
|
||||
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
||||
// $articlePage gets the entire page's contents
|
||||
$articlePage = getSimpleHTMLDOM($newsItem->link);
|
||||
|
||||
// handle subtitle
|
||||
$subtitle = $articlePage->find('p.css-w6ymp8', 0);
|
||||
if ($subtitle != null) {
|
||||
$article .= '<strong>' . $subtitle->plaintext . '</strong>';
|
||||
}
|
||||
// handle subtitle
|
||||
$subtitle = $articlePage->find('p.css-w6ymp8', 0);
|
||||
if ($subtitle != null) {
|
||||
$article .= '<strong>' . $subtitle->plaintext . '</strong>';
|
||||
}
|
||||
|
||||
// figure contain's the main article image
|
||||
$article .= $articlePage->find('figure', 0) . '<br />';
|
||||
// figure contain's the main article image
|
||||
$article .= $articlePage->find('figure', 0) . '<br />';
|
||||
|
||||
// section.meteredContent has the actual article
|
||||
foreach($articlePage->find('section.meteredContent p') as $element)
|
||||
$article .= '' . $element . '';
|
||||
// section.meteredContent has the actual article
|
||||
foreach ($articlePage->find('section.meteredContent p') as $element) {
|
||||
$article .= '' . $element . '';
|
||||
}
|
||||
|
||||
$item['content'] = $article;
|
||||
return $item;
|
||||
}
|
||||
$item['content'] = $article;
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue