noelrohi / kd

Ad-free Kdrama streaming app. Built with Nextjs, Drizzle ORM, NeonDB and shadcn-UI
https://kd.rohi.dev
MIT License
122 stars 20 forks source link

I don't have an issue, I would like to ask question. #88

Closed novanmartejares closed 5 months ago

novanmartejares commented 7 months ago

Good day.

I really like your repository like a lot but I am having a confusion regarding .env.

Particularly in database_url =

Can you further explain to me about what to put or any methods. Thank you for your response.

noelrohi commented 7 months ago

Can you further explain to me about what to put or any methods.

As of now, the repository is using mysql from planetscale. You can get your connection uri at https://planetscale.com, sign up with credit card then connect (select nodejs from dropdown menu).

P.S. They are about to drop free tier at April 8th. Speaking of which, I am planning to migrate this repo to use neonDB PostgreSQL since it's free, less setup and ultimately, I don't afford planetscale's scaler plan.

novanmartejares commented 7 months ago

is there any changes of codes if you migrate it?

On Tue, Mar 26, 2024, 7:03 PM Rohi @.***> wrote:

Can you further explain to me about what to put or any methods.

As of now, the repository is using mysql from planetscale. You can get your connection uri at https://planetscale.com, sign up with credit card then connect (select nodejs from dropdown menu).

P.S. They are about to drop free tier at April 8th. Speaking of which, I am planning to migrate this repo to use neonDB PostgreSQL since it's free and I don't afford planetscale's scaler plan.

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2020128580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCNJMHATKOE3DFOKELTY2FIXTAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRQGEZDQNJYGA . You are receiving this because you authored the thread.Message ID: @.***>

noelrohi commented 7 months ago

is there any changes of codes if you migrate it?

yes

noelrohi commented 7 months ago

there will be a lot. not only because of migrating from planetscale to neon but also because of migrating from mysql to postgresql.

novanmartejares commented 7 months ago

Ok, thanks for the clarification. i will wait for your update then.

On Tue, Mar 26, 2024, 9:56 PM Rohi @.***> wrote:

there will be a lot. not only because of migrating from planetscale to neon but also because of migrating from mysql to postgresql.

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2020498027, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCJI5CNYEYWVFRGI5HDY2F5AVAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRQGQ4TQMBSG4 . You are receiving this because you authored the thread.Message ID: @.***>

noelrohi commented 7 months ago

Hi @novanmartejares, migration is done. I also updated env.example on how to get database url. Hope it helps!

novanmartejares commented 7 months ago

its so nice.. thanks bro.. its a big help..let me try it

novanmartejares commented 7 months ago

hi @gneiru i am having this error when i try npm install ❌ Invalid environment variables: { DATABASE_URL: [ 'Invalid input: must include "neondb"' ] } C:\Users\USER\Desktop\kd-master\node_modules\@t3-oss\env-core\dist\index.js:29 throw new Error("Invalid environment variables");

i have already put all the requirements in .env.

noelrohi commented 7 months ago

hi @gneiru i am having this error when i try npm install ❌ Invalid environment variables: { DATABASE_URL: [ 'Invalid input: must include "neondb"' ] }

C:\Users\USER\Desktop\kd-master\node_modules\@t3-oss\env-core\dist\index.js:29

    throw new Error("Invalid environment variables");

i have already put all the requirements in .env.

What is your database name? I thought "neondb" is the default name so it should work.

novanmartejares commented 7 months ago

i think it has something to do with this code? "DATABASE_URL: z.string().url().includes("neondb")" i guess :)

novanmartejares commented 7 months ago

i already figure it out. i need to change the neondb to my databasename

noelrohi commented 7 months ago

i already figure it out. i need to change the neondb to my databasename

Nice catch

novanmartejares commented 7 months ago

kdrama

but im having this issue again :D

noelrohi commented 7 months ago

I think your api requests are failing. Please check the enpoints in src/lib/dramacool. It should return JSON with matching types

novanmartejares commented 7 months ago

i use consumet api and host my own. the api seems to be ok in the hosting side.

On Sun, Mar 31, 2024, 2:30 AM Rohi @.***> wrote:

I think your api requests are failing. Please check the enpoints in src/lib/dramacool. It should return JSON with matching types

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2028435390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCP6R7HCOUUMUWQDOUDY24ADZAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGQZTKMZZGA . You are receiving this because you were mentioned.Message ID: @.***>

novanmartejares commented 7 months ago

maybe because of the type. i dont know it

On Sun, Mar 31, 2024, 10:33 AM Novan Mar Tejares @.***> wrote:

i use consumet api and host my own. the api seems to be ok in the hosting side.

On Sun, Mar 31, 2024, 2:30 AM Rohi @.***> wrote:

I think your api requests are failing. Please check the enpoints in src/lib/dramacool. It should return JSON with matching types

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2028435390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCP6R7HCOUUMUWQDOUDY24ADZAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGQZTKMZZGA . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

Try checking the endpoints in https://github.com/gneiru/kd/blob/master/src/lib/dramacool.ts, my API_URL ends with /api so it would become https://<api-url>/api/search

novanmartejares commented 7 months ago

this is the consumet api i have hosted. and this is the one i put in the env.

https://anime-api-ashen.vercel.app

On Sun, Mar 31, 2024, 10:39 AM Rohi @.***> wrote:

Try checking the endpoints, my API_URL ends with /api

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2028534041, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCKDTAUNROCM46EWYXTY25ZOXAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGUZTIMBUGE . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

What's the endpoimt of getting trending, recent etc?

novanmartejares commented 7 months ago

i just put dramacool in the url like this

https://anime-api-ashen.vercel.app/movies/dramacool/recent

and it returns like this:

{"currentPage":1,"totalPages":1,"hasNextPage":false,"results":[{"id":"drama-detail/get-old-recently","title":"Get Old Recently (2021)","url":"https://dramacool.com.pa/drama-detail/get-old-recently","image":"https://asianimg.pro/cover/get-old-recently.png"}]}

does it mean its ok now?

On Sun, Mar 31, 2024, 11:52 AM Rohi @.***> wrote:

What's the endpoimt of getting trending, recent etc?

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2028544333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCIVFMW6DNSYA2VCNG3Y26CAJAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGU2DIMZTGM . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

You should put https://anime-api-ashen.vercel.app/movies/dramacool in your .env file. However, the response schema doesnt match with the app's

novanmartejares commented 7 months ago

i see. this is what in my mind also. let me try again. Thanks for the help. your such a big help.

On Sun, Mar 31, 2024, 12:26 PM Rohi @.***> wrote:

You should put https://anime-api-ashen.vercel.app/movies/dramacool in your .env file. However, the response schema doesnt match with the app's

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2028549750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCO7EOJELIY7PXITUO3Y26F7RAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGU2DSNZVGA . You are receiving this because you were mentioned.Message ID: @.***>

novanmartejares commented 7 months ago

everthing looks fine until i got this error. this is when i click button going to home page eror

noelrohi commented 7 months ago

Add this code to your dramacool parser methods

featured = async () => {
    try {
      const url = new URL(`${this.baseUrl}`);
      const res = await this.client.get(url.toString());

      const $ = load(res.data);

      const featured: IMovieEpisode[] = [];

      $("#layerslider .ls-slide").each((i, el) => {
        featured.push({
          id: $(el).find("a").attr("href")?.slice(1)!,
          title: $(el).find("img").attr("title")!,
          image: $(el).find("img").attr("src"),
        });
      });
      return featured;
    } catch (err) {
      throw new Error("Something went wrong. Please try again later.");
    }
  };

Then add a route to call this method, in my case it is /featured

novanmartejares commented 7 months ago

im sorry for not getting it. im so noob right now. but should i put it here?

dramacool

noelrohi commented 7 months ago

No, in your self hosted code. If you want, I'll make a PR on your repo of the self hosted consumet API

novanmartejares commented 7 months ago

Yes, of course you can!

On Mon, Apr 1, 2024, 1:57 PM Rohi @.***> wrote:

No, in your self hosted code. If you want, I'll make a PR on your repo of the self hosted consumet API

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2029211607, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCJ2JQKJ7QJUORSYHRLY3DZMBAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGIYTCNRQG4 . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

Which repo? Is it public? If not, could you please add me as collaborator.

novanmartejares commented 7 months ago

https://github.com/novanmartejares/anime_api

On Mon, Apr 1, 2024, 6:07 PM Rohi @.***> wrote:

Which repo? Is it public? If not, could you please add me as collaborator.

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2029520756, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCN7XLXNUCDWOEXJ373Y3EWV3AVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGUZDANZVGY . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

Can't access it for some reason

novanmartejares commented 7 months ago

i think its private

