aboutsummaryrefslogtreecommitdiff
path: root/bridges/AsahiShimbunAJWBridge.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2022-07-01 15:10:30 +0200
committerGravatar GitHub <noreply@github.com> 2022-07-01 15:10:30 +0200
commit4f75591060d95208a301bc6bf460d875631b29cc (patch)
tree4e37d86840e8d990a563ba75d3de6f84a53cc2de /bridges/AsahiShimbunAJWBridge.php
parent66568e3a39c61546c09a47a5688914a0bdf3c60c (diff)
downloadrss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.gz
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.tar.zst
rss-bridge-4f75591060d95208a301bc6bf460d875631b29cc.zip
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
Diffstat (limited to 'bridges/AsahiShimbunAJWBridge.php')
-rw-r--r--bridges/AsahiShimbunAJWBridge.php134
1 files changed, 69 insertions, 65 deletions
diff --git a/bridges/AsahiShimbunAJWBridge.php b/bridges/AsahiShimbunAJWBridge.php
index 2e7c5dc2..226196d8 100644
--- a/bridges/AsahiShimbunAJWBridge.php
+++ b/bridges/AsahiShimbunAJWBridge.php
@@ -1,72 +1,76 @@
<?php
-class AsahiShimbunAJWBridge extends BridgeAbstract {
- const NAME = 'Asahi Shimbun AJW';
- const BASE_URI = 'http://www.asahi.com';
- const URI = self::BASE_URI . '/ajw/';
- const DESCRIPTION = 'Asahi Shimbun - Asia & Japan Watch';
- const MAINTAINER = 'somini';
- const PARAMETERS = array(
- array(
- 'section' => array(
- 'type' => 'list',
- 'name' => 'Section',
- 'values' => array(
- 'Japan » Social Affairs' => 'japan/social',
- 'Japan » People' => 'japan/people',
- 'Japan » 3/11 Disaster' => 'japan/0311disaster',
- 'Japan » Sci & Tech' => 'japan/sci_tech',
- 'Politics' => 'politics',
- 'Business' => 'business',
- 'Culture » Style' => 'culture/style',
- 'Culture » Movies' => 'culture/movies',
- 'Culture » Manga & Anime' => 'culture/manga_anime',
- 'Asia » China' => 'asia_world/china',
- 'Asia » Korean Peninsula' => 'asia_world/korean_peninsula',
- 'Asia » Around Asia' => 'asia_world/around_asia',
- 'Asia » World' => 'asia_world/world',
- 'Opinion » Editorial' => 'opinion/editorial',
- 'Opinion » Vox Populi' => 'opinion/vox',
- ),
- 'defaultValue' => 'politics',
- )
- )
- );
- private function getSectionURI($section) {
- return self::getURI() . $section . '/';
- }
+class AsahiShimbunAJWBridge extends BridgeAbstract
+{
+ const NAME = 'Asahi Shimbun AJW';
+ const BASE_URI = 'http://www.asahi.com';
+ const URI = self::BASE_URI . '/ajw/';
+ const DESCRIPTION = 'Asahi Shimbun - Asia & Japan Watch';
+ const MAINTAINER = 'somini';
+ const PARAMETERS = [
+ [
+ 'section' => [
+ 'type' => 'list',
+ 'name' => 'Section',
+ 'values' => [
+ 'Japan » Social Affairs' => 'japan/social',
+ 'Japan » People' => 'japan/people',
+ 'Japan » 3/11 Disaster' => 'japan/0311disaster',
+ 'Japan » Sci & Tech' => 'japan/sci_tech',
+ 'Politics' => 'politics',
+ 'Business' => 'business',
+ 'Culture » Style' => 'culture/style',
+ 'Culture » Movies' => 'culture/movies',
+ 'Culture » Manga & Anime' => 'culture/manga_anime',
+ 'Asia » China' => 'asia_world/china',
+ 'Asia » Korean Peninsula' => 'asia_world/korean_peninsula',
+ 'Asia » Around Asia' => 'asia_world/around_asia',
+ 'Asia » World' => 'asia_world/world',
+ 'Opinion » Editorial' => 'opinion/editorial',
+ 'Opinion » Vox Populi' => 'opinion/vox',
+ ],
+ 'defaultValue' => 'politics',
+ ]
+ ]
+ ];
- public function collectData() {
- $html = getSimpleHTMLDOM($this->getSectionURI($this->getInput('section')));
+ private function getSectionURI($section)
+ {
+ return self::getURI() . $section . '/';
+ }
- foreach($html->find('#MainInner li a') as $element) {
- if ($element->parent()->class == 'HeadlineTopImage-S') {
- Debug::log('Skip Headline, it is repeated below');
- continue;
- }
- $item = array();
+ public function collectData()
+ {
+ $html = getSimpleHTMLDOM($this->getSectionURI($this->getInput('section')));
- $item['uri'] = self::BASE_URI . $element->href;
- $e_lead = $element->find('span.Lead', 0);
- if ($e_lead) {
- $item['content'] = $e_lead->innertext;
- $e_lead->outertext = '';
- } else {
- $item['content'] = $element->innertext;
- }
- $e_date = $element->find('span.EnDate', 0);
- if ($e_date) {
- $item['timestamp'] = strtotime($e_date->innertext);
- $e_date->outertext = '';
- }
- $e_video = $element->find('span.EnVideo', 0);
- if ($e_video) {
- $e_video->outertext = '';
- $element->innertext = "VIDEO: $element->innertext";
- }
- $item['title'] = $element->innertext;
+ foreach ($html->find('#MainInner li a') as $element) {
+ if ($element->parent()->class == 'HeadlineTopImage-S') {
+ Debug::log('Skip Headline, it is repeated below');
+ continue;
+ }
+ $item = [];
- $this->items[] = $item;
- }
- }
+ $item['uri'] = self::BASE_URI . $element->href;
+ $e_lead = $element->find('span.Lead', 0);
+ if ($e_lead) {
+ $item['content'] = $e_lead->innertext;
+ $e_lead->outertext = '';
+ } else {
+ $item['content'] = $element->innertext;
+ }
+ $e_date = $element->find('span.EnDate', 0);
+ if ($e_date) {
+ $item['timestamp'] = strtotime($e_date->innertext);
+ $e_date->outertext = '';
+ }
+ $e_video = $element->find('span.EnVideo', 0);
+ if ($e_video) {
+ $e_video->outertext = '';
+ $element->innertext = "VIDEO: $element->innertext";
+ }
+ $item['title'] = $element->innertext;
+
+ $this->items[] = $item;
+ }
+ }
}