From 5802bbb22e15da805399238c76ed13b5d5022bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81uczak?= Date: Fri, 28 Jun 2024 08:50:53 +0200 Subject: [PATCH] Bump raindrop-api and adjust --- Taskfile.yml | 2 +- bun.lockb | Bin 27890 -> 27890 bytes package.json | 2 +- src/index.ts | 22 ++++++++++++++-------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index a7fa838..d0773b1 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -10,7 +10,7 @@ tasks: start: desc: Start the app cmds: - - bun src/index.ts + - bun src/index.ts config/production.yaml env: NODE_ENV: production diff --git a/bun.lockb b/bun.lockb index 4283491ad251f61aaf74992ba063366fcd62ea08..a0edd23dd0f9926a7bc700c74ae96aad9ded984b 100755 GIT binary patch delta 72 zcmex#lkw9{#tC`~O->ch57(~G*toL1dxC5h!=2uYUW>Zr-j5DX6iM!za(AQOTQ)|+ c%{J^`0)UiZ#AinKRAUnp6La&;+EK@a0Q(IekN^Mx delta 72 zcmV-O0Js10*#Yv|0gx^r$#jk#y^Lgp(=O+_vzOWBnYX)zNyzb2pkb~*xlQJ-{TE`M~5hAVt diff --git a/package.json b/package.json index 468f208..bd83d1e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "js-yaml": "^4.1.0", "openai": "^4.33.1", "prettier": "^3.2.5", - "raindrop-api": "https://github.com/thevops/raindrop-api#v1.0.0", + "raindrop-api": "https://github.com/thevops/raindrop-api#v1.1.0", "simple-fmt-logger": "https://github.com/thevops/simple-fmt-logger#v1.1.3", "youtubei.js": "^10.0.0" } diff --git a/src/index.ts b/src/index.ts index 036e13a..e2ddc50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,13 +6,14 @@ import { getVideoDetails, extractVideoId, } from "./youtube.ts"; +import type { RaindropItem } from "raindrop-api"; async function main() { // Get link const { object, msg, status } = await raindropAPI.getFirstItemFromCollection( Config.raindrop_source_collection_id, ); - if (!status) { + if (!status || object === null || object._id === undefined) { logger.info(msg); return; } @@ -51,17 +52,22 @@ async function main() { } // Send the summary to target collection in Raindrop - const note = `<${channel}> ${title} [${duration}] + const note = `Upload date: ${upload_date} --- -${link} (${upload_date}) ${summary} ${usage} `; - const result = await raindropAPI.addItem( - Config.raindrop_target_collection_id, - link, - note, - ); + + const item: RaindropItem = { + title: `<${channel}> ${title} [${duration}]`, + link: link, + note: note, + collection: { + $id: Number(Config.raindrop_target_collection_id), + } + }; + + const result = await raindropAPI.addItem(item); if (result) { logger.info(`Final success: ${link} ${title}`);