Made a tool to search through Twitch chats

He provided access to this tool free of charge, offered a workaround and said he’ll work on a general fix when he has time. You can use Q’s tool or another alternative in the meantime

6 Likes

After quite a bit of investigation, I’ve concluded that the best way to get around this is just to ask you (the user) for a valid device id and client. Before reading further, be sure that you know how to add environment variables to your system.

Relevant Guides:
Windows: https://www.howtogeek.com/787217/how-to-edit-environment-variables-on-windows-10-or-11/
Linux, MacOS, other Posix shells, etc: Use environment variables in Terminal on Mac – Apple Support (UK)
Make sure you have read these thoroughly before continuing

The environment variables we will be creating are:
CHAT_READER_CLIENT_INTEGRITY and CHAT_READER_DEVICE_ID
These will store the integrity token and device id, respectively. If for some incredibly strange reason these are already taken- rename your existing variables to something else or let me know so I can change them.

First, we’ll actually need to get the integrity token and device id. There are some things to note, though. Your client integrity token is IP specific- I cannot generate one for you and you will need to redo this process every time you would like to use the twitch functionality of chat_reader on a different IP address (note: your IP address may also change from time to time on its own, depending on your ISP).

How to get the integrity and device id?

  • In your preferred (somewhat modern) browser, launch a new private/incognito/guest window. Make sure that your are NOT already signed into twitch when you do this. The integrity token will not work with chat_reader if you do this when signed in.
  • Before you visit any page (you should still be in the blank tab)
  • Open your devtools (F12 or right click+inspect)
  • Click on the network tab (if your browser doesn’t have one, use one that does. I’m using brave, for reference).
  • Now go to https://twitch.tv/
  • You should see the log in the network tab begin to accumulate with requests. If you don’t- you might’ve opened your devtools in a different tab.
  • Near the top of the devtools page, you should see a small search bar, which will allow you to filter your requests.
  • In that bar, type in integrity
  • Next, click on the bottommost log of integrity
  • Scroll through the request headers until you find X-Device-Id
  • Right click on the X-Device-Id field and copy the value to your keyboard
  • Set this value to your CHAT_READER_DEVICE_ID environment variable
  • Next, in the Preview tab (this may be called Response in other browsers), copy the token from the JSON response
  • Set this value to your CHAT_READER_CLIENT_INTEGRITY variable

Once this is completed (and your environment variables have been set), chat_reader will begin to work for Twitch.

Ensure you are using these new binaries of chat_reader: https://tctbff.duckdns.org/programs/chat_reader/

5 Likes

Can confirm this works, when you set the environment variable as a system variable instead of a user variable. You’re a very smart person

1 Like

My goal is to do this entirely in the code so no environment variable is needed, but it looks like a cat and mouse game with twitch (theyve had the integrity endpoint for quite a while, but it only recently started spreading to things like the channel or clip graphql commands). The integrity check has also changed a lot and previous solutions started breaking, so it’s really hard to find any documentation on it from other people developing on twitch’s graphql

oh this is so difficult for those who use the translator to understand here, I managed to understand even the part of Set this value to your CHAT_READER_DEVICE_ID environment variable , I couldn’t conclude that

You just need to set 2 environment variables with the names “CHAT_READER_CLIENT_INTEGRITY” (value - integrity token) and “CHAT_READER_DEVICE_ID” (value - X-Device-Id).

You can find the values with the inspect function from your browser.

Maybe switching the browser to English until you set it up would help.

1 Like

I could’ve phrased it better, so PM me questions you may have

thread ‘main’ panicked at ‘called Result::unwrap() on an Err value: NotPresent’, src\twitch.rs:16:51
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

a new error

1 Like

i’ve found that I need to repeat this process something like once a day. idk if my ISP is just changing my IP address daily or if Twitch is purposely making it difficult to do this

2 Likes

That error occurs because the program cannot see either the CHAT_READER_CLIENT_INTEGRITY or CHAT_READER_DEVICE_ID environment variable.

Also, you PM’d me earlier today and I didn’t get back because I believe you’re using a windows computer. I don’t have a windows computer on me at the moment, but I’ll get back when I do a screen recording of the entire process to getting the program working on this thread.

Thank you! This worked well for me.

1 Like

Why can‘t i download it on Mac?

Here’re a good alternative. The rechat tool works again. I couldn’t get this tool to work on the first go around. Releases · jdpurcell/RechatTool (github.com)

3 Likes

I would appreciate if someone could search some streamers for me

Here’s some instructions I made a while back.

For the rechat tool, download the program on this page. Releases · jdpurcell/RechatTool (github.com)

Once it’s in your downloads folder, press “shift” and right click on an EMPTY SPACE in your download folder, then click on “open command menu here.” (update. On windows 10 or 11, type “cmd” in the address bar and press enter)

Once the command menu is open you want to paste .\RechatTool -D then put the 9 digit number at the end of a twitch video’s URL behind that copy and paste.

It should look like this .\RechatTool -D 524699648

Twitch (twitch video URL)

Open that file and you can search for key words by pressing F3 (or fn+F3, or ctrl F). Here’s an example.

2 Likes

you can also just use powershell if you can’t use cmd for some reason, you can select that from the shift + rightclick dropdown and it works the same, type the command.

1 Like

Is usage for kick.com still a possibility in the near future?

Probably not, to my knowledge kick doesn’t save timestamps of vods after stream, so there isn’t much to implement

I literally done it exactly the same and couldnt get it to work lol found an alternative tho

1 Like

What alternative?

1 Like