From 3ee2c7f918f26aafcd2d13de70e0a1a8d222f66d Mon Sep 17 00:00:00 2001 From: Dag Date: Thu, 17 Nov 2022 18:06:35 +0100 Subject: [PATCH] feat: new bridge RumbleBridge (#3150) --- bridges/RumbleBridge.php | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 bridges/RumbleBridge.php diff --git a/bridges/RumbleBridge.php b/bridges/RumbleBridge.php new file mode 100644 index 00000000..d8fcf19c --- /dev/null +++ b/bridges/RumbleBridge.php @@ -0,0 +1,56 @@ + [ + 'name' => 'Account', + 'type' => 'text', + 'required' => true, + 'defaultValue' => 'bjornandreasbullhansen', + ], + 'type' => [ + 'type' => 'list', + 'name' => 'Type', + 'values' => [ + 'Channel' => 'channel', + 'User' => 'user', + ] + ], + ] + ]; + + public function collectData() + { + $account = $this->getInput('account'); + $type = $this->getInput('type'); + + if ($type === 'channel') { + $url = "https://rumble.com/c/$account"; + } + if ($type === 'user') { + $url = "https://rumble.com/user/$account"; + } + + $dom = getSimpleHTMLDOM($url); + foreach ($dom->find('li.video-listing-entry') as $video) { + $this->items[] = [ + 'title' => $video->find('h3', 0)->plaintext, + 'uri' => self::URI . $video->find('a', 0)->href, + 'author' => $account . '@rumble.com', + 'content' => defaultLinkTo($video, self::URI)->innertext, + ]; + } + } + + public function getName() + { + return 'Rumble.com ' . $this->getInput('account'); + } +}