mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-10 05:27:27 +03:00
refactor: remove dead code (#4385)
This commit is contained in:
parent
7c6d4a932c
commit
c44a76ff17
33 changed files with 52 additions and 106 deletions
|
@ -32,8 +32,7 @@ class AirBreizhBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = '';
|
$html = '';
|
||||||
$html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme'))
|
$html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme'));
|
||||||
or returnClientError('No results for this query.');
|
|
||||||
|
|
||||||
foreach ($html->find('article') as $article) {
|
foreach ($html->find('article') as $article) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|
|
@ -146,7 +146,7 @@ EOT;
|
||||||
{
|
{
|
||||||
$uri = $this->getURI();
|
$uri = $this->getURI();
|
||||||
|
|
||||||
return getSimpleHTMLDOM($uri) ?: returnServerError('Could not request Amazon.');
|
return getSimpleHTMLDOM($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function scrapePriceFromMetrics($html)
|
private function scrapePriceFromMetrics($html)
|
||||||
|
|
|
@ -105,8 +105,7 @@ class AssociatedPressNewsBridge extends BridgeAbstract
|
||||||
|
|
||||||
private function collectCardData()
|
private function collectCardData()
|
||||||
{
|
{
|
||||||
$json = getContents($this->getTagURI())
|
$json = getContents($this->getTagURI());
|
||||||
or returnServerError('Could not request: ' . $this->getTagURI());
|
|
||||||
|
|
||||||
$tagContents = json_decode($json, true);
|
$tagContents = json_decode($json, true);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class BAEBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = $this->getURI();
|
$url = $this->getURI();
|
||||||
$html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.');
|
$html = getSimpleHTMLDOM($url);
|
||||||
|
|
||||||
$annonces = $html->find('main article');
|
$annonces = $html->find('main article');
|
||||||
foreach ($annonces as $annonce) {
|
foreach ($annonces as $annonce) {
|
||||||
|
|
|
@ -93,8 +93,7 @@ class BandcampDailyBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM($this->getURI())
|
$html = getSimpleHTMLDOM($this->getURI());
|
||||||
or returnServerError('Could not request: ' . $this->getURI());
|
|
||||||
|
|
||||||
$html = defaultLinkTo($html, self::URI);
|
$html = defaultLinkTo($html, self::URI);
|
||||||
|
|
||||||
|
@ -105,8 +104,7 @@ class BandcampDailyBridge extends BridgeAbstract
|
||||||
|
|
||||||
$articlePath = $article->find('a.title', 0)->href;
|
$articlePath = $article->find('a.title', 0)->href;
|
||||||
|
|
||||||
$articlePageHtml = getSimpleHTMLDOMCached($articlePath, 3600)
|
$articlePageHtml = getSimpleHTMLDOMCached($articlePath, 3600);
|
||||||
or returnServerError('Could not request: ' . $articlePath);
|
|
||||||
|
|
||||||
$item['uri'] = $articlePath;
|
$item['uri'] = $articlePath;
|
||||||
$item['title'] = $articlePageHtml->find('article-title', 0)->innertext;
|
$item['title'] = $articlePageHtml->find('article-title', 0)->innertext;
|
||||||
|
|
|
@ -26,8 +26,7 @@ TMPL;
|
||||||
https://www.bundestag.de/ajax/filterlist/de/parlament/praesidium/parteienfinanzierung/fundstellen50000/462002-462002
|
https://www.bundestag.de/ajax/filterlist/de/parlament/praesidium/parteienfinanzierung/fundstellen50000/462002-462002
|
||||||
URI;
|
URI;
|
||||||
// Get the main page
|
// Get the main page
|
||||||
$html = getSimpleHTMLDOMCached($ajaxUri, self::CACHE_TIMEOUT)
|
$html = getSimpleHTMLDOMCached($ajaxUri, self::CACHE_TIMEOUT);
|
||||||
or returnServerError('Could not request AJAX list.');
|
|
||||||
|
|
||||||
// Build the URL from the first anchor element. The list is sorted by year, descending, so the first element is the current year.
|
// Build the URL from the first anchor element. The list is sorted by year, descending, so the first element is the current year.
|
||||||
$firstAnchor = $html->find('a', 0)
|
$firstAnchor = $html->find('a', 0)
|
||||||
|
@ -36,8 +35,7 @@ URI;
|
||||||
$url = 'https://www.bundestag.de' . $firstAnchor->href;
|
$url = 'https://www.bundestag.de' . $firstAnchor->href;
|
||||||
|
|
||||||
// Get the actual page with the soft money donations
|
// Get the actual page with the soft money donations
|
||||||
$html = getSimpleHTMLDOMCached($url, self::CACHE_TIMEOUT)
|
$html = getSimpleHTMLDOMCached($url, self::CACHE_TIMEOUT);
|
||||||
or returnServerError('Could not request ' . $url);
|
|
||||||
|
|
||||||
$rows = $html->find('table.table > tbody > tr')
|
$rows = $html->find('table.table > tbody > tr')
|
||||||
or returnServerError('Could not find the proper HTML elements.');
|
or returnServerError('Could not find the proper HTML elements.');
|
||||||
|
|
|
@ -109,7 +109,7 @@ class CrewbayBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = $this->getURI();
|
$url = $this->getURI();
|
||||||
$html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.');
|
$html = getSimpleHTMLDOM($url);
|
||||||
|
|
||||||
$annonces = $html->find('#SearchResults div.result');
|
$annonces = $html->find('#SearchResults div.result');
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
|
@ -53,8 +53,7 @@ class DacksnackBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$NEWSURL = self::URI;
|
$NEWSURL = self::URI;
|
||||||
$html = getSimpleHTMLDOMCached($NEWSURL, 18000) or
|
$html = getSimpleHTMLDOMCached($NEWSURL, 18000);
|
||||||
returnServerError('Could not request: ' . $NEWSURL);
|
|
||||||
|
|
||||||
foreach ($html->find('a.main-news-item') as $element) {
|
foreach ($html->find('a.main-news-item') as $element) {
|
||||||
// Debug::log($element);
|
// Debug::log($element);
|
||||||
|
@ -64,8 +63,7 @@ class DacksnackBridge extends BridgeAbstract
|
||||||
$url = self::URI . $element->getAttribute('href');
|
$url = self::URI . $element->getAttribute('href');
|
||||||
$published = $this->parseSwedishDates(trim($element->find('.published', 0)->plaintext));
|
$published = $this->parseSwedishDates(trim($element->find('.published', 0)->plaintext));
|
||||||
|
|
||||||
$article_html = getSimpleHTMLDOMCached($url, 18000) or
|
$article_html = getSimpleHTMLDOMCached($url, 18000);
|
||||||
returnServerError('Could not request: ' . $url);
|
|
||||||
$article_content = $article_html->find('#ctl00_ContentPlaceHolder1_NewsArticleVeiw_pnlArticle', 0);
|
$article_content = $article_html->find('#ctl00_ContentPlaceHolder1_NewsArticleVeiw_pnlArticle', 0);
|
||||||
|
|
||||||
$figure = self::URI . $article_content->find('img.news-image', 0)->getAttribute('src');
|
$figure = self::URI . $article_content->find('img.news-image', 0)->getAttribute('src');
|
||||||
|
|
|
@ -18,8 +18,7 @@ class DagensNyheterDirektBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
$NEWSURL = self::BASEURL . '/ajax/direkt/';
|
$NEWSURL = self::BASEURL . '/ajax/direkt/';
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($NEWSURL) or
|
$html = getSimpleHTMLDOM($NEWSURL);
|
||||||
returnServerError('Could not request: ' . $NEWSURL);
|
|
||||||
|
|
||||||
foreach ($html->find('article') as $element) {
|
foreach ($html->find('article') as $element) {
|
||||||
$link = $element->find('button', 0)->getAttribute('data-link');
|
$link = $element->find('button', 0)->getAttribute('data-link');
|
||||||
|
|
|
@ -60,7 +60,7 @@ class FindACrewBridge extends BridgeAbstract
|
||||||
CURLOPT_POSTFIELDS => http_build_query($data) . "\n"
|
CURLOPT_POSTFIELDS => http_build_query($data) . "\n"
|
||||||
];
|
];
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($url, $header, $opts) or returnClientError('No results for this query.');
|
$html = getSimpleHTMLDOM($url, $header, $opts);
|
||||||
|
|
||||||
$annonces = $html->find('.css_SrhRst');
|
$annonces = $html->find('.css_SrhRst');
|
||||||
$limit = $this->getInput('limit') ?? 10;
|
$limit = $this->getInput('limit') ?? 10;
|
||||||
|
|
|
@ -34,8 +34,7 @@ class FurAffinityUserBridge extends BridgeAbstract
|
||||||
|
|
||||||
$url = self::URI . '/gallery/' . $this->getInput('searchUsername');
|
$url = self::URI . '/gallery/' . $this->getInput('searchUsername');
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($url, [], $opt)
|
$html = getSimpleHTMLDOM($url, [], $opt);
|
||||||
or returnServerError('Could not load the user\'s gallery page.');
|
|
||||||
|
|
||||||
$submissions = $html->find('section[id=gallery-gallery]', 0)->find('figure');
|
$submissions = $html->find('section[id=gallery-gallery]', 0)->find('figure');
|
||||||
foreach ($submissions as $submission) {
|
foreach ($submissions as $submission) {
|
||||||
|
|
|
@ -155,8 +155,7 @@ class GiteaBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM($this->getURI())
|
$html = getSimpleHTMLDOM($this->getURI());
|
||||||
or returnServerError('Could not request ' . $this->getURI());
|
|
||||||
$html = defaultLinkTo($html, $this->getURI());
|
$html = defaultLinkTo($html, $this->getURI());
|
||||||
|
|
||||||
$this->title = $html->find('[property="og:title"]', 0)->content;
|
$this->title = $html->find('[property="og:title"]', 0)->content;
|
||||||
|
@ -246,8 +245,7 @@ class GiteaBridge extends BridgeAbstract
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->getInput('include_description')) {
|
if ($this->getInput('include_description')) {
|
||||||
$issue_html = getSimpleHTMLDOMCached($uri, 3600)
|
$issue_html = getSimpleHTMLDOMCached($uri, 3600);
|
||||||
or returnServerError('Unable to load issue description');
|
|
||||||
|
|
||||||
$issue_html = defaultLinkTo($issue_html, $uri);
|
$issue_html = defaultLinkTo($issue_html, $uri);
|
||||||
|
|
||||||
|
@ -308,8 +306,7 @@ class GiteaBridge extends BridgeAbstract
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->getInput('include_description')) {
|
if ($this->getInput('include_description')) {
|
||||||
$issue_html = getSimpleHTMLDOMCached($uri, 3600)
|
$issue_html = getSimpleHTMLDOMCached($uri, 3600);
|
||||||
or returnServerError('Unable to load issue description');
|
|
||||||
|
|
||||||
$issue_html = defaultLinkTo($issue_html, $uri);
|
$issue_html = defaultLinkTo($issue_html, $uri);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class GlowficBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = $this->getAPIURI();
|
$url = $this->getAPIURI();
|
||||||
$metadata = get_headers($url . '/replies', true) or returnClientError('Post did not return reply headers.');
|
$metadata = get_headers($url . '/replies', true);
|
||||||
$metadata['Last-Page'] = ceil($metadata['Total'] / $metadata['Per-Page']);
|
$metadata['Last-Page'] = ceil($metadata['Total'] / $metadata['Per-Page']);
|
||||||
if (
|
if (
|
||||||
!is_null($this->getInput('start_page')) &&
|
!is_null($this->getInput('start_page')) &&
|
||||||
|
|
|
@ -171,8 +171,7 @@ class GogsBridge extends BridgeAbstract
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->getInput('include_description')) {
|
if ($this->getInput('include_description')) {
|
||||||
$issue_html = getSimpleHTMLDOMCached($uri, 3600)
|
$issue_html = getSimpleHTMLDOMCached($uri, 3600);
|
||||||
or returnServerError('Unable to load issue description');
|
|
||||||
|
|
||||||
$issue_html = defaultLinkTo($issue_html, $uri);
|
$issue_html = defaultLinkTo($issue_html, $uri);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ class GoogleScholarBridge extends BridgeAbstract
|
||||||
case 'user':
|
case 'user':
|
||||||
$userId = $this->getInput('userId');
|
$userId = $this->getInput('userId');
|
||||||
$uri = self::URI . '/citations?hl=en&view_op=list_works&sortby=pubdate&user=' . $userId;
|
$uri = self::URI . '/citations?hl=en&view_op=list_works&sortby=pubdate&user=' . $userId;
|
||||||
$html = getSimpleHTMLDOM($uri) or returnServerError('Could not fetch Google Scholar data.');
|
$html = getSimpleHTMLDOM($uri);
|
||||||
|
|
||||||
$publications = $html->find('tr[class="gsc_a_tr"]');
|
$publications = $html->find('tr[class="gsc_a_tr"]');
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class GoogleScholarBridge extends BridgeAbstract
|
||||||
$uri .= $sortBy ? '&scisbd=1' : '';
|
$uri .= $sortBy ? '&scisbd=1' : '';
|
||||||
$uri .= $numResults ? '&num=' . $numResults : '';
|
$uri .= $numResults ? '&num=' . $numResults : '';
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($uri) or returnServerError('Could not fetch Google Scholar data.');
|
$html = getSimpleHTMLDOM($uri);
|
||||||
|
|
||||||
$publications = $html->find('div[class="gs_r gs_or gs_scl"]');
|
$publications = $html->find('div[class="gs_r gs_or gs_scl"]');
|
||||||
|
|
||||||
|
|
|
@ -438,8 +438,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
private function getOwnerID($username)
|
private function getOwnerID($username)
|
||||||
{
|
{
|
||||||
$url = self::URI . "/api/user_profiles/{$username}/?format=json";
|
$url = self::URI . "/api/user_profiles/{$username}/?format=json";
|
||||||
$data = $this->getData($url, true, true)
|
$data = $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
|
|
||||||
return $data['owner'];
|
return $data['owner'];
|
||||||
}
|
}
|
||||||
|
@ -451,8 +450,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
$uri = self::URI . '/posts/' . $id;
|
$uri = self::URI . '/posts/' . $id;
|
||||||
$url = self::URI . '/api/posts/' . $id . '/?format=json';
|
$url = self::URI . '/api/posts/' . $id . '/?format=json';
|
||||||
$data = $metadata ?? $this->getData($url, true, true)
|
$data = $metadata ?? $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
|
|
||||||
$content_str = nl2br($data['content']);
|
$content_str = nl2br($data['content']);
|
||||||
$content = "<p>{$content_str}</p><br/>"; //TODO: Add link and itaku user mention detection and convert into links.
|
$content = "<p>{$content_str}</p><br/>"; //TODO: Add link and itaku user mention detection and convert into links.
|
||||||
|
@ -497,8 +495,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
$content .= "<a href=\"{$url}\"><b>{$title}</b></a><br/>";
|
$content .= "<a href=\"{$url}\"><b>{$title}</b></a><br/>";
|
||||||
if ($media['is_thumbnail_for_video']) {
|
if ($media['is_thumbnail_for_video']) {
|
||||||
$url = self::URI . '/api/galleries/images/' . $media['id'] . '/?format=json';
|
$url = self::URI . '/api/galleries/images/' . $media['id'] . '/?format=json';
|
||||||
$media_data = $this->getData($url, true, true)
|
$media_data = $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$media['image_xl']}\"/>";
|
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$media['image_xl']}\"/>";
|
||||||
} else {
|
} else {
|
||||||
$content .= "<a href=\"{$url}\"><img src=\"{$src}\"></a>";
|
$content .= "<a href=\"{$url}\"><img src=\"{$src}\"></a>";
|
||||||
|
@ -523,11 +520,11 @@ class ItakuBridge extends BridgeAbstract
|
||||||
$url = self::URI . '/api/commissions/' . $id . '/?format=json';
|
$url = self::URI . '/api/commissions/' . $id . '/?format=json';
|
||||||
$uri = self::URI . '/commissions/' . $id;
|
$uri = self::URI . '/commissions/' . $id;
|
||||||
|
|
||||||
$data = $metadata ?? $this->getData($url, true, true)
|
$data = $metadata ?? $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
|
|
||||||
$content_str = nl2br($data['description']);
|
$content_str = nl2br($data['description']);
|
||||||
$content = "<p>{$content_str}</p><br>"; //TODO: Add link and itaku user mention detection and convert into links.
|
$content = "<p>{$content_str}</p><br>";
|
||||||
|
//TODO: Add link and itaku user mention detection and convert into links.
|
||||||
|
|
||||||
if (array_key_exists('tags', $data) && count($data['tags']) > 0) {
|
if (array_key_exists('tags', $data) && count($data['tags']) > 0) {
|
||||||
// $content .= "🏷 Tag(s): ";
|
// $content .= "🏷 Tag(s): ";
|
||||||
|
@ -570,8 +567,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
$content .= "<a href=\"{$uri}\"><b>{$data['thumbnail_detail']['title']}</b></a><br/>";
|
$content .= "<a href=\"{$uri}\"><b>{$data['thumbnail_detail']['title']}</b></a><br/>";
|
||||||
if ($data['thumbnail_detail']['is_thumbnail_for_video']) {
|
if ($data['thumbnail_detail']['is_thumbnail_for_video']) {
|
||||||
$url = self::URI . '/api/galleries/images/' . $data['thumbnail_detail']['id'] . '/?format=json';
|
$url = self::URI . '/api/galleries/images/' . $data['thumbnail_detail']['id'] . '/?format=json';
|
||||||
$media_data = $this->getData($url, true, true)
|
$media_data = $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$data['thumbnail_detail']['image_lg']}\"/>";
|
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$data['thumbnail_detail']['image_lg']}\"/>";
|
||||||
} else {
|
} else {
|
||||||
$content .= "<a href=\"{$uri}\"><img src=\"{$data['thumbnail_detail']['image_lg']}\"></a>";
|
$content .= "<a href=\"{$uri}\"><img src=\"{$data['thumbnail_detail']['image_lg']}\"></a>";
|
||||||
|
@ -595,8 +591,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
$uri = self::URI . '/images/' . $id;
|
$uri = self::URI . '/images/' . $id;
|
||||||
$url = self::URI . '/api/galleries/images/' . $id . '/?format=json';
|
$url = self::URI . '/api/galleries/images/' . $id . '/?format=json';
|
||||||
$data = /* $metadata ?? */ $this->getData($url, true, true)
|
$data = /* $metadata ?? */ $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
|
|
||||||
$content_str = nl2br($data['description']);
|
$content_str = nl2br($data['description']);
|
||||||
$content = "<p>{$content_str}</p><br/>"; //TODO: Add link and itaku user mention detection and convert into links.
|
$content = "<p>{$content_str}</p><br/>"; //TODO: Add link and itaku user mention detection and convert into links.
|
||||||
|
@ -640,8 +635,7 @@ class ItakuBridge extends BridgeAbstract
|
||||||
|
|
||||||
if (array_key_exists('is_thumbnail_for_video', $data)) {
|
if (array_key_exists('is_thumbnail_for_video', $data)) {
|
||||||
$url = self::URI . '/api/galleries/images/' . $data['id'] . '/?format=json';
|
$url = self::URI . '/api/galleries/images/' . $data['id'] . '/?format=json';
|
||||||
$media_data = $this->getData($url, true, true)
|
$media_data = $this->getData($url, true, true);
|
||||||
or returnServerError("Could not load $url");
|
|
||||||
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$data['image_xl']}\"/>";
|
$content .= "<video controls src=\"{$media_data['video']['video']}\" poster=\"{$data['image_xl']}\"/>";
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('video', $data) && is_null($data['video'])) {
|
if (array_key_exists('video', $data) && is_null($data['video'])) {
|
||||||
|
|
|
@ -9,8 +9,7 @@ class JohannesBlickBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM(self::URI)
|
$html = getSimpleHTMLDOM(self::URI);
|
||||||
or returnServerError('Could not request: ' . self::URI);
|
|
||||||
|
|
||||||
$html = defaultLinkTo($html, self::URI);
|
$html = defaultLinkTo($html, self::URI);
|
||||||
foreach ($html->find('ul[class=easyfolderlisting] > li > a') as $index => $a) {
|
foreach ($html->find('ul[class=easyfolderlisting] > li > a') as $index => $a) {
|
||||||
|
|
|
@ -181,8 +181,7 @@ class JustETFBridge extends BridgeAbstract
|
||||||
if ($this->getInput('full')) {
|
if ($this->getInput('full')) {
|
||||||
$uri = $this->extractNewsUri($article);
|
$uri = $this->extractNewsUri($article);
|
||||||
|
|
||||||
$html = getSimpleHTMLDOMCached($uri)
|
$html = getSimpleHTMLDOMCached($uri);
|
||||||
or returnServerError('Failed loading full article from ' . $uri);
|
|
||||||
|
|
||||||
$fullArticle = $html->find('div.article', 0)
|
$fullArticle = $html->find('div.article', 0)
|
||||||
or returnServerError('No content found! Layout might have changed!');
|
or returnServerError('No content found! Layout might have changed!');
|
||||||
|
|
|
@ -64,10 +64,6 @@ Returns feeds for bug comments';
|
||||||
DEFAULT_SPAN_TEXT
|
DEFAULT_SPAN_TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($html === false) {
|
|
||||||
returnServerError('Failed to load page!');
|
|
||||||
}
|
|
||||||
|
|
||||||
$html = defaultLinkTo($html, self::URI);
|
$html = defaultLinkTo($html, self::URI);
|
||||||
|
|
||||||
// Store header information into private members
|
// Store header information into private members
|
||||||
|
|
|
@ -11,7 +11,7 @@ class LaTeX3ProjectNewslettersBridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM(static::URI . '/news/latex3-news/') or returnServerError('No contents received!');
|
$html = getSimpleHTMLDOM(static::URI . '/news/latex3-news/');
|
||||||
$newsContainer = $html->find('article tbody', 0);
|
$newsContainer = $html->find('article tbody', 0);
|
||||||
|
|
||||||
foreach ($newsContainer->find('tr') as $row) {
|
foreach ($newsContainer->find('tr') as $row) {
|
||||||
|
|
|
@ -64,10 +64,6 @@ Returns feeds for bug comments';
|
||||||
DEFAULT_SPAN_TEXT
|
DEFAULT_SPAN_TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($html === false) {
|
|
||||||
returnServerError('Failed to load page!');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix relative URLs
|
// Fix relative URLs
|
||||||
defaultLinkTo($html, self::URI);
|
defaultLinkTo($html, self::URI);
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ class OMonlineBridge extends BridgeAbstract
|
||||||
$url = sprintf('%s', self::URI);
|
$url = sprintf('%s', self::URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($url)
|
$html = getSimpleHTMLDOM($url);
|
||||||
or returnServerError('Could not request: ' . $url);
|
|
||||||
|
|
||||||
$html = defaultLinkTo($html, $url);
|
$html = defaultLinkTo($html, $url);
|
||||||
|
|
||||||
|
@ -35,8 +34,7 @@ class OMonlineBridge extends BridgeAbstract
|
||||||
|
|
||||||
$articlePath = $a->href;
|
$articlePath = $a->href;
|
||||||
|
|
||||||
$articlePageHtml = getSimpleHTMLDOMCached($articlePath, self::CACHE_TIMEOUT)
|
$articlePageHtml = getSimpleHTMLDOMCached($articlePath, self::CACHE_TIMEOUT);
|
||||||
or returnServerError('Could not request: ' . $articlePath);
|
|
||||||
|
|
||||||
$articlePageHtml = defaultLinkTo($articlePageHtml, self::URI);
|
$articlePageHtml = defaultLinkTo($articlePageHtml, self::URI);
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,7 @@ class SchweinfurtBuergerinformationenBridge extends BridgeAbstract
|
||||||
private function getArticleIDsFromPage($page)
|
private function getArticleIDsFromPage($page)
|
||||||
{
|
{
|
||||||
$url = sprintf(self::URI . '?art_pager=%d', $page);
|
$url = sprintf(self::URI . '?art_pager=%d', $page);
|
||||||
$html = getSimpleHTMLDOMCached($url, self::INDEX_CACHE_TIMEOUT)
|
$html = getSimpleHTMLDOMCached($url, self::INDEX_CACHE_TIMEOUT);
|
||||||
or returnServerError('Could not retrieve ' . $url);
|
|
||||||
|
|
||||||
$articles = $html->find('div.artikel-uebersicht');
|
$articles = $html->find('div.artikel-uebersicht');
|
||||||
$articleIDs = [];
|
$articleIDs = [];
|
||||||
|
@ -70,8 +69,7 @@ class SchweinfurtBuergerinformationenBridge extends BridgeAbstract
|
||||||
private function generateItemFromArticle($id)
|
private function generateItemFromArticle($id)
|
||||||
{
|
{
|
||||||
$url = sprintf(self::ARTICLE_URI, $id);
|
$url = sprintf(self::ARTICLE_URI, $id);
|
||||||
$html = getSimpleHTMLDOMCached($url, self::ARTICLE_CACHE_TIMEOUT)
|
$html = getSimpleHTMLDOMCached($url, self::ARTICLE_CACHE_TIMEOUT);
|
||||||
or returnServerError('Could not retrieve ' . $url);
|
|
||||||
|
|
||||||
$div = $html->find('div#artikel-detail', 0);
|
$div = $html->find('div#artikel-detail', 0);
|
||||||
$divContent = $div->find('.c-content', 0);
|
$divContent = $div->find('.c-content', 0);
|
||||||
|
|
|
@ -633,8 +633,7 @@ class SkimfeedBridge extends BridgeAbstract
|
||||||
$author = '<a href="' . $anchor->href . '">' . trim($anchor->plaintext) . '</a>';
|
$author = '<a href="' . $anchor->href . '">' . trim($anchor->plaintext) . '</a>';
|
||||||
$uri = $anchor->href;
|
$uri = $anchor->href;
|
||||||
|
|
||||||
$box_html = getSimpleHTMLDOM($uri)
|
$box_html = getSimpleHTMLDOM($uri);
|
||||||
or returnServerError('Could not load custom feed!');
|
|
||||||
|
|
||||||
$this->extractFeed($box_html, $author);
|
$this->extractFeed($box_html, $author);
|
||||||
}
|
}
|
||||||
|
@ -665,8 +664,7 @@ class SkimfeedBridge extends BridgeAbstract
|
||||||
*/
|
*/
|
||||||
private function exportBoxChannels()
|
private function exportBoxChannels()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOMCached(static::URI)
|
$html = getSimpleHTMLDOMCached(static::URI);
|
||||||
or returnServerError('No contents received from Skimfeed!');
|
|
||||||
|
|
||||||
if (!$this->isCompatible($html)) {
|
if (!$this->isCompatible($html)) {
|
||||||
returnServerError('Skimfeed version is not compatible!');
|
returnServerError('Skimfeed version is not compatible!');
|
||||||
|
@ -722,8 +720,7 @@ EOD;
|
||||||
*/
|
*/
|
||||||
private function exportTechChannels()
|
private function exportTechChannels()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOMCached(static::URI)
|
$html = getSimpleHTMLDOMCached(static::URI);
|
||||||
or returnServerError('No contents received from Skimfeed!');
|
|
||||||
|
|
||||||
if (!$this->isCompatible($html)) {
|
if (!$this->isCompatible($html)) {
|
||||||
returnServerError('Skimfeed version is not compatible!');
|
returnServerError('Skimfeed version is not compatible!');
|
||||||
|
@ -759,8 +756,7 @@ EOD;
|
||||||
|
|
||||||
$message .= "\t\t'{$title}' => array(\n";
|
$message .= "\t\t'{$title}' => array(\n";
|
||||||
|
|
||||||
$channel_html = getSimpleHTMLDOMCached(static::URI . $uri)
|
$channel_html = getSimpleHTMLDOMCached(static::URI . $uri);
|
||||||
or returnServerError('Could not load tech channel ' . $channel->plaintext . '!');
|
|
||||||
|
|
||||||
$boxes = $channel_html->find('#boxx .boxes')
|
$boxes = $channel_html->find('#boxx .boxes')
|
||||||
or returnServerError('Could not find boxes!');
|
or returnServerError('Could not find boxes!');
|
||||||
|
|
|
@ -30,8 +30,7 @@ class StanfordSIRbookreviewBridge extends BridgeAbstract
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($url)
|
$html = getSimpleHTMLDOM($url);
|
||||||
or returnServerError('Failed loading content!');
|
|
||||||
foreach ($html->find('article') as $element) {
|
foreach ($html->find('article') as $element) {
|
||||||
$item = [];
|
$item = [];
|
||||||
$item['title'] = $element->find('div > h4 > a', 0)->plaintext;
|
$item['title'] = $element->find('div > h4 > a', 0)->plaintext;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class StockFilingsBridge extends FeedExpander
|
||||||
{
|
{
|
||||||
$uri = $this->getSearchUrl();
|
$uri = $this->getSearchUrl();
|
||||||
|
|
||||||
return getSimpleHTMLDOM($uri) ?: returnServerError('Could not request SEC.');
|
return getSimpleHTMLDOM($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,9 +25,6 @@ class StorytelBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($url);
|
$html = getSimpleHTMLDOM($url);
|
||||||
if (!$html) {
|
|
||||||
returnServerError('Unable to fetch Storytel list');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($html->find('li.sc-4615116a-1') as $element) {
|
foreach ($html->find('li.sc-4615116a-1') as $element) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TapasBridge extends FeedExpander
|
||||||
$this->id = $this->getInput('title');
|
$this->id = $this->getInput('title');
|
||||||
}
|
}
|
||||||
if ($this->getInput('force_title') || !$this->id) {
|
if ($this->getInput('force_title') || !$this->id) {
|
||||||
$html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request ' . $this->getURI());
|
$html = getSimpleHTMLDOM($this->getURI());
|
||||||
$this->id = $html->find('meta[property$=":url"]', 0)->content;
|
$this->id = $html->find('meta[property$=":url"]', 0)->content;
|
||||||
$this->id = str_ireplace(['tapastic://series/', '/info'], '', $this->id);
|
$this->id = str_ireplace(['tapastic://series/', '/info'], '', $this->id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,7 @@ class TestFaktaBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$NEWSURL = self::URI . '/sv';
|
$NEWSURL = self::URI . '/sv';
|
||||||
$html = getSimpleHTMLDOMCached($NEWSURL, 18000) or
|
$html = getSimpleHTMLDOMCached($NEWSURL, 18000);
|
||||||
returnServerError('Could not request: ' . $NEWSURL);
|
|
||||||
|
|
||||||
foreach ($html->find('.row-container') as $element) {
|
foreach ($html->find('.row-container') as $element) {
|
||||||
// Debug::log($element);
|
// Debug::log($element);
|
||||||
|
@ -68,8 +67,7 @@ class TestFaktaBridge extends BridgeAbstract
|
||||||
$figure = $element->find('img', 0);
|
$figure = $element->find('img', 0);
|
||||||
$preamble = trim($element->find('.text', 0)->plaintext);
|
$preamble = trim($element->find('.text', 0)->plaintext);
|
||||||
|
|
||||||
$article_html = getSimpleHTMLDOMCached($url, 18000) or
|
$article_html = getSimpleHTMLDOMCached($url, 18000);
|
||||||
returnServerError('Could not request: ' . $url);
|
|
||||||
$article_content = $article_html->find('div.content', 0);
|
$article_content = $article_html->find('div.content', 0);
|
||||||
$article_text = $article_html->find('article', 0);
|
$article_text = $article_html->find('article', 0);
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ class UsesTechbridge extends BridgeAbstract
|
||||||
|
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$html = getSimpleHTMLDOM(self::URI)
|
$html = getSimpleHTMLDOM(self::URI);
|
||||||
or returnServerError('Could not request: ' . self::URI);
|
|
||||||
|
|
||||||
foreach ($html->find('div[class=PersonInner]') as $index => $a) {
|
foreach ($html->find('div[class=PersonInner]') as $index => $a) {
|
||||||
$item = []; // Create an empty item
|
$item = []; // Create an empty item
|
||||||
|
|
|
@ -16,8 +16,7 @@ class VproTegenlichtBridge extends BridgeAbstract
|
||||||
public function collectData()
|
public function collectData()
|
||||||
{
|
{
|
||||||
$url = sprintf('https://www.vpro.nl/programmas/tegenlicht/lees/artikelen.html');
|
$url = sprintf('https://www.vpro.nl/programmas/tegenlicht/lees/artikelen.html');
|
||||||
$dom = getSimpleHTMLDOM($url)
|
$dom = getSimpleHTMLDOM($url);
|
||||||
or returnServerError('No contents received!');
|
|
||||||
$dom = $dom->find('ul#browsable-news-overview', 0);
|
$dom = $dom->find('ul#browsable-news-overview', 0);
|
||||||
$dom = defaultLinkTo($dom, $this->getURI());
|
$dom = defaultLinkTo($dom, $this->getURI());
|
||||||
foreach ($dom->find('li') as $article) {
|
foreach ($dom->find('li') as $article) {
|
||||||
|
|
|
@ -105,10 +105,6 @@ class WikipediaBridge extends BridgeAbstract
|
||||||
// This will automatically send us to the correct main page in any language (try it!)
|
// This will automatically send us to the correct main page in any language (try it!)
|
||||||
$html = getSimpleHTMLDOM($this->getURI() . '/wiki');
|
$html = getSimpleHTMLDOM($this->getURI() . '/wiki');
|
||||||
|
|
||||||
if (!$html) {
|
|
||||||
returnServerError('Could not load site: ' . $this->getURI() . '!');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now read content depending on the language (make sure to create one function per language!)
|
* Now read content depending on the language (make sure to create one function per language!)
|
||||||
* We build the function name automatically, just make sure you create a private function ending
|
* We build the function name automatically, just make sure you create a private function ending
|
||||||
|
|
|
@ -304,11 +304,9 @@ class XenForoBridge extends BridgeAbstract
|
||||||
|
|
||||||
// We can optimize performance by caching all but the last page
|
// We can optimize performance by caching all but the last page
|
||||||
if ($page != $lastpage) {
|
if ($page != $lastpage) {
|
||||||
$html = getSimpleHTMLDOMCached($pageurl)
|
$html = getSimpleHTMLDOMCached($pageurl);
|
||||||
or returnServerError('Error loading contents from ' . $pageurl . '!');
|
|
||||||
} else {
|
} else {
|
||||||
$html = getSimpleHTMLDOM($pageurl)
|
$html = getSimpleHTMLDOM($pageurl);
|
||||||
or returnServerError('Error loading contents from ' . $pageurl . '!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = defaultLinkTo($html, $hosturl);
|
$html = defaultLinkTo($html, $hosturl);
|
||||||
|
@ -347,11 +345,9 @@ class XenForoBridge extends BridgeAbstract
|
||||||
|
|
||||||
// We can optimize performance by caching all but the last page
|
// We can optimize performance by caching all but the last page
|
||||||
if ($page != $lastpage) {
|
if ($page != $lastpage) {
|
||||||
$html = getSimpleHTMLDOMCached($pageurl)
|
$html = getSimpleHTMLDOMCached($pageurl);
|
||||||
or returnServerError('Error loading contents from ' . $pageurl . '!');
|
|
||||||
} else {
|
} else {
|
||||||
$html = getSimpleHTMLDOM($pageurl)
|
$html = getSimpleHTMLDOM($pageurl);
|
||||||
or returnServerError('Error loading contents from ' . $pageurl . '!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = defaultLinkTo($html, $hosturl);
|
$html = defaultLinkTo($html, $hosturl);
|
||||||
|
|
Loading…
Reference in a new issue