-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow authenticated requests via cookie values #346
Conversation
Hey @xBaank, thanks a lot for the PR! I think this is a cool feature, but I was thinking maybe we can automate the extraction of these cookies? I was thinking maybe add a button you can click to show an embedded browser, have the user log in, and then extract those cookies automatically. In WPF, this should be doable with the What do you think? |
I didn't think about that but it seems to be a much better approach 😁, I will take a look at it. |
Really excited to see it happen 🙂 |
I wasn't able to do it with WebBrowser because google recognized it as a not secure browser, but WebView2 seems to work. |
<Button | ||
Margin="16" | ||
HorizontalAlignment="Stretch" | ||
Command="{s:Action Logout}" | ||
Content="Logout" | ||
IsCancel="True" | ||
IsDefault="True" | ||
Visibility="{Binding IsLogged, Converter={x:Static converters:BoolToVisibilityConverter.VisibleOrCollapsed}}" | ||
Style="{DynamicResource MaterialDesignOutlinedButton}" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we can display the username here? So that the user knows what account they're logged in as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making a request to https://www.youtube.com/youtubei/v1/account/account_menu?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8&prettyPrint=false
returns accountName
and channelHandle
, I don't know if there is any other way to get it.
Should we go this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need to make a request, then it's not worth it. I was hoping there would be something available directly after logging in 🤔
Thanks a lot @xBaank! I'll take it from here and make some adjustments |
@xBaank were you able to use this approach to pull videos that are only accessible as a logged in user? I tried pulling a private video after logging in with my account, but it didn't work 🤔 |
I just tested the videos i mentioned in the issue and the download speed wasn't limited, maybe for private videos there are headers missing. |
I see. Could be cool to figure out what cookies are needed to get private videos too. Since we're already logged in, might as well. |
It seems like we need to set the cookies that youtube tell us to set each time we make a request to their endpoints or we can't access private videos, and for some reason those cookies are not given at the time we login and and go to |
Can you make a PR with these changes too? 🙂 |
Closes #198
This pull request enables the usage of
SAPISID
and__Secure-3PSID
cookie values to perform authenticated requests. When used, all requests will be made using theANDROID
client, resolving the issue of Occasionally streams are very slow to download for videos like rXMX4YJ7Lks and 6fFnUaeXXeg.To get the required cookies:
Storage
orApplication
tabCookies
thenhttps://www.youtube.com
and copy theSAPISID
and__Secure-3PSID
valuesI have a few questions though: