Skip to content

Commit

Permalink
Create a shell script for getting the videos from the command line
Browse files Browse the repository at this point in the history
Create a shell script for getting the videos from the command line to create cron job so that we can have the database running daily
  • Loading branch information
Afsha10 committed Dec 21, 2023
1 parent 9d35892 commit 594afe7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions get-videos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

curl https://video-storage.onrender.com/videos
3 changes: 1 addition & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ app.post("/videos", (req, res) => {
!url.startsWith("https://m.youtube.com") &&
!url.startsWith("https://youtube.com/"))
) {

res.status(400).json({
result: "failure",
message: "Video could not be saved",
Expand All @@ -88,7 +87,7 @@ app.post("/videos", (req, res) => {
const query = `INSERT INTO videos (title, url, rating, createdAt)
VALUES ($1, $2, 0, now());`;

// converting mobile YouTube links like this https://youtu.be/n3JNtfi4Vb0?si=dRx5CJJctB6P_yVR to this https://www.youtube.com/watch?v=n3JNtfi4Vb0
// converting mobile YouTube links like this https://youtu.be/n3JNtfi4Vb0?si=dRx5CJJctB6P_yVR to this https://www.youtube.com/watch?v=n3JNtfi4Vb0

let formattedUrl;
if (url.startsWith("https://youtu.be")) {
Expand Down

0 comments on commit 594afe7

Please sign in to comment.