Click here to Skip to main content
15,887,430 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello, (I hope you understand what I want, because my english is not perfect. the more I thank you for your help.)

I need some help. I am currently looking for a script for the website Twitch. There is something similar, but not exactly what I am looking for. Function: Page query (interval 15 sec.) e.g. as XHR update or or or. This is supposed to search for my desired text (word).... If found, it should reload the page once and notify me via push before and stop.... Why? I often have multiple channels running in multiple windows and tabs in the background and for a very long time, which sometimes gives me an error code "This video is not available. (Error #5000)". Therefore I would like to query 2 words, "LIVE" and "5000" and if one is found, that it then reloads the page and then stops. In addition, the script should be able to run in the background and also in multiple windows.

**Example. I go to a channel on the Twitch page. This channel is offline. I activate the script and enter the word LIVE and 5000. Now the script asks every 15 sec in the background if the text was found. (Manual time input would be also super of course). As soon as the person goes online the word LIVE appears, accordingly the script would then have to reload the page and notify me via push beforehand and then stop. In addition, the script should be able to run in the background and also in multiple windows.

I hope someone can help me with this **

Thanks a lot

What I have tried:

I'm with Tampermonkey unfortunately only come so far, however, that does not really work and the functions are also missing halfway.... Who therefore has better solutions, I would be very grateful. And no, it does not have to run over Tampermonkey, according to your wishes :P
Thank you.

JavaScript
(function() {     
    'use strict';     
    $(document).ready(function() 
{     
    var LookFor = "LIVE"; // Change this to find a different string 
    if($('body:contains("' + LookFor + '")').length > 0)     
{         
    alert("Found: " + LookFor);     
}     
    else     
{         
    location.reload();     
} 
}); 
})();
Posted
Updated 20-Nov-22 9:17am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900