yt-tor-binge.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # Allows to binge watch YT videos through IncogTube's onion instance
  3. #
  4. # Basically eliminating the need of running "export http_proxy=... && mpv ..."
  5. # again and again when binge watching videos. Asks to input one URL, plays it.
  6. # When it ends or player is closed manually, asks for another URL to play
  7. # through the onion service again. This will repeat until Ctrl+C is pressed or
  8. # empty input is passed.
  9. #
  10. # IncogTube proxies videos, so data comes from their servers, without users
  11. # having to directly talk to YT servers. IncogTube offers their Invidious
  12. # service over I2P, TOR, Yggdrasil in addition to clearnet. Since this script
  13. # plays videos through their TOR onion service it adds a layer of protection
  14. # over the existing privacy benefits of using Invidious.
  15. #
  16. # WARNING: This has not been extensively tested for security. There is
  17. # absolutely no warranty. Users are solely responsible for everything
  18. # related to this script and how it is used.
  19. # Please do not misuse the service.
  20. #
  21. # Instructions:
  22. # 1. Install mpv, tor, privoxy and bash to run this script
  23. # 2. Edit /etc/privoxy/config to add: forward-socks5t / 127.0.0.1:9050 .
  24. # Remember to change 9050 to your TOR SOCKS port in torrc
  25. # 3. Start tor service or run tor manually (if not already)
  26. # 4. Start privoxy service
  27. # 5. Run this script:
  28. # bash /path/to/this/yt-tor-binge.sh or ./yt-tor-binge.sh
  29. # 6. Enter a YT URL (works with Invidious sub/domain URLs too)
  30. #
  31. # License: CC0 1.0 Universal
  32. # Privoxy HTTP proxy port.
  33. # Change this only if you've set a different port than the default 8118 on
  34. # Privoxy's config file.
  35. HTTP_PROXY_PORT='8118'
  36. export http_proxy=http://127.0.0.1:${HTTP_PROXY_PORT}
  37. INPUT='--' # Free pass for the first loop
  38. until [ -z "$INPUT" ]; do
  39. echo '== Enter YT/Invidious URL to play or Ctrl+C to quit:'
  40. read INPUT
  41. if [ -n "$INPUT" ]; then
  42. YT_VIDEO_ID=$( echo "$INPUT" | sed -nr 's|.*v=(.*)|\1|p' )
  43. echo "-- Video id parsed as: ${YT_VIDEO_ID}"
  44. echo "-- Launching mpv through IncogTube's .onion instance..."
  45. mpv http://tuberyps2pn6dor6h47brof3w2asmauahhk4ei42krugybzzzo55klad.onion/watch?v=${YT_VIDEO_ID}
  46. else
  47. echo '== Empty Input. Exiting...'
  48. fi
  49. done