-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for YouTubeTV #7
base: master
Are you sure you want to change the base?
Conversation
Specifically, there are only 2 differences between you Youtube API and the YoutubeTV api. The Youtube TV API requires authentication while it is optional on Youtube, and the endpoint is different. This adds support for authentication and adds the proper bind_data for YoutubeTV.
This depends on ur1katz/casttube#7 This adds support for casting YouTube TV to a chromecast. Currently only tested on SHIELD TV however I would definitely appreciate some testing on a regular chromecast as well if anyone has one and a Youtube TV subscription.
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.
Hi Thanks for the PR this looks like a great addition to CastTube. I left some comments on the code, check them out.
I also have a few questions:
- How do you get the cookies?
- What happens if CURRENT_TIME is not -1 (CURRENT_TIME will change when I merge my branch)
- Could you please add the changes to the README?
- I have no way of testing this as there is not YouTube TV service where I live. What testing have you done?
I'm planning to merge some long awaited changes this weekend so i'll merge it probably Saturday with some other changes if everything will be ready :D
@@ -132,7 +134,7 @@ def _initialize_queue(self, video_id, list_id=""): | |||
""" | |||
request_data = {LIST_ID: list_id, | |||
ACTION: ACTION_SET_PLAYLIST, | |||
CURRENT_TIME: "0", | |||
CURRENT_TIME: -1, |
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.
Does this affect YouTube TV? I have a branch that lets users change the start time of the video so CURRENT_TIME is going to be a variable
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.
I did some testing here and it seems to me that it didn't affect actual YouTube and causes YouTube TV to go to the "Live" section of the video instead of the current recording. As long as we still have the ability to pass CURRENT_TIME
as -1
into YouTube TV then this being a variable won't be a problem, as long as we make it default to -1
for YouTube TV.
b769d30
to
21fa395
Compare
@ur1katz Thank you for the code review! For your other questions:
|
Appending in a different way to fix the problem
So I was doing some more testing and it seems that passing in |
This depends on ur1katz/casttube#7 This adds support for casting YouTube TV to a chromecast. Currently only tested on SHIELD TV however I would definitely appreciate some testing on a regular chromecast as well if anyone has one and a Youtube TV subscription.
Hey, do you think you can extract the cookies in a script? It would make this simpler for people. I really don't know the tv interface so could you please tell me more about the API? As for the time you can look at #8 . I think the best way would be to override the play_video with a default of -1 in the YouTubeTV controller. |
5f7d7e4
to
3aa2483
Compare
Okay I'll go ahead and let you merge #8 first, I can pretty easily work with that. So I've drastically changed how I'm doing authentication, I am now properly requesting OAuth tokens and using requests-oauthlib. I have tweaked my changes to not take any cookies and just receive a request handler, which in my case is an authenticated requests-oauthlib session. I have also tested and basically the only functionality that works here is play_video. I can
Apologies I missed this question at first. So this part is a bit complicated, I tried to go ahead and pull the channel names are part of the API however they seem to be broadcast using some Also I just added a full example to home-assistant-libs/pychromecast#314 |
Sorry to keeping you waiting iv'e been really busy lately. Auth method looks good but I'm a little worried about people having to add a cloud project for this. Can you extract the cookies from request_handler? if so what do you think about using cookies and providing this method as an optional way to automate the cookies extraction(in casttube-scripts)? I'm not sure if it's better so asking for your input :) As for the other session requests it's cleaner to raise not implemented with a message that they are not supported in YouTubeTV. Last thing is #8 there's a bug that i'm currently not really sure how to solve. I don't want that to block this PR so just change the start_time for the YouTubeTV controller in this PR in i'll adjust #8 afterwards. I think the cleanest way to do this is to add **kwargs to _initialize_queue and |
Anything I can do to help get this merged? I've been using this patch together with this example script, and using a client id/secret created using the same way as gphotos-sync does it. |
Specifically, there are only 2 differences between you Youtube API and the YoutubeTV api. The Youtube TV API requires authentication while it is optional on Youtube, and the endpoint is different. This adds support for authentication and adds the proper bind_data for YoutubeTV.