On Mon, Apr 1, 2024, 7:07 PM Rohi @.***> wrote:

Can't access it for some reason

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2029592316, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCL32QYSXSK3IOINVZLY3E5XRAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGU4TEMZRGY . You are receiving this because you were mentioned.Message ID: @.***>

novanmartejares commented 7 months ago

i have added you as collaborator

On Mon, Apr 1, 2024, 7:39 PM Novan Mar Tejares @.***> wrote:

i think its private

On Mon, Apr 1, 2024, 7:07 PM Rohi @.***> wrote:

Can't access it for some reason

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2029592316, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCL32QYSXSK3IOINVZLY3E5XRAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGU4TEMZRGY . You are receiving this because you were mentioned.Message ID: @.***>

novanmartejares commented 7 months ago

animeapi-two.vercel.app

this is the api.. not the other one

On Mon, Apr 1, 2024, 7:41 PM Novan Mar Tejares @.***> wrote:

i have added you as collaborator

On Mon, Apr 1, 2024, 7:39 PM Novan Mar Tejares @.***> wrote:

i think its private

On Mon, Apr 1, 2024, 7:07 PM Rohi @.***> wrote:

Can't access it for some reason

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2029592316, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCL32QYSXSK3IOINVZLY3E5XRAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGU4TEMZRGY . You are receiving this because you were mentioned.Message ID: @.***>

noelrohi commented 7 months ago

I can't add the code unfortunately. That repo is the fork of API wrapper of consumet.ts, while mine is a fork of consumet.ts that has API routes in the same codebase. All I can offer is give you my API_URL, which is https://v1.api.ani.rohi.dev/api/dramacool, my apologies.

novanmartejares commented 7 months ago

it's now working. it displays the homepage and popular. I can also search now. but there's an error occurred. Upon clicking the image box to play the video it will display like this

Screenshot 2024-04-01 220749

noelrohi commented 7 months ago

You need to run pnpm db push on your terminal

novanmartejares commented 7 months ago

wow .. its working now.. :)

novanmartejares commented 7 months ago

i use this command pnpm drizzle-kit push:pg

skgupta507 commented 7 months ago

hello @gneiru while deploying it to vercel or netlify i got a error message .

build: Error occurred prerendering page "/sitemap.xml". Read more: https://nextjs.org/docs/messages/prerender-error -- build: 11:49:18.034 | build: error: relation "kd_episode" does not exist 11:49:18.034 | build: at /vercel/path0/.next/server/app/sitemap.xml/route.js:9:29101 11:49:18.034 | build: at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 11:49:18.034 | build: at async n_.execute (/vercel/path0/.next/server/app/sitemap.xml/route.js:33:28439) 11:49:18.034 | build: at async at (/vercel/path0/.next/server/app/sitemap.xml/route.js:33:38298) 11:49:18.034 | build: at async aa (/vercel/path0/.next/server/app/sitemap.xml/route.js:33:39203) 11:49:18.034 | build: at async /vercel/path0/node_modules/.pnpm/next@14.1.4_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:42484 11:49:18.034 | build: at async eI.execute (/vercel/path0/node_modules/.pnpm/next@14.1.4_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:32486) 11:49:18.035 | build: at async eI.handle (/vercel/path0/node_modules/.pnpm/next@14.1.4_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:43737) 11:49:18.035 | build: at async exportAppRoute (/vercel/path0/node_modules/.pnpm/next@14.1.4_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/export/routes/app-route.js:77:26) 11:49:18.035 | build: at async exportPageImpl (/vercel/path0/node_modules/.pnpm/next@14.1.4_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/export/worker.js:175:20) 11:49:18.035 | build: build: ✓ Generating static pages (14/14) 11:49:18.041 | build: 11:49:18.041 | build: > Export encountered errors on following paths: 11:49:18.041 | build: /sitemap.xml/route: /sitemap.xml 11:49:18.109 | build:  ELIFECYCLE  Command failed with exit code 1. 11:49:18.122 | build: ERROR: command finished with error: command (/vercel/path0/) /pnpm8/node_modules/.bin/pnpm run build exited (1) 11:49:18.122 | build: command (/vercel/path0/) /pnpm8/node_modules/.bin/pnpm run build exited (1) 11:49:18.123 |   11:49:18.123 | Tasks: 0 successful, 1 total 11:49:18.123 | Cached: 0 cached, 1 total 11:49:18.123 | Time: 44.779s 11:49:18.123 | Summary: /vercel/path0/.turbo/runs/2ecl4rkuLRFdTlXi1yhBB2sjuEX.json 11:49:18.123 | Failed: //#build 11:49:18.123 |   11:49:18.123 | ERROR run failed: command exited (1) 11:49:18.182 | Error: Command "turbo run build" exited with 1

