1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Twitch.tv chat textarea

Discussion in 'Visual Basic .NET' started by matevos, Apr 2, 2014.

  1. matevos

    matevos Junior Member

    Joined:
    Feb 4, 2012
    Messages:
    133
    Likes Received:
    11
    Hello, I would like to type on twitch.tv chat through my vb .net application. I mean that I type text in program, and then I click send and the program is typing on twitch.tv chat and clicking chat. I know how to do this, but I have a problem, program can't find id of textarea object in twitch chat. Im using this code to type on chat:
    Code:
    WebBrowser1.Document.GetElementById("ember447").InnerText = "My text"
    
    But this don't work, so I tried to find the chat area by class name so I used this
    Code:
    For Each webpageelement As HtmlElement In allelemtens
                    If webpageelement.GetAttribute("className") = "ember-view ember-text-area" Then
                        webpageelement.InnerText = "My Text"                
                    End If
                Next
    
    This also won't work. Please help me.
     
  2. Dyslexic

    Dyslexic Newbie

    Joined:
    Sep 16, 2013
    Messages:
    2
    Likes Received:
    0
    You wont be able to do that because you need the OAUTH code generated for your account to be able to use other 3rd party programs other than the official twitch website to chat on any channel.


    Use Streambot2 for an example, username: password: oauth
     
  3. EpicSEO

    EpicSEO BANNED BANNED

    Joined:
    Aug 31, 2013
    Messages:
    35
    Likes Received:
    30
    Wow, that is not what op is asking.

    Try:
    Code:
    WebBrowser1.Document.GetElementById("ember447").SetAttribute("Value", textbox1.text)
    WebBrowser1.Document.GetElementById("chat").InvokeMember("click")
    
     
  4. EnzBots

    EnzBots Junior Member

    Joined:
    Aug 25, 2013
    Messages:
    145
    Likes Received:
    67
    I did a project with this a while back, if the site is not updated sense then this should work:

    Code:
    WebBrowser1.Document.GetElementById("chat_text_input").SetAttribute("Value", "" & text)
    This was with the pop up though, not while streaming the video.
     
  5. EpicSEO

    EpicSEO BANNED BANNED

    Joined:
    Aug 31, 2013
    Messages:
    35
    Likes Received:
    30
    You don't need the "" &, as you would be joining nothing to the text.
     
  6. matevos

    matevos Junior Member

    Joined:
    Feb 4, 2012
    Messages:
    133
    Likes Received:
    11
    When Im trying to load popup chat in my webbrowser control in my app it won't load. I just see a blank page, I the code won't work. When I try to load the whole stream with chat, chat is loading but when I click button to type something o chat I have an error: "Object reference not set to an instance of an object."

    I use this code:
    Code:
    WebBrowser1.Document.GetElementById("ember447").SetAttribute("Value", "hello")
    
    Its strange because I can click chat button on twitch chat via my program, but I can't type, it looks like webbrowser control can't load text chat area and it can't find the "ember447" object.
     
  7. TwitchTime

    TwitchTime Newbie

    Joined:
    Apr 3, 2014
    Messages:
    9
    Likes Received:
    0
    That error means that the element doesn't exist. You're trying to pull the element with ID ember447 and then perform an action on it but if ember447 doesn't exist then you will get an error.



    OP: You'd be better just writing a basic IRC bot. You can connect to, view and type in the chat of any stream channel with as many accounts as you'd like. It will be far easier to expand on and much more powerful than trying to load a web browser inside your form.
     
  8. matevos

    matevos Junior Member

    Joined:
    Feb 4, 2012
    Messages:
    133
    Likes Received:
    11
    Is there any other control than webbrowser, which I can use?
     
  9. FJX

    FJX Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 13, 2011
    Messages:
    356
    Likes Received:
    186
    Location:
    0x90
    Leave webbrowser and study HTTP request + sockets (for Twitch IRC).
     
  10. matevos

    matevos Junior Member

    Joined:
    Feb 4, 2012
    Messages:
    133
    Likes Received:
    11
    Ok did that typing in text area is working, but now I have problem with click on chat button, program is finding the chat button but he can't click it. There is no any error, just nothing happen, but when I click manually chat button the message which program typed, sends.
     
  11. TwitchTime

    TwitchTime Newbie

    Joined:
    Apr 3, 2014
    Messages:
    9
    Likes Received:
    0
    My guess is that the twitch page has some amount of protection to stop basic javascript style exploits. As we've mentioned before, you're better off using httprequest/sockets and write a basic IRC bot. Will let you handle chat MUCH better.