Sam6734 / TwitchViewbot

Simple Python twitch viewbot
Creative Commons Zero v1.0 Universal
37 stars 55 forks source link

Problem with starting the script #4

Open Sensaicraft opened 3 years ago

Sensaicraft commented 3 years ago

File "SimpleTwitchBot.py", line 32 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') ^

any idea whats wrong?

coeex commented 3 years ago

Do you have streamlink installed? Did you change anything about that line of code? Did you test it on another computer if you have any?

Sensaicraft commented 3 years ago

I have streamlink installed and i just changed the things i should like the url. And no i dont have another computer i did it with a linux ubuntu v-server cus python didnt work on my pc.

coeex commented 3 years ago

Did you install VLC or any other player that streamlink needs? It's a really odd error since it does not provide me with much info...

Sensaicraft commented 3 years ago

I installed VLC but i´m not sure if i have the right path

Sam6734 commented 3 years ago

I have a linux version but I used mpv player for it instead of vlc. sudo apt-get install mpv. Here's the code for the linux one

from datetime import datetime import multiprocessing, random, time, os from multiprocessing import Pool, Semaphore manager = multiprocessing.Manager() shared_list = manager.list()

total_task_count = range(10) url = 'https://www.twitch.tv/account' proxyfile = '/home/doze/Proxy/practiceproxy.txt'

def create_proxy_list(proxyfile): with open(proxyfile, 'r') as file: proxies = [line.strip() for line in file] for i in proxies: shared_list.append((i)) return shared_list

def p3(url, proxy): try: os.system(f'streamlink --player="mpv" --player-no-close --player-continuous-http --hls-segment-timeout 5 --hls-segment-attempts 3 --retry-open 1 --retry-streams 1 --retry-max 1 --http-stream-timeout 5 --http-proxy {proxy} {url} worst') except Exception as e: print(e) print(f'error on {proxy}')

def choose_and_remove_proxy(shared_list = create_proxy_list(proxyfile)): proxy = (random.choice(shared_list)) shared_list.remove(proxy) p3(url, proxy)

for task_num in total_task_count: time.sleep(random.randint(0, 25)) p = multiprocessing.Pool(multiprocessing.cpu_count()) p.map_async(choose_and_remove_proxy, [shared_list])

Sensaicraft commented 3 years ago

Tested it and got the Error :

File "SimpleTwitchBot.py", line 13 proxies = [line.strip() for line in file] ^ IndentationError: expected an indented block

coeex commented 3 years ago

Tested it and got the Error :

File "SimpleTwitchBot.py", line 13 proxies = [line.strip() for line in file] ^ IndentationError: expected an indented block

To find out the path to vlc type in this ->" whereis vlc " and copy the first path.

Sensaicraft commented 3 years ago

Tested it and got the Error : File "SimpleTwitchBot.py", line 13 proxies = [line.strip() for line in file] ^ IndentationError: expected an indented block

To find out the path to vlc type in this ->" whereis vlc " and copy the first path.

Still :

File "SimpleTwitchBot.py", line 32 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') ^ SyntaxError: invalid syntax

coeex commented 3 years ago

Can you try to copy only that line of code and run it on a separate python script? Just hardcode the values and try it that way. Remove the proxy from the command too so it will be faster to test. Remove and add different parameters and find your error. If it still does not work then we have to think of something else.

Also try to run the command in terminal without python

Sensaicraft commented 3 years ago

Can you try to copy only that line of code and run it on a separate python script? Just hardcode the values and try it that way. Remove the proxy from the command too so it will be faster to test. Remove and add different parameters and find your error. If it still does not work then we have to think of something else.

Also try to run the command in terminal without python

I´m not sure if i did it right but this was the error :

File "SimpleTwitchBot.py", line 3 os.system(f'streamlink --player="mpv" --player-no-close --player-continuous-http --hls-segment-timeout 5 --hls-segment-attempts 3 --retry-open 1 --retry-streams 1 --retry-max 1 --http-stream-timeout 5 --http {url} worst') ^ IndentationError: expected an indented block

Sensaicraft commented 3 years ago

Found out that i used python 2.7.16 because i written "python SimpleTwitchBot.py" and not "python3 SimpleTwitchBot.py" but now i have a new error:

[cli][error] Unable to open URL: https://api.twitch.tv/api/channels/leoon_live/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/leoon_live/access_token.json?as3=t) error: No playable streams found on this URL: https://www.twitch.tv/leoon_live

(He was live at this moment!)

coeex commented 3 years ago

Nice! Now the thing that could be happening is that your proxy is dead or an error with the streamlink. Happens to me sometimes. Try without Proxies .

Sensaicraft commented 3 years ago

But without proxies i can only bot 1 viewer and i changed proxies but i got the same error

Sensaicraft commented 3 years ago

Ahh you mean i should test what happens if i do it without proxies but to be honest i dont no what i need to delete from the code so it doesnt use proxies.

coeex commented 3 years ago

"--http-proxy {proxy}" this part. You should test if without to see if it works. If it works buy proxies or find some good free ones.

Sensaicraft commented 3 years ago

without proxies same error (i wasnt live but had a replay from old streams)

[cli][error] Unable to open URL: https://api.twitch.tv/api/channels/sensaicraft/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/sensaicraft/access_token.json?as3=t) error: No playable streams found on this URL: https://www.twitch.tv/sensaicraft

Sam6734 commented 3 years ago

update or reinstall your streamlink, I recommend using a virtual environment in pycharm and installing streamlink with pip3 install streamlink, then try running 'streamlink yoururl worst', and make sure it works, then try the script

Sensaicraft commented 3 years ago

Now I can run the script but it has a problem with vlc:

error: Failed to start player: /usr/bin/vlc (Process exited prematurely)