instinctlol / automatic-twitch-recorder Goto Github PK
View Code? Open in Web Editor NEWChecks if a user on twitch is currently streaming and then records the stream via streamlink
Checks if a user on twitch is currently streaming and then records the stream via streamlink
Is there a way to incorporate chat recording as well. Then when playing it back, there could be a way to sync the two up.
There's something for chat here https://github.com/Ugrend/twitch_chat_recorder but no VOD recording with it.
Hello,
Not an issue but maybe an improvement, is there a way to adapt script to record dlive.tv stream ?
Seems dlive is supported by streamlink: https://streamlink.github.io/plugin_matrix.html#plugins
Thanks.
its happen on any stream if they rerun, python 3.7.2
Nvm
After the streamer finishes streaming this error executes. And he is stuck at "Live". Not sure if it can continue to wait and then start streaming again if the streamer decides to do so.
(Cmd) add officialandypyro best
Successfully added officialandypyro to watchlist.
(Cmd) time 10
Interval is now set to 10 seconds.
(Cmd) download_folder I:\Twitch-Recording-1
Download folder is now set to 'I:\Twitch-Recording-1' .
(Cmd) start
Daemon is started.
(Cmd) OfficialAndyPyro is live. Saving stream in best quality to I:\Twitch-Recording-1\2020-12-29 23.19.05 - OfficialAndyPyro - Good morning Tarkov.ts.
Finished watching officialandypyro
error:concurrent.futures:exception calling callback for <Future at 0x5fcb880 state=finished returned NoneType>
Traceback (most recent call last):
File "C:\Users\Moflows\AppData\Local\Programs\Python\Python38-32\lib\concurrent\futures_base.py", line 328, in _invoke_callbacks
callback(self)
File "C:\Users\Moflows\Desktop\Twitch-Record-2\daemon.py", line 136, in _watcher_callback
streamer = streamer_dict['user_info']['login']
TypeError: 'NoneType' object is not subscriptable
Daemon is already running.
(Cmd) list
Live: 'officialandypyro'
Offline:
(Cmd) exit
Daemon exited successfully
PS C:\Users\Moflows\Desktop\Twitch-Record-2> python main.py
(Cmd) start
Daemon is started.
(Cmd) add officialandypyro best
Successfully added officialandypyro to watchlist.
(Cmd) list
Live:
Offline: 'officialandypyro'
pip install -r requirements.txt
Requirement already satisfied: attrs==20.3.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 1)) (20.3.0)
Requirement already satisfied: certifi==2020.12.5 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 2)) (2020.12.5)
Requirement already satisfied: chardet==4.0.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 3)) (4.0.0)
Requirement already satisfied: idna==2.10 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 4)) (2.10)
Requirement already satisfied: importlib-metadata==3.3.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 5)) (3.3.0)
Requirement already satisfied: iso-639==0.4.5 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 6)) (0.4.5)
Requirement already satisfied: iso3166==1.0.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 7)) (1.0.1)
Requirement already satisfied: isodate==0.6.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 8)) (0.6.0)
Requirement already satisfied: jsonschema==3.2.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 9)) (3.2.0)
Requirement already satisfied: pathvalidate==2.3.1 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 10)) (2.3.1)
Requirement already satisfied: pycryptodome==3.9.9 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 11)) (3.9.9)
Requirement already satisfied: pyrsistent==0.17.3 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 12)) (0.17.3)
Requirement already satisfied: PySocks==1.7.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 13)) (1.7.1)
Requirement already satisfied: requests==2.25.1 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 14)) (2.25.1)
Requirement already satisfied: six==1.15.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 15)) (1.15.0)
Requirement already satisfied: streamlink==2.0.0 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 16)) (2.0.0)
Requirement already satisfied: typing-extensions==3.7.4.3 in c:\users\moflows\appdata\roaming\python\python38\site-packages (from -r requirements.txt (line 17)) (3.7.4.3)
Requirement already satisfied: urllib3==1.26.2 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 18)) (1.26.2)
Requirement already satisfied: websocket-client==0.57.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 19)) (0.57.0)
Requirement already satisfied: zipp==3.4.0 in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from -r requirements.txt (line 20)) (3.4.0)
Requirement already satisfied: setuptools in c:\users\moflows\appdata\local\programs\python\python38-32\lib\site-packages (from jsonschema==3.2.0->-r requirements.txt (line 9)) (50.3.2)
help, please bigo.tv version
I was wondering if it was possible for the main.py to accept command arguments like start so I could have a batch file which invokes it and starts looking for streams so I could schedule this to start on boot?
Getting a error after starting the deamon and it tries to save the Stream
(Failed to write data to file: [Errno 2] No such file or directory)
Title says it all, if the streamer's username is in a different language the script does not run. How to fix?
Would it be possible to have the script monitor a game's page and/or keywords in the title?
I'd like to record all streams of one game without having to manually startup multiple scripts for individual channels
While looking through the codebase the method used for webhooks looks a little complicated. Why not just use this library and the ngrok library? https://github.com/Teekeks/pyTwitchAPI
Integrating the cmd library is the first step to support the idea of recording multiple streams. With this library, one is able to launch multiple commands.
It should also work well with the getopts library.
At a later step, my idea is to launch 'check' commands via cmd, these will then be checked in certain time intervals by a checker singleton. If the singleton finds the stream to be recordable, it will launch a watcher, which will record the stream and notify the singleton on completion, so that it can be checked again.
Another good thing about having this checker singleton is that we will be able to easily implement a ui on top of that.
Hello
is there any way u can add youtube ?
thx for your time
Repeating an example from the documentation results in a 400 Error.
➜ automatic-twitch-recorder git:(master) ✗ python3 atr_cmd.py
(Cmd) add forsen
Traceback (most recent call last):
File "atr_cmd.py", line 96, in <module>
AtrCmd().cmdloop_with_keyboard_interrupt()
File "atr_cmd.py", line 90, in cmdloop_with_keyboard_interrupt
self.cmdloop()
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cmd.py", line 217, in onecmd
return func(arg)
File "atr_cmd.py", line 20, in do_add
self.daemon.add_streamer(line[0])
File "/Users/bryce/projects/automatic-twitch-recorder/daemon.py", line 38, in add_streamer
user_info = self.CLIENT.users.translate_usernames_to_ids(streamer)
File "/usr/local/lib/python3.7/site-packages/twitch/api/users.py", line 94, in translate_usernames_to_ids
response = self._request_get('users?login={}'.format(usernames))
File "/usr/local/lib/python3.7/site-packages/twitch/api/base.py", line 53, in _request_get
response.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.twitch.tv/kraken/users?login=forsen
Hi,
After recording a stream, when I play .ts file, there are a lot of ads in live like "commercial break in progress" during 15 to 30 seconds, several time in live stream.
Like this: https://ibb.co/nbK0DqN
Make streamer list persistent. Whenever I restart the script I have to reenter twitch streams and desired quality.
Would be great to be able to change where videos are downloaded.
currently code is deleted first interval time vods
so checking first download vods file time and first streaming file time.
and download before vods file first and merge live streaming file
Everytime a Streamer ends the stream I get an error:
error:concurrent.futures:exception calling callback for <Future at 0x7f506088931
0 state=finished returned NoneType>
Traceback (most recent call last):
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 329, in _invoke_ca
llbacks
callback(self)
File "/home/user/atw/automatic-twitch-recorder/daemon.py", line 136, in _watche
r_callback
streamer = streamer_dict['user_info']['login']
TypeError: 'NoneType' object is not subscriptable
I use python 3.2.9
Streamlink 2.0.0
After this error the streamer stays "online" in the list.
a docker would be great to use it on like unraid.
since many sreamers deactivated vod this would be great.
Wondering if a Docker implementation has crossed your mind.
It looks like an image exists, but it uses a modified older version of ATR and eventually has errors and no longer monitors. I fumbled around trying to create a working image with the new version, but I haven't been able to get it working (hard to do when you don't know Python!).
Need to handle ConnectionsErrors when requesting twitch api
Also try to think of handling / working around 'Failed to reload playlist: Unable to open URL: ...' streamlink issue
Can i just start the Record without type any thing? Like Script
That i can just record the same channel every time i start it
whenever a streamer raids another channel it also gets recorded. That should be an optional feature imo
The method you're calling to get a valid filename get_valid_filename
from utils under watcher.py does not remove back slashes and forward slashes from stream titles leading to an error in writing the file
file_name = curr_time + " - " + self.streamer + " - " + get_valid_filename(self.stream_title) + ".flv"
i record multiple streamers, is it possible to put the recordings in a folder with the streamers name?
cheers.
error log: https://0x0.st/iJcU.log
OS: Arch
Python -v: Python 3.8.3
Streamlink -v: streamlink 1.4.1+12.ga547b3e
Hey there,
got a problem with using this tool, tried to find with googling around for this issue, but somehow nothing works?
Tried it on a Raspi4 and Debian Buster Server now, ending both in this problem that they call the Authentication Error when i use it.
Using streamlink in standalone streamlink USERNAME best
works fine right away.
But using this tool it throws out this:
(Cmd) add thiseguy
Successfully added thiseguy to watchlist.
(Cmd) start
Daemon is started. Will check every 30 seconds.
(Cmd) exception calling callback for <Future at 0x7f302cd20240 state=finished raised PluginError>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/api/http_session.py", line 166, in request
res.raise_for_status()
File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: Gone for url: https://api.twitch.tv/api/channels/thiseguy/access_token.json?as3=t&platform=_
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 324, in _invoke_callbacks
callback(self)
File "/home/automatic-twitch-recorder/daemon.py", line 128, in _watcher_callback
streamer_dict = returned_watcher.result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/automatic-twitch-recorder/watcher.py", line 37, in watch
streams = streamlink.streams(self.streamer_dict['stream_info']['channel']['url'])
File "/usr/local/lib/python3.7/dist-packages/streamlink/api.py", line 13, in streams
return session.streams(url, **params)
File "/usr/local/lib/python3.7/dist-packages/streamlink/session.py", line 439, in streams
return plugin.streams(**params)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/plugin.py", line 317, in streams
ostreams = self._get_streams()
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 774, in _get_streams
return self._get_hls_streams("live")
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 714, in _get_hls_streams
sig, token = self._access_token(stream_type)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 678, in access_token
schema=access_token_schema)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 308, in access_token
return self.call("/api/{0}/{1}/access_token".format(endpoint, asset), **dict(platform="", **params))
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugins/twitch.py", line 271, in call
res = self.session.http.get(url, params=params, headers=headers)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/streamlink/plugin/api/http_session.py", line 175, in request
raise err
streamlink.exceptions.PluginError: Unable to open URL: https://api.twitch.tv/api/channels/thiseguy/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/thiseguy/access_token.json?as3=t&platform=)
Traceback (most recent call last): File "atr_cmd.py", line 3, in from daemon import Daemon File "/home/lunarstarpony/stream/recorder/daemon.py", line 1, in from watcher import Watcher File "/home/lunarstarpony/stream/recorder/watcher.py", line 4, in import streamlink ModuleNotFoundError: No module named 'streamlink'
Am i doing it wrong? I already install streamlink
Follow this ref: #streamlink/streamlink/issues/3501#issuecomment-1115293901
I think it's a simple way.
Having left the script on overnight, and the 2 stream recordings seem fine, however the cmd prompt is being filled with errors of not being able to get the last piece of a stream.
I had a similar script that recorded streams and did this but stopped after a few attempts, but it no longer works so i'm trying (and liking) yours. I guess i'll look for retry attempts in the scripts and lower it, I don't know coding though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.