Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/rumble/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/rumble",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Rumble Components",
"main": "rumble.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
28 changes: 25 additions & 3 deletions components/rumble/rumble.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "rumble",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://rumble.com/-livestream-api";
},
_makeRequest({
$ = this,
path,
params = {},
...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
params: {
...params,
key: this.$auth.live_streaming_api_key,
},
...opts,
});
},
getData(opts = {}) {
return this._makeRequest({
path: "/get-data",
...opts,
});
},
},
};
55 changes: 55 additions & 0 deletions components/rumble/sources/new-live-stream/new-live-stream.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import rumble from "../../rumble.app.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
import sampleEmit from "./test-event.mjs";

export default {
key: "rumble-new-live-stream",
name: "New Live Stream",
description: "Emit new event when a livestream becomes live in Rumble. [See the documentation](https://rumblefaq.groovehq.com/help/how-to-use-rumble-s-live-stream-api)",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
rumble,
db: "$.service.db",
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
methods: {
_getLastTs() {
return this.db.get("lastTs") || 0;
},
_setLastTs(lastTs) {
this.db.set("lastTs", lastTs);
},
generateMeta(livestream) {
return {
id: livestream.id,
summary: `${livestream.title} is live`,
ts: Date.parse(livestream.created_on),
};
},
},
async run() {
const lastTs = this._getLastTs();
let maxTs = lastTs;

const { livestreams } = await this.rumble.getData();

for (const livestream of livestreams) {
const ts = Date.parse(livestream.created_on);
if (livestream?.is_live && ts > lastTs) {
const meta = this.generateMeta(livestream);
this.$emit(livestream, meta);
maxTs = Math.max(ts, maxTs);
}
}

this._setLastTs(maxTs);
},
sampleEmit,
};
25 changes: 25 additions & 0 deletions components/rumble/sources/new-live-stream/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default {
"id": "6pw8hx",
"title": "Livestream",
"created_on": "2025-04-14T17:07:27+00:00",
"is_live": true,
"visibility": "unlisted",
"categories": {
"primary": {
"slug": "technology",
"title": "Technology"
},
"secondary": null
},
"server_url": "",
"stream_key": "",
"likes": 0,
"dislikes": 0,
"watching_now": 0,
"chat": {
"latest_message": null,
"recent_messages": [],
"latest_rant": null,
"recent_rants": []
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading