Code Monkey home page Code Monkey logo

viewerbot's People

Contributors

dependabot[bot] avatar filipponik avatar lordcreations avatar nem4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viewerbot's Issues

Issue on Starting it

So I managed to get Python 3.7 but after some examine and reading other issues or other info. I cannot find how to start the system up.
Like what file do I need to press, what do I need to edit. What I need installed?
(I also tried to open the threads_viewer folder but nothing opens so...)

Q

We

Unable to get URL

Any working fixes for the Wasnt able to get url error?
Have all the requirements, where does it say "RANDOM CHANNEL".

I have my url put in all the "url" inside the scrip, do I need to put it somewhere else.

Help!

Hi, I'm a beginner in python but I would like to set this bot for my channel I need views for reach the partner, any can help me setting up this from the beginning? Thanks a lot

Mixer

Can this also be used on mixer?

No module named 'livestreamer'

After I type in "~\viewerbot>python threads_viewer.py RANDOMCHANNEL 1000" but with my real details I get this error

Traceback (most recent call last):
File "threads_viewer.py", line 2, in
from livestreamer import Livestreamer
ModuleNotFoundError: No module named 'livestreamer'

Not working

Traceback (most recent call last):
File "main.py", line 98, in
channel_url = "https://www.twitch.tv/" + sys.argv[1]
IndexError: list index out of range

SyntaxError: invalid syntax

File "threads_viewer.py", line 85
print(f"Sent HEAD request with {current_proxy['http']} | {response.status_code} | {response.request} | {response}")
SyntaxError: invalid syntax

Wasnt able to get url

got this error every time

EXCEPTION IN (threads_viewer.py, LINE 114 "threaded = Thread(target=open_url, args=(all_proxies[random.randint(0, len(all_proxies))],))"): list index out of range

and this (a few thousand working proxy)

Wasnt able to get url

An idea to fix this ? :)

Erro when running the script

