Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plz help me to set timeout to None #143

Open
jarvis08 opened this issue Jan 3, 2024 · 1 comment
Open

Plz help me to set timeout to None #143

jarvis08 opened this issue Jan 3, 2024 · 1 comment

Comments

@jarvis08
Copy link

jarvis08 commented Jan 3, 2024

Hello. I'm trying to see how many clips are existing at target streamer's channel.
The twitch-dl uses get_channel_clips func in twitch.py to get the list, but the result says gql timeout.
(I guess the streamer has lots of clips..)

I gave timeout=None option to httpx post, but the same error occurs,
and there for I think I have to give the timeout option to the query string.
However, I do not know how the query string work, so I'm stuck at this moment.

plz help me.

@jarvis08
Copy link
Author

jarvis08 commented Jan 3, 2024

def get_channel_clips(channel_id, period, limit, after=None):
"""
List channel clips.

At the time of writing this:
* filtering by game name returns an error
* sorting by anything but VIEWS_DESC or TRENDING returns an error
* sorting by VIEWS_DESC and TRENDING returns the same results
* there is no totalCount
"""
query = """
{{
  user(login: "{channel_id}") {{
    clips(first: {limit}, after: "{after}", criteria: {{ period: {period}, sort: VIEWS_DESC }}) {{
      pageInfo {{
        hasNextPage
        hasPreviousPage
      }}
      edges {{
        cursor
        node {{
          {fields}
        }}
      }}
    }}
  }}
}}
"""

query = query.format(
    channel_id=channel_id,
    after=after if after else "",
    limit=limit,
    period=period.upper(),
    fields=CLIP_FIELDS
)

response = gql_query(query)
user = response["data"]["user"]
if not user:
    raise ConsoleError("Channel {} not found".format(channel_id))

return response["data"]["user"]["clips"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant