Skip to content

Commit

Permalink
Bump raindrop-api and adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
thevops committed Jun 28, 2024
1 parent c8d7333 commit 5802bbb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
22 changes: 14 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit 5802bbb

Please sign in to comment.