twitch bot


SUBMITTED BY: TOTSUKA

DATE: May 12, 2022, 12:38 a.m.

FORMAT: Python 3

SIZE: 1.6 kB

HITS: 439

  1. import concurrent.futures, time, random, os
  2. #desired channel url
  3. channel_url = 'https://twitch.tv/yourchannelname'
  4. #number of viewer bots
  5. botcount = 10
  6. #path to proxies.txt file
  7. proxypath = "C:\Users\YOURVLCMEDIAPLAYER"
  8. #path to vlc
  9. playerpath = r'"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\VideoLAN\VLC media player"'
  10. #takes proxies from proxies.txt and returns to list
  11. def create_proxy_list(proxyfile, shared_list):
  12. with open(proxyfile, 'r') as file:
  13. proxies = [line.strip() for line in file]
  14. for i in proxies:
  15. shared_list.append((i))
  16. return shared_list
  17. #takes random proxies from the proxies list and adds them to another list
  18. def randproxy(proxylist, botcount):
  19. randomproxylist = list()
  20. for _ in range(botcount):
  21. proxy = random.choice(proxylist)
  22. randomproxylist.append(proxy)
  23. proxylist.remove(proxy)
  24. return (randomproxylist)
  25. #launches a viewer bot after a short delay
  26. def launchbots(proxy):
  27. time.sleep(random.randint(5, 20))
  28. os.system(f'streamlink --player={playerpath} --player-no-close --player-http --hls-segment-timeout 30 --hls-segment-attempts 3 --retry-open 1 --retry-streams 1 --retry-max 1 --http-stream-timeout 3600 --http-proxy {proxy} {channel_url} worst')
  29. #calls the launchbots function asynchronously
  30. def main(randomproxylist):
  31. with concurrent.futures.ThreadPoolExecutor() as executer:
  32. executer.map(launchbots, randomproxylist)
  33. if __name__ == "__main__":
  34. main(randproxy(create_proxy_list(proxypath, shared_list=list()), botcount))

comments powered by Disqus