Skip to content

List returned from streamlink.streams sometimes empty #2988

@theodoretliu

Description

@theodoretliu

Bug Report

  • This is a bug report and I have read the contribution guidelines.

Description

Hi, I'm using streamlinks to pull frames from Twitch streams, and it's been generally great. However, I've been running into intermittent issues with it. I have a simple Flask app set up similar to below

app = Flask(__name__)
session = Streamlink()

@app.route('/')
def index():
    user = request.args.get('user')
    streams = session.streams(f"https://twitch.tv/{user}")
    # streams is sometimes length 0 here ...

I'm positive that the stream that's being fetched is online. I recognize that streamlink will return 0 if the stream is offline, but that is definitely not the case.

Once I restart the web server, it usually goes back to normal and returns the correct number of streams.

Expected / Actual behavior

I expect streamlink to return a list of streams exactly when the stream is online and empty otherwise.

Reproduction steps / Explicit stream URLs to test

The code above is the best I can do. I've tried to recreate the behavior by running the session.streams function in an infinite loop while I manually have my own Twitch channel go online and offline, but it seems to work as expected. It's only in this long running web server that I see the issue. Some of the bread crumbs from Sentry say there are underlying 404s going on when requesting the HLS stream, but that's all I really know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions