Kodi Community Forum

Full Version: Leanback YouTube on TV for PC on Chrome
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am not sure if this is where I should post this, if not, can the MOD please move this and I apologize in advance.

Anyhow, after a little trial and error, I have figured out how to launch leanback youtube on tv for Windows in Chrome using a Smart TV user agent switch and launching it through a batch file. Using a portable installation of chrome allows everything to "just work"
Instructions:
  • Install portable chrome to the directory of your choosing and make note of its location. 
  • Open chrome portable and sign in to your Google account
  • Open notepad or Notepad++ and paste all of the following as one line of code:
Code:
"root\path\to\chrome\portable\App\Chrome-bin\chrome_proxy.exe" --user-data-dir="root\path\to\chrome\portable\Data\profile" --profile-directory=Default --user-agent="Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15" --kiosk https://www.youtube.com/tv#/surface?c=FEtopics&resume
  • You will replace "root\path\to\chrome\portable\" with the root of the portable chrome install folder. So if you installed it to C:\GoogleChromePortable64", you would replace the path to chrome at beginning and the "--user-data-dir=" it would look like this:

Code:
"C:\GoogleChromePortable64\App\Chrome-bin\chrome_proxy.exe" --user-data-dir="C:\GoogleChromePortable64\Data\profile" --profile-directory=Default --user-agent="Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15" --kiosk https://www.youtube.com/tv#/surface?c=FEtopics&resume
  • Save as .bat file ext to an easy to remember location and exit.

If you ever need to change your user agent string here is a list of strings for different devices.

Next you need to convert that .bat to an exe. When the program opens (launch Bat_To_Exe_Converter_(x64) for 64-bit systems).
  • select your .bat then select invisible for visibility.
  • Under architecture, select whether your system is 32 or 64 bit.
  • (optional) on the version tab, you can include an icon if you want.
  • click the "Compile" button (this is where you may get the AV false positive, its fine, I have been using this program for years and have never had issues)
Note: The .exe will be saved in the same location as your .bat file for easily locating after you're through


Bonus: 
  • If you have autohotkey installed and have AdvancedMCERemoteMapper, you can create a script and add these lines for launching and exiting with ease.
  • replace "path\to\bat-exe\you\created\YouTube on TV.exe" with the location of the .exe you created earlier. 
Code:

#SingleInstance, Force
HideShowTaskbar(hide := hide)
   
HideShowTaskbar(action) {
   static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
   VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
   NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
   NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
   DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
}    

^!V::
          ;this launches youtube on tv using Ctrl+Alt+V
if WinExist("YouTube on TV - Google Chrome ahk_class Chrome_WidgetWin_1")
   {
      WinActivate
      return
   }
Run "path\to\bat-exe\you\created\YouTube on TV.exe"
return
+Escape::
          ;shift+escape will close the tab and close portable chrome as well. Since chrome closes when the last tab is closed, this effectively closes chrome without needing to send alt+f4. 
    send, ^w
WinWaitClose, YouTube on TV - Google Chrome ahk_class Chrome_WidgetWin_1 
return

Finally you can set the shortcut of control+alt+v andshift+escape within Advance MCE Remote Mapper to any key you like, I chose "Pictures" on my HP Remote and "visualisation" as my exit. You can use any key though.

Now you can add it to Advanced Launcher in Kodi and add it to the home screen as well as launching it from the remote.

I hope this helps someone as it has me. If you have any problems, post it here and I will try and sort it out for you.,
https://9to5google.com/2019/09/16/youtub...bled-soon/
YouTube has offered a “leanback” experience that’s remote optimized on the web for a long time – nearly a decade, in fact. Now, it’s been revealed that this feature will be killed off in the near future.

looks like it will be the same as youtube plugin
(2020-03-03, 01:35)the_other_guy Wrote: [ -> ]https://9to5google.com/2019/09/16/youtub...bled-soon/
YouTube has offered a “leanback” experience that’s remote optimized on the web for a long time – nearly a decade, in fact. Now, it’s been revealed that this feature will be killed off in the near future.

looks like it will be the same as youtube plugin
go to youtube.com/tv on any browser, its already shutdown for pc usage. However on any smart tv, its still fully functional...just that its basically a web browser wrapper. That's what I figured out in doing this. We are tricking website into thinking its a samsung smart tv. Perhaps I am misunderstanding the meaning of your post? I offer this as an alternative to the YouTube plugin offered by the Kodi team. I always liked the Leanback experience of youtube. PLUS, as an added bonus, you can create a YouTubeKids launcher in a similar manner.
(2020-03-03, 06:37)ctindell81 Wrote: [ -> ]
(2020-03-03, 01:35)the_other_guy Wrote: [ -> ]https://9to5google.com/2019/09/16/youtub...bled-soon/
YouTube has offered a “leanback” experience that’s remote optimized on the web for a long time – nearly a decade, in fact. Now, it’s been revealed that this feature will be killed off in the near future.

looks like it will be the same as youtube plugin
go to youtube.com/tv on any browser, its already shutdown for pc usage. However on any smart tv, its still fully functional...just that its basically a web browser wrapper. That's what I figured out in doing this. We are tricking website into thinking its a samsung smart tv. Perhaps I am misunderstanding the meaning of your post? I offer this as an alternative to the YouTube plugin offered by the Kodi team. I always liked the Leanback experience of youtube. PLUS, as an added bonus, you can create a YouTubeKids launcher in a similar manner.

Hi,

Thank you very much for this. I can now access youtube.com/tv as I used to.

However, I have tried to used add ons such as Chrome Launcher and Browser Launcher. I am unable to open the website successfully at all via Kodi. It is almost like the Chrome extension I am using 'User Agent Switcher' is not automatically running that script unless I open the browser via my toolbar.

Thanks,
Matthew
Hi @SoAdCrAzY , I haven't been on the forum for some time. I apologize and am glad this helped you and would like to help you sort this out. I kindly ask you to please share with me what your .bat file looks like. Just copy and paste it using the code function. it looks like this </>

I have attached an archive that has everything you need to solve your issues with instructions on how to set it up within kodi.

Here is the link

Again, I am sorry it took so long to get back to you. If you have any issues, you can find contact info in the read me file.