i recieved this error and i have no idea how to fix this can u help me with this

noelrohi commented 7 months ago

@skgupta507 I think you need to run

pnpm db:push if you haven't yet

noelrohi commented 7 months ago

i use this command pnpm drizzle-kit push:pg

This command also works

skgupta507 commented 7 months ago

@gneiru i tried and i recieved this error

sh: line 1: drizzle-kit: command not found -- 12:36:21.230 | ELIFECYCLE  Command failed. 12:36:21.231 | WARN  Local package.json exists, but node_modules missing, did you mean to install? 12:36:21.244 | Error: Command "pnpm db:push" exited with 1
skgupta507 commented 7 months ago

i use this command pnpm drizzle-kit push:pg

This command also works

i got this error for this command

ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "drizzle-kit" not found -- 12:35:25.167 | Error: Command "pnpm drizzle-kit push:pg" exited with 1
noelrohi commented 7 months ago

Try pnpm i first then pnpm db:push

skgupta507 commented 7 months ago

@gneiru bro i tried but it stll says drizzle-kit not found

sh: line 1: drizzle-kit: command not found -- 12:59:37.167 | ELIFECYCLE  Command failed. 12:59:37.174 | WARN  Local package.json exists, but node_modules missing, did you mean to install? 12:59:37.196 | Error: Command "pnpm db:push" exited with 1
noelrohi commented 7 months ago

@gneiru

bro i tried but it stll says drizzle-kit not found

sh: line 1: drizzle-kit: command not found -- 12:59:37.167 | ELIFECYCLE  Command failed. 12:59:37.174 | WARN  Local package.json exists, but node_modules missing, did you mean to install? 12:59:37.196 | Error: Command "pnpm db:push" exited with 1

You dont have node modules so it will not work. You have to run pnpm install first, then wait for node modules to appear in your root directory. Finally, pnpm db:push will definitely not throw error.

novanmartejares commented 7 months ago

i have deployed mine.. what i did is I simple put environment variable first in vercel secondly i override build command by pnpm run build as welll as install command with pnpm install then hit deploy

On Thu, Apr 4, 2024, 3:59 PM Rohi @.***> wrote:

@gneiru https://github.com/gneiru

bro i tried but it stll says drizzle-kit not found

sh: line 1: drizzle-kit: command not found

--

12:59:37.167 | ELIFECYCLE Command failed.

12:59:37.174 | WARN Local package.json exists, but node_modules missing, did you mean to install?

12:59:37.196 | Error: Command "pnpm db:push" exited with 1

You dont have node modules so it will not work. You have to run pnpm install first, then wait for node modules to appear in your root directory. Finally, pnpm db:push will definitely not throw error.

— Reply to this email directly, view it on GitHub https://github.com/gneiru/kd/issues/88#issuecomment-2036454801, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBSUCPSLYXMWUOD2RI4SKTY3UB7TAVCNFSM6AAAAABFIN6SBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZWGQ2TIOBQGE . You are receiving this because you were mentioned.Message ID: @.***>

skgupta507 commented 6 months ago

@gneiru bro i tried but it stll says drizzle-kit not found

sh: line 1: drizzle-kit: command not found

12:59:37.167 | ELIFECYCLE  Command failed. 12:59:37.174 | WARN  Local package.json exists, but node_modules missing, did you mean to install? 12:59:37.196 | Error: Command "pnpm db:push" exited with 1

You dont have node modules so it will not work. You have to run pnpm install first, then wait for node modules to appear in your root directory. Finally, pnpm db:push will definitely not throw error.

Hi @gneiru thanks to ur help i was able to deploy the site sucessfully.

but i have another help to ask with authentication when i do the signin with google i get the eror 500:internal server error. can u help me how to fix this. this is my Redirect_uri https://kdramax.vercel.app/api/auth/callback/google

noelrohi commented 6 months ago

Check your project's logs in vercel, it might help us debug the error

skgupta507 commented 6 months ago

Check your project's logs in vercel, it might help us debug the error

here`s the log file logs_result.json

it says something about environments variables being invalid. and edge function innvocation failed