Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we add po_token and visitor_data in cookie.json file #1024

Open
lewsol2 opened this issue Dec 28, 2024 · 14 comments
Open

How can we add po_token and visitor_data in cookie.json file #1024

lewsol2 opened this issue Dec 28, 2024 · 14 comments

Comments

@lewsol2
Copy link

lewsol2 commented Dec 28, 2024

problem description

How can we generate po_token and visitor_data? and How can we configure it for instance to get it worked?
Can we use po_token and visitor_data without oAuth cookies?

your instance configuration

No response

@coderonex
Copy link

I also asked a related question, but no one was willing to answer it

@hamaadraza
Copy link

hamaadraza commented Dec 30, 2024

Not sure how you can configure po_token and visitor_data in cobalt but for generating these 2 things you can use https://github.com/LuanRT/BgUtils , You will find an example folder that you can reference for usage.

EDIT:
According to this line https://github.com/imputnet/cobalt/blob/0f6516567191706faedff58395befad0b795d648/api/src/processing/services/youtube.js#L79 you can add both of these things in the cookie file and they should be applied.

@hextor1

This comment was marked as outdated.

@hextor1
Copy link

hextor1 commented Dec 30, 2024

But unfortunately cookies is not working.

@dumbmoron
Copy link
Member

dumbmoron commented Dec 30, 2024

You cannot add PO_Token and visitor data in cookies.json fil. you can add these two in api file which is created in nodejs. and also cookies.json only for cookies which you will add see exmaple here https://github.com/imputnet/cobalt/blob/main/docs/examples/cookies.example.json

what? 😭

you can add po_token and visitor_data as regular cookie values into the cookie

const rawCookie = getCookie('youtube');
const rawCookieValues = rawCookie?.values();
const cookie = rawCookie?.toString();
if (!innertube || shouldRefreshPlayer) {
innertube = await Innertube.create({
fetch: customFetch,
retrieve_player: !!cookie,
cookie,
po_token: rawCookieValues?.po_token,
visitor_data: rawCookieValues?.visitor_data,
});
lastRefreshedAt = +new Date();
}

(so if you have a cookie like a=b; c=d, you can just add the other values onto them like a=b; c=d; po_token=x; visitor_data=y)

@hextor1
Copy link

hextor1 commented Dec 30, 2024

You cannot add PO_Token and visitor data in cookies.json fil. you can add these two in api file which is created in nodejs. and also cookies.json only for cookies which you will add see exmaple here https://github.com/imputnet/cobalt/blob/main/docs/examples/cookies.example.json

what? 😭

you can add po_token and visitor_data as regular cookie values into the cookie

const rawCookie = getCookie('youtube');
const rawCookieValues = rawCookie?.values();
const cookie = rawCookie?.toString();
if (!innertube || shouldRefreshPlayer) {
innertube = await Innertube.create({
fetch: customFetch,
retrieve_player: !!cookie,
cookie,
po_token: rawCookieValues?.po_token,
visitor_data: rawCookieValues?.visitor_data,
});
lastRefreshedAt = +new Date();
}

(so if you have a cookie like a=b; c=d, you can just add the other values onto them like a=b; c=d; po_token=x; visitor_data=y)

Its talking about cookies.json file

@dumbmoron
Copy link
Member

dumbmoron commented Dec 30, 2024

Its talking about cookies.json file

yeah, me too

@hextor1
Copy link

hextor1 commented Dec 30, 2024

Its talking about cookies.json file

Cookies is still working??

@gamersindo1223
Copy link

Tested it right now, not working currently

@gamersindo1223
Copy link

gamersindo1223 commented Dec 30, 2024

I don't know if my ip got blacklisted, or if it's a problem with my cookies

@hextor1
Copy link

hextor1 commented Dec 30, 2024

I don't know if my ip got blacklisted, or if it's a problem with my cookies

Try isp proxies its working now a days. all other ips blocked

@gamersindo1223
Copy link

Alright!

@coderonex
Copy link

Its talking about cookies.json file

yeah, me too

Is there a tutorial on how to get cookie, po_token and visitor_data?

@ZEREX222
Copy link

the same question. OAuth2 is not working. I saw someone added support YouTube cookies. I tried to use them directly copied from YouTube they are not working. Saw some po_token and visitor_data also have no idea where can I find it. On my local instance everything is working except YouTube. Thanks for explaining how to fix YouTube in advanced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants