Comments (6)
+1
from youtube-studio.
@adasq So, after a lot of digging and comparing http requests made by browser and the script, I think I found what is the issue in my case.
I got more than one YouTube accounts on one email, and the channel I'm trying to automate is one of them (when I log in, by default this account is not selected, so I'm switching it manually). The information about which account is 'active', is probably held in the cookie called LOGIN_INFO
which is present for me (you can also see it in the image I provided above).
So, all I had to do is add it to the list of cookies in the init
function, something like this:
async function init({
SID,
HSID,
SSID,
APISID,
SAPISID,
LOGIN_INFO,
}) {
...
const cookie = `SID=${SID}; HSID=${HSID}; SSID=${SSID}; APISID=${APISID}; SAPISID=${SAPISID}; ${LOGIN_INFO ? `LOGIN_INFO=${LOGIN_INFO}` : ''}`
...
What was actually happening previously for me (when I was not specifying LOGIN_INFO
), is that YouTube studio was sending a page that was just showing oops, something went wrong
. But for some reason, it also had a script, that was creating ytcfg
and filling some of it's properties, including INNERTUBE_API_KEY
, but not DELEGATED_SESSION_ID
, so I never thought that it's an 'error' page, but then I tried to render it xD
I just submitted an MR with this change, feel free to merge or request some changes :P
from youtube-studio.
Wow, great job @cxovrika!
Thank you for your time and deep research.
Your changes published as of [email protected]
.
from youtube-studio.
Hey @cxovrika ,
Can you verify whether you can set an endscreen, with just one element, TYPE_RECENT_UPLOAD
?
It works for two of my accounts so I think that might by related to account itself.
Please, try open file node_modules/youtube-studio/src/youtube-studio-api.js
, search for function setEndScreen
and try to replace line:
_.set(template, 'context.user.onBehalfOfUser', config.DELEGATED_SESSION_ID);
with:
delete template.context.user.onBehalfOfUser;
Then, please, let me know how the response look like
from youtube-studio.
@adasq I tried that but the result was the same.
Then I digged a bit more into what's happening and found out that config
does noes not have DELEGATED_SESSION_ID
at all. Then I checked how is it generated, and found that it's set in getConfig
function:
fetchConfig = {
INNERTUBE_API_KEY: windowRef.ytcfg.data_.INNERTUBE_API_KEY,
DELEGATED_SESSION_ID: windowRef.ytcfg.data_.DELEGATED_SESSION_ID,
};
Here is how my windowRef
looks like: https://pastebin.com/KSMp8sQT
So, after running the vm.run('${jsCode}; window.ytcfg = ytcfg;');
script, the ytcfg
was generated and set. The problem is that it contains INNERTUBE_API_KEY
but does not contain DELEGATED_SESSION_ID
, which we are trying to get. Does it mean that something changed on YouTube API side?
I tried to use INNERTUBE_CONTEXT_SERIALIZED_DELEGATION_CONTEXT
's value instead (just because it's also related to delegation, idk :V) but in that case I received:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"message": "Internal error encountered.",
"domain": "global",
"reason": "backendError"
}
],
"status": "INTERNAL"
}
}
so probably I have to sett something else there. Btw, the DELEGATION_CONTEXT
looks like this:
{
externalChannelId: 'UC3AZ26x1NTKK3_lqFn4dMQg',
roleType: { channelRoleType: 'CREATOR_CHANNEL_ROLE_TYPE_OWNER' }
}
Any ideas? Could you also please check if in case of your channels the DELEGATED_SESSION_ID
is present?
from youtube-studio.
Thank you for digging into the code!
Well, in my case DELEGATED_SESSION_ID
is set for one account, and it does not exist for another, but I am still able to set endscreens for both of them.
- I published a new version with some changes - I don't believe it will help at all, but it's worth checking anyway.
- What we can check on your side, is a payload
template
variable fromnode_modules/youtube-studio/src/youtube-studio-api.js:setEndscreen
and compare it to the payload send onstudio.youtube.com
while adding end screen (POSThttps://studio.youtube.com/youtubei/v1/video_editor/edit_video?alt=json&key={yourKey}
). Any differences spotted might be helpful. Additionally you can print globalheaders
variable to verify http headers
Thanks in advance for your time!
from youtube-studio.
Related Issues (20)
- Cannot read property 'Symbol(Request internals)' of null HOT 2
- i dont know to how set up HOT 1
- Create a live strem type WEBCAM HOT 1
- Trim Video Length HOT 1
- Get account channels List HOT 2
- Option to set comment options. HOT 3
- UnhandledPromiseRejectionWarning: HOT 4
- What are botguardResponse and challenge for ? HOT 3
- How can i generate new sessionToken with new challenge and old botguardResponse?
- how to HOT 2
- Websocket closed when trying to upload large videos HOT 2
- Video Rejected HOT 1
- New method to resolve sessionToken HOT 10
- I cant get sessionToken HOT 3
- Thumbnail and tags support for video upload HOT 1
- Getting 400 Error while uploading video
- Cannot use setEndScreen anymore. It requires sessionToken HOT 3
- How can i get SESSION_TOKEN without entering to youtube studio in python automatically? HOT 4
- I want to know about this code , is this still working (as YouTube changed its interface) or is it now a dead code
- Typescript support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtube-studio.