question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Twitch] TypeError when downloading multiple streams

See original GitHub issue

Plugin Issue

  • This is a plugin issue and I have read the contribution guidelines.

Description

I’ve got this small application (automatic-twitch-recorder) that checks whether a twitch streamer is online and records them (aka downloads the stream) if they are currently streaming. However, a TypeError is thrown in TwitchHLSStreamWorker whenever a streamer is currently being recorded and another streamer goes online that also is about to be recorded. Recording a single streamer at the same time seems to work fine.

Reproduction steps / Explicit stream URLs to test

  1. Download my app, install requirements, … you know the deal.
  2. Start atr_cmd.py and daemon.py (you will be asked for your client id and client secret)
  3. In atr_cmd.py, add any twitch streamer that is currently online and streaming by typing add <random online streamer #1>, then type start to start the checking & recording routine
  4. wait an indefinite amount of time so the download of the stream starts (a folder named <random online streamer #1> will be created next to the *.py scripts)
  5. In atr_cmd.py, add another twitch streamer that is currently streaming by typing add <random online streamer #2>
  6. Now observe the daemon.py log, see Log output (I added a print statement in process_sequences to log self)

Log output

info:root:POST request,
Path: /cmd/
Headers:
Host: 127.0.0.1:1234
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 34
Content-Type: application/json



Body:
{"cmd": "add", "args": ["forsen"]}

info:root:POST request,
Path: /cmd/
Headers:
Host: 127.0.0.1:1234
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 28
Content-Type: application/json



Body:
{"cmd": "start", "args": []}

forsen is live. Saving stream in best quality to E:\Downloads\automatic-twitch-recorder\forsen\2020-07-27 18.50.01 - forsen - @forsen, Games and shit!.ts.
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, initial daemon)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 11392)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 11392)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 11392)>
info:root:POST request,
Path: /cmd/
Headers:
Host: 127.0.0.1:1234
User-Agent: python-requests/2.24.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 32
Content-Type: application/json



Body:
{"cmd": "add", "args": ["nymn"]}

<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 11392)>
NymN is live. Saving stream in best quality to E:\Downloads\automatic-twitch-recorder\nymn\2020-07-27 18.50.32 - NymN - NYMN'S NEWS NETWORK   @nymnion on twitterinstayoutube.ts.
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, initial daemon)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 11392)>
Exception in thread Thread-TwitchHLSStreamWorker:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "E:\Downloads\automatic-twitch-recorder\virtualenv\lib\site-packages\streamlink\stream\segmented.py", line 59, in run
    for segment in self.iter_segments():
  File "E:\Downloads\automatic-twitch-recorder\virtualenv\lib\site-packages\streamlink\stream\hls.py", line 307, in iter_segments
    self.reload_playlist()
  File "E:\Downloads\automatic-twitch-recorder\virtualenv\lib\site-packages\streamlink\stream\hls.py", line 235, in reload_playlist
    self.process_sequences(playlist, sequences)
  File "E:\Downloads\automatic-twitch-recorder\virtualenv\lib\site-packages\streamlink\plugins\twitch.py", line 212, in process_sequences
    return super(TwitchHLSStreamWorker, self).process_sequences(playlist, sequences)
TypeError: super(type, obj): obj must be an instance or subtype of type

<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 17796)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 17796)>
<TwitchHLSStreamWorker(Thread-TwitchHLSStreamWorker, started daemon 17796)>

Process finished with exit code -1

Additional comments, screenshots, etc.

I tried this on Windows while using Python 3.6, Python 3.8. I also tried using the Session object with no luck, though I didn’t use any options. If you’re wondering where I’m using streamlink: see watch method in Watcher.py.

Any help is appreciated, thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
back-tocommented, Oct 31, 2020

@Instinctlol try the git version of streamlink

0reactions
Instinctlolcommented, Oct 31, 2020

Thanks, git version seems to work 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Twitch Network Error? How to Fix Network Related Issues
Trying to stream and all of a sudden "Twitch network error" occurred? Fix network related issues and enjoy stable streams!
Read more >
Video On Demand - Twitch Help
A VOD (Video on Demand) is an archive of content previously streamed live on Twitch. Utilizing VODs can help grow your channel and...
Read more >
Broadcast Guidelines - Twitch
This happens when there are network problems between you and Twitch, when you attempt to stream at a bitrate that is too high...
Read more >
Basic Troubleshooting Tips - Twitch Help
Delete Twitch items from your ProgramData and AppData folders only. Restart your computer and download Soundtrack or Twitch Studio, and install as Administrator ......
Read more >
Xbox Broadcasting and Troubleshooting - Twitch Help
Twitch Stream Key ... Try resetting your stream key once by going to your Dashboard and clicking the Channel tab under Preferences, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found