Skip to content

Commit

Permalink
Update Instagram video page to use new API endpoint for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
saiyamdubey committed Feb 15, 2024
1 parent 8d9d286 commit ea38088
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/instagram/video/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ function Searchbar({}: Props) {

const response = await fetch(
// `/api/download?url=${encodeURIComponent(url)}`
`/api/test?url=${encodeURIComponent("https://www.instagram.com/p/C3PvQIrCwzz/?__a=1&__d=dis")}`
`/api/test?url=${encodeURIComponent(
"https://www.instagram.com/p/C3PvQIrCwzz/?__a=1&__d=dis"
)}`
);
// console.log("hmm ::", await response.json());
const data = await response.json();
console.log("mm ::", data);
const response1 = await fetch(
`/api/test?url=https://jsonplaceholder.typicode.com/posts/1`
`/api/test?url=https://jsonplaceholder.typicode.com/posts/`
);
const posts = await response1.json();
console.log("hi ::", posts);
Expand Down
3 changes: 3 additions & 0 deletions pages/api/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

import { NextApiRequest, NextApiResponse } from 'next';

export const dynamic = 'force-dynamic';


export default async function handler(req: NextApiRequest, res: NextApiResponse) {
let { url } = req.query;

Expand Down
4 changes: 3 additions & 1 deletion pages/api/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import { NextApiRequest, NextApiResponse } from 'next';

export const dynamic = 'force-dynamic';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
let { url } = req.query;

try {
const response = await fetch(url as string );
const response = await fetch(url as string ,{ method: "GET" ,cache:"no-cache"});
console.log("response 1 :: ",response)
const data = await response.json();
res.status(200).json(data);
Expand Down

0 comments on commit ea38088

Please sign in to comment.