6 ms·
Show HN: ytcast – cast YouTube videos to your smart TV from command-line
hi, this is a project I've been working on and off for the last three months,
it's my first non-trivial, non-hello-world, actually useful (at least to me) go
project. it would be very nice if you could just try the program and see if it
works on your setup!
the readme[0] explains how it works, why I wrote it and how it fits in my
"command-line centric" computing environment (there is also a video demo[1] :)).
if you know go, feel free to take a look at the code and review it! I'm still
pretty much new to go and I'd love to hear opinions, feedback and tips from more
seasoned go developers :)
[0]: https://github.com/MarcoLucidi01/ytcast#ytcast https://github.com/MarcoLucidi01/ytcast#ytcast
[1]: https://www.youtube.com/watch?v=07aWOpi8DVk https://www.youtube.com/watch?v=07aWOpi8DVk
- deleted 5y ago[deleted]
- brunoqc 5y agoCan it remove ads?
- marcolucidi 5y agonope
- heavyset_go 5y agoHow does this differ from, say, catt[1]? [1] https://github.com/skorokithakis/catt https://github.com/skorokithakis/catt
- marcolucidi 5y agoi learned about catt in this thread and i never used it, so i may be wrong about something, but these should be the main differences: - they use a different protocol for device discovery, catt uses mDNS, ytcast uses DIAL. - catt requires a chromecast to work, ytcast should work with any DIAL enabled device that supports the YouTube on TV app. - catt can cast from many sources including local files, ytcast merely "tells" the YouTube on TV app to play videos, so it's limited to YouTube.
- heavyset_go 5y agoCool, thanks for the explanation. I'll give your project a spin.
- pmoriarty 5y agoHopefully this offers some way to avoid the ads, like youtube-dl does.
- marcolucidi 5y agounfortunately it doesn't, it merely "tells" the YouTube on TV app to play videos.
- Loranubi 5y agoSo if I don't want to get a HDMI cable to connect my TV, but happened to have a network connection instead I would use that?
- marcolucidi 5y agoyes? i mean for YouTube videos yes (if your tv supports the YouTube app and DIAL protocol).
- sharmi 5y agoytcast search functionality is a great feature. When I come across a video that would be interesting for my kids, I cast it on tv. Now I don't need the url to cast, I can just search by the text. Castnow, mentioned elsewhere in the thread, seems to be able to cast videos saved on the laptop directly. Our usual routine is to copy to pendrive, move to TV and then switch the TV source to usb. This would be a welcome addition.
- marcolucidi 5y agothank you! the search video functionality is not builtin into ytcast, but is actually a separate script (ytsearch[0]) so you can use it with other tools! > cast videos saved on the laptop directly.... This would be a welcome addition. yeah i know this would be great, but unfortunately it's unfeasible with the current implementation. what ytcast does is merely "telling" the YouTube on TV app to play videos. [0]: https://github.com/MarcoLucidi01/bin/blob/master/ytsearch https://github.com/MarcoLucidi01/bin/blob/master/ytsearch
- 1vuio0pswjnm7 5y agoytsearch does not support continuation searches. (It only retrieves the first 15 results.) Continuation searches occur when a user scrolls to the bottom of a search results page. YouTube (or NewPipe, etc.) sends automated search requests to continue the search, triggered automatically via Javascript when the user scrolls to the bottom of the page. YouTube continuation searches leak a large amount of unnecessary user data to Google. 1.sh[1] sends continuation searches manually and sends only the minimum ($MIN) data needed to fulfill the request. It can be used to continue a search indefinitely over an extended period of time. Using an app like NewPipe, often recommended on HN, one could try to do continuation searches by repeatedly scrolling to the bottom of the search results page. However if one goes forward to view a result and then presses a back button, she will be returned to the first page the results, losing all the continuation search results. And if the browser tab or app is closed or crashes, the continuation search results are lost. It is easy to lose one's place when doing continuation searches using a Javascript-enabled browser or app. Using this script, this will never happen. 1.sh only uses TLS1.3 so no server certificate is sent in plaintext over the wire. Nor does it send SNI, i.e., plaintext hostnames on the wire. ytsearch requires sed, column, awk, jq, fzf, and curl. 1.sh requires sed, netcat, stunnel and flex. 1.sh could be adapted to use curl but how does one disable SNI with curl. Not to mention curl has a TLS fingerprint that sites may use to try to block requests or treat them with prejudice. Usage for 1.sh is 1.sh query; #<-- saves line-oriented JSON to query.yts 1.sh << query.yts >> query.yts; #<-- appends more JSON to query.yts To convert our line-oriented JSON to TSV, we can use line-oriented UNIX utilities. In general, this will be faster than jq and more robust for large files. 1. 1.sh is a 25 line, 1000 character shell script. https://news.ycombinator.com/item?id=30408770 https://news.ycombinator.com/item?id=30408770
- jlkuester7 5y agoNice! Projects like this give me hope for Chromecast support one day from Android devices not running Google Play Services (e.g. GrapheneOS)...
- andrewshadura 5y agoytcast uses a different protocol.
- marcolucidi 5y agothanks! as already said, ytcast won't work "directly" with chromecast since they use a different protocol, but there are other projects linked in this thread which work very nice with chromecast!
- genericacct 5y agoVery useful, i dislike using yt's UI on televisions
- epa 5y agoTry a Google Chromecast TV and side load SmartTubeNext, no ads and better UI. https://github.com/yuliskov/SmartTubeNext https://github.com/yuliskov/SmartTubeNext
- marcolucidi 5y agoyeah, i especially dislike searching videos with the remote!
- stavros 5y agoCATT (which I wrote) does the same, except it supports whatever site youtube-dl supports (which is basically everything): https://github.com/skorokithakis/catt/ https://github.com/skorokithakis/catt/
- rahimnathwani 5y agoOP seems to work for any Smart TV with a YT app (e.g. a Samsung or Roku TV), whereas CATT requires a Chromecast?
- stavros 5y agoThere are various protocols for TVs to cast things, it seems like this one uses DIAL, whereas CATT uses Google Cast. I was thrown off by the icon, it does seem like the two are slightly different, thanks for the correction.
- rahimnathwani 5y agoFWIW I didn't know about CATT, and I actually have some use for it. I sometimes want to cast local video files from my PC to a projector on the other side of the room. That already has a Chromecast so CATT should make it easy.
- marcolucidi 5y agoyes, ytcast should work with any DIAL enabled device that supports the YouTube on TV app, so it doesn't require a specific device, but it's limited to YouTube videos.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- igravious 5y agogroobiest@NH5xAx ~/Code/ytcast [master] ytcast -l ab5d4550 192.168.1.2 "[LG] webOS TV OLED55C16LA" groobiest@NH5xAx ~/Code/ytcast [master] ytcast -d lg https://www.youtube.com/watch?v=VZx-rLoV4do groobiest@NH5xAx ~/Code ~/.local/bin/catt scan Scanning Chromecasts... Error: No devices found. 𝑥
- sdoering 5y agoCool. Can't wait to try it out. Thanks.
- marcolucidi 5y agosounds great!
- winstonschmidt 5y agoGreat tool! Does going through ytcast have any impact on whether the played video influences youtube's recommendation algorithm (which annoys me a lot)?
- marcolucidi 5y agothanks! yes, unfortunately the algo is still influenced because ytcast "tells" the YouTube on TV app to play the videos.
- e12e 5y agoThank you for taking the time to describe how it works in the readme. I loathe "magic" - and love seeing the mechanics of how stuff like this works. Makes your project useful to me, even if right now, I rarely have computer (with a cli) close to my TV.
- marcolucidi 5y agoi'm very glad you appreciated that! > I loathe "magic" - and love seeing the mechanics of how stuff like this works. yeah me too :)
- mobilio 5y agoI'm using castnow: https://github.com/xat/castnow https://github.com/xat/castnow and for our needs works perfect.
- marcolucidi 5y agogood for you! good to know about castnow :)
- sahinabi 5y agoThank you for the project and detailed readme, very helpful.
- marcolucidi 5y agothanks, very glad you liked the readme :)
- rolandog 5y agoOoh, nice! I'll be giving it a try today or tomorrow, as I had been having trouble with MkChromecast.
- marcolucidi 5y agosounds great!
- Reggino 5y agoNice! I wrote something similar for local video files: https://github.com/Reggino/chromecaster https://github.com/Reggino/chromecaster
- marcolucidi 5y agocool! lots of interesting things can be done with a chromecast, unfortunately i don't have one.
- phoronixrly 5y agoI found the magic behind "play on TV" so creepy that I made sure my LG TV was never to be connected to a network. I can achieve similar functionality via my libreelec box without proprietary software connected to my LAN.
- mastazi 5y agoIs there something like a chromecast "server"? What I mean: I have a Linux box connected to my TV - I want to know if there is a way to cast from a phone to the Linux box, by installing some software on the linux box that makes it appear as a Chromecast to other devices
- 35mm 5y agoKodi has this feature for AirPlay, not sure if it works with Chromecast too. Also maybe look into OpenMax + Raspicast
- mastazi 5y agoNice, thank you I will look into those
- MayeulC 5y agoChromecast is completely closed-source, I'd argue against buying into that ecosystem. Nymphcast [1] is an alternative, but wouldn't be compatible with existing clients, since the protocol is different. Miraclecast [2] is an implementation of miracast/wi-fi display that runs on Linux. There is also a myriad of alternatives: vnc, raspicast, etc. Leapcast [3] used to be an implementation of what you want (while using chrome as a black box). There are some implementations of airplay servers. And lastly, a lot of media players implement some way of playing on one another (vlc, kodi, jellyfin, plex). Funnily, you might just be interested in UPNP and DLNA. Support for these is quite robust, but it tends to disappear on newer devices (to the benefit of proprietary solutions like chromecast and airplay). [1]: http://nyanko.ws/product_nymphcast.php http://nyanko.ws/product_nymphcast.php [2]: https://github.com/albfan/miraclecast https://github.com/albfan/miraclecast [3]: https://github.com/dz0ny/leapcast https://github.com/dz0ny/leapcast
- mastazi 5y agoThank you good list, and yeah I get that it's a closed source system but wouldn't it be cool if the FOSS community was able to reverse engineer it? Thanks I'll look into the alternatives you linked
- bncy 5y agoThat's amazing, I often have problems with sending video to my tv, somehow chrome is not that good for it, thanks!
- marcolucidi 5y agothank you! another handy thing that ytcast does and that chrome / YouTube smartphone app don't do is to wake-on-lan my tv if it's off when i want to play a video.