Last active
July 2, 2020 09:22
-
-
Save 0187773933/7cbd948f70a31284cd3a006f709f687e to your computer and use it in GitHub Desktop.
Casts Twitch or Youtube or anything youtube-dl can Find to Chromecast via npm castnow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Quick Find Chromecast IP's | |
# python3 -c 'import pychromecast; print(pychromecast.get_chromecasts())' | |
# Then ARP Scan to Find Matching MacAddress | |
# arp -na | |
MacAddress="f0:ef:86:9:c3:30" | |
ChromecastIP=$(arp -na | grep -i $MacAddress | tail -1 | awk '{print $2}' | cut -d "(" -f2 | cut -d ")" -f1) | |
if [ -z "$ChromecastIP" ]; then | |
echo "arp scan empty" | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
DefaultGateway=$(netstat -rn -A inet | grep -A 1 "Gateway" | tail -1 | awk '{print $2}') | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
DefaultGateway=$(ip route ls | grep default | awk '{print $3}') | |
fi | |
echo "Default Gateway = $DefaultGateway" | |
echo "nmaping Default Gateway ..." | |
ChromecastIP=$(sudo nmap -sn $DefaultGateway/24 | grep -i '$MacAddress' -B 2 | head -1 | awk '{print $(NF)}') | |
fi | |
if [ -z "$ChromecastIP" ]; then | |
ChromecastIP=$(arp -na | grep -i $MacAddress | tail -1 | awk '{print $2}' | cut -d "(" -f2 | cut -d ")" -f1) | |
fi | |
echo "ChromecastIP = $ChromecastIP" | |
DirectURL=$(youtube-dl --no-warnings -f "best" --no-playlist --get-url $1) | |
echo $DirectURL | |
castnow --address $ChromecastIP "$DirectURL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
also this from google home mp3
https://nopaste.ml/#XQAAAQDIBgAAAAAAAAAxm8oZxjYXx7+wNWNjPlqNO4bze8SL9PWBxcXuh31T24LIowm5t7H7dTWKGKxwTgSiwu9FtAqomd5cCy1AiZ1aSaJ3x62bypsjg/xGEQYZWnJHPv2VautUiNm3vQs8NI0A8zXEfFTF1HiVPycYPUetqGs1ruo5BN1MkKqdQ0hsvoWhMquyhL4szdmZMDJq1OeAOMyytb/7y2p0OA2a7/SyA/xbCbMCFyGiE7v9kQhJ8c1Jv4iYGnAmh31fkjBFTLGXDNNj92knF5n2D4NPCmEQKTkNNgYP6lI8ig9fX+wfhhXBLIQnq/8eURL+C6Vb6Zkw++RVBfxSWdhn1yNZiGK03rKxwXJw05nRNUpPP4O38SzwBweOTt1tFT2IAgCnYlkJ04GchVqdjiOOQyVij5cXTS1bLeGeri6NO151f2ZW0XjuVUT5BqETodLy0x1FgVglCce+1o0903Fy+FXfXLWiw1yJzfJHju3x8xEFkiHr6lkvj+wOBAgyGNyBq6HiYKbQuVgDErEeNDrPN2YaJyv9r6m0m8i8DapUJovhUZ0vaMsfz+cS/XjNG4Mr+NKc3/gTO5FiU4zdL5P3354nZ/4iw6BUNZTf3MjHonztONyvmF/yxS0kDMoBJCG9B1MKgk6ITXCFSUBJTNDta1F9LmO/np4kxCJQqAPOcLcYatPHLmkT0PrdDi9t/3mAoSSVekRHQ8Zzsz16cd8EhtIwFroNHNy/qt+zDcU6NlmkCl1IV3MFlowMCzR5CnTkfE4LfAwrfOA0SAje2ApCk+bL5McbL58/gadO7JlROZic3VH2PsycWRMSNMnrA25yZ9acyO/SK29DyvbbFOwPcNf+cxwaKNaAHq+QeDqMY3yf/vZ/zQ==