Hey!
I`m getting this error:

EXCEPTION IN (threads_viewer.py, LINE 114 "threaded = Thread(target=open_url, args=(all_proxies[random.randint(0, len(all_proxies))],))"): list index out of range
Whats the problem?

Thanks.

Stolen work from you!

Hi,

your repo here,

Has been stolen & re-uploaded by the GitHub user: https://github.com/5R33CH4

Here is their repo in which they've stolen your work, and attributed it to themselves: https://github.com/5R33CH4/Python-Twitch-Viewbot

They also have a GitHub org, where they likely also have some stolen work: https://github.com/tesseract-org.

Checkout their all their personal repos...

I'm sorry to bring you this bad news, this user has stolen >50 repos so you should consider reporting them to GitHub.

Galen

Wasnt able to get url

Set the entire bot correctly as remembered, since at the time I managed to make it work but this time it just constantly tells me "Wasnt able to get url" ..

Has anyone managed to make it work?
Twitch changed something that causes the bot not to work?

thanks

SyntaxError: Non-ASCII character

can someone help me with this

File "threads_viewer.py", line 84 SyntaxError: Non-ASCII character '\xc3' in file threads_viewer.py on line 84, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

DOESN'T WORK ANYMORE

As you noticed many people are posting issues with proxies or other stuff saying it's not working, this is because this code doesn't work since maybe years. Twitch changed too much for this system to work so don't buy premium proxies thinking that can solve it.

old?

not working more?

Errors

error #1:
Users-MacBook-Pro-2:viewerbot user$ python threads_viewer.py RANDOMCHANNEL 1000
File "threads_viewer.py", line 85
print(f"Sent HEAD request with {current_proxy['http']} | {response.status_code} | {response.request} | {response}")
^
SyntaxError: invalid syntax

error when commenting out: the print above
import requests
ImportError: No module named requests

ssl connection

Hi, how do i solve this?

`Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
Traceback (most recent call last):
File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.6/http/client.py", line 1264, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1310, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1259, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1038, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 976, in send
self.connect()
File "/usr/lib/python3.6/http/client.py", line 1425, in connect
server_hostname=server_hostname)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in init
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/fake_useragent/utils.py", line 67, in get
context=context,
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
`

Valid main code

"""
   Update from NjProVk
"""

import requests
from streamlink import Streamlink
import sys
import time
import random
from random import shuffle
from fake_useragent import UserAgent
import linecache

from threading import Thread

channel_urls = f"https://www.twitch.tv/{sys.argv[1]}"
proxies_file = "Proxies_txt/good_proxy.txt"
processes = []
max_nb_of_threads = int(sys.argv[2])

all_proxies = []
nb_of_proxies = 0

# Session creating for request
ua = UserAgent()
session = Streamlink()
session.set_option("http-headers", {'User-Agent': ua.random, "Client-ID": "ewvlchtxgqq88ru9gmfp1gmyt6h2b93"})

class ViewerBot:
    def print_exception(self):
        exc_type, exc_obj, tb = sys.exc_info()
        f = tb.tb_frame
        lineno = tb.tb_lineno
        filename = f.f_code.co_filename
        linecache.checkcache(filename)
        line = linecache.getline(filename, lineno, f.f_globals)
        print('EXCEPTION IN ({}, LINE {} "{}"): {}'.format(filename, lineno, line.strip(), exc_obj))



    def get_proxies(self):
        # Reading the list of proxies
        global nb_of_proxies
        try:
            lines = [line.rstrip("\n") for line in open(proxies_file)]
        except IOError as e:
            print("An error has occurred while trying to read the list of proxies: %s" % e.strerror)
            sys.exit(1)

        nb_of_proxies = len(lines)
        return lines


    def get_url(self):
        url = ""
        try:
            streams = session.streams(self.channel_url)
            try:
                url = streams['audio_only'].url
                print(f"URL : {url[:30]}...\n")
            except:
                url = streams['worst'].url
                print(f"URL : {url[:30]}...\n")

        except:
            pass
        return url

    def open_url(self,proxy_data):
        try:
            global all_proxies
            headers = {'User-Agent': ua.random}
            current_index = all_proxies.index(proxy_data)

            if proxy_data['url'] == "":
                proxy_data['url'] = self.get_url()
            current_url = proxy_data['url']
            try:
                if time.time() - proxy_data['time'] >= random.randint(1, 5):
                    current_proxy = {"http": f"https://{proxy_data['proxy']}", "https": f"http://{proxy_data['proxy']}"}
                    with requests.Session() as s:
                        response = s.head(current_url, proxies=current_proxy, headers=headers)
                    print(f"Sent HEAD request with {current_proxy['http']} | {response.status_code} | {response.request} | {response}")
                    proxy_data['time'] = time.time()
                    all_proxies[current_index] = proxy_data
            except:
                print("Connection Error!")

        except (KeyboardInterrupt, SystemExit):
            sys.exit()


    def mainmain(self):
        self.channel_url = channel_urls
        proxies = self.get_proxies()

        for p in proxies:
            all_proxies.append({'proxy': p, 'time': time.time(), 'url': ""})

        shuffle(all_proxies)
        list_of_all_proxies = all_proxies
        current_proxy_index = 0

        while True:
            try:
                for i in range(0, max_nb_of_threads):
                    threaded = Thread(target=self.open_url, args=(all_proxies[random.randint(0, len(all_proxies))],))
                    threaded.daemon = True  # This thread dies when main thread (only non-daemon thread) exits.
                    threaded.start()
            except:
                self.print_exception()
            shuffle(all_proxies)
            time.sleep(5)


ViewerBot = ViewerBot()
ViewerBot.mainmain()

image

livestreamer isn't starting

Hy.
I tried to get everything correct and installed all modules. script is sending Head requests to a active channel but livestreamer never get startet.

livestreamer is working when i execute livestreamer without script.
I also tried to use streamlink. (changed livestreamer arguments to streamlink),
but I never get any viewers or a livestreamer/streamlink session with the script.
I also read all instructions of the modules, but I cant find any relevant information about this.
Am I missing something?

how I execute:
/usr/bin/python3 /opt/bot/threads_viewer.py channelname 15

python2.7 gives me syntax error:

File "/opt/bot/threads_viewer.py", line 85 print(f"Sent HEAD request with {current_proxy['http']} | {response.status_code} | {response.request} | {response}") ^ SyntaxError: invalid syntax

Is it Working ?

I tryed but not working. Maybe i did mistake. Anyone did try ?

The specified path was not found.

Hello,
When I put "pip install -r requirements.txt" it's working
But when I want to write "~\viewerbot>python threads_viewer.py your_channel_name max_nb_of_threads" with the good name of the channel with the threads the cmd said "The specified path was not found."
Can you help me or It doesn't work anymore

Without Client-ID

Hello. How can I use this bot without client id?
Thanks for replying.

No File OR Directory

so iv tried editing it to go to a different file for the proxies and its just not working

How do I write the command line?

Can someone explain to me what do I have to type in the CMD?
I mean, ~\viewerbot>python threads_viewer.py RANDOMCHANNEL 1000 but how

like C:\WINDOWS\system32>threads_viewer.py UserXX AmountXX

or how? I don't get it.

Would it be possible to simulate Twitch viewing without using selenium for less performance cost.

I think this project is great but was wondering if its possible to switch it over to a better App-Twitch interface that cuts out unnecessary parts to save on performance. As you can expect it would be pretty costly to run 100 of these bots at once. Basically, can Twitch viewing be simulated using http/https requests to save on performance. I do have a feeling it can be done but is very hard with the measures Twitch puts in to counter these bots.

Permission denied

I always get this error, when i want to start the programm..

What Do I wrong?

SyntaxError: invalid syntax Debian 9.11 Stretch

I am running the below command and getting a syntax error. I was able to download all the requirements without issue. Can you assist?

python3 threads_viewer.py username 15

  File "threads_viewer.py", line 85
    print(f"Sent HEAD request with {current_proxy['http']} | {response.status_code} | {response.request} | {response}")
                                                                                                                     ^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.