Posting comments on xVideos

mixing

Regular Member
Joined
Jan 18, 2014
Messages
412
Reaction score
63
Hey everyone, hopefully someone here can give me a little hand with a roadblock I just can't seem to get past. I'm writing a small xVideos bot that will comment on videos. I can get the videos just fine and I can get to the comment box, I can even press the button to post the comment. However, no matter what I try I cannot paste any text into the textarea for it!

Here is a snippet of the code from their website
Code:
<input type="hidden" value="998862d37d6b8b42d2wqbhpqbmwyuegS3CDvB0qzMogbiMoyuRDMZZnXKJ6_EcHXeYg_lM7LJ3ihCF7K6r_vD49veT1IV6tVk4uaUILf8ha_4cNit_0DpGvYEbo=" name="post[csrf_token]" id="post_csrf_token">
<div class="form-group form-field-post_text">
<div class="content col-sm-12 col-sm-offset-0" style="position: relative;">
<textarea class="form-control validator-error" placeholder="Write your message" name="post[text]" required="required" id="post_text" style="display: none;"></textarea>
<div id="post_text_emoji">
<div class="emojionearea form-control validator-error" role="application">
<div class="emojionearea-editor" placeholder="Write your message" tabindex="0" spellcheck="true" autocorrect="on" autocomplete="on" contenteditable="true"></div>

and here are things I've already tried that haven't worked..
Code:
wb.Document.All("textarea").InnerText = myString
and
wb.Document.All("post_text").InnerText = myString
and
wb.Document.GetElementById("post_text").InnerText = myString
and
wb.Document.GetElementByID("post_text").InnerHtml = myString
and
Dim theElementCollection As Windows.Forms.HtmlElementCollection
theElementCollection = wb.Document.GetElementsByTagName("textarea")
For Each curElement As HtmlElement In theElementCollection
If curElement.GetAttribute("classname") = "form-control validator-error" Then
curElement.Focus()
curElement.SetAttribute("value", myString)
End If
Next

any help would be greatly appreciated. Maybe someone on this board has made on before and can tell me what I'm doing wrong... Thanks!
 
I'm just guessing, haven't made a bot for xVideos but did for other sites:

What if there is a hidden captcha? Do you provide a fake user agent so that the bot looks more legit?
 
textarea don't work with value, you have to add text to innertext
curElement.InnerText = mystring
 
Thanks for the replies everyone! @legion85 - I double checked and there is no hidden captcha. It actually presses the Send button just fine (I can tell because it highlights the comment box in red since it's empty), but still can't get anything into the box.

@net307 thanks for the idea, that was a great tip and I've tried doing curElement.InnerText = mystring as well, but same thing. Here is the code I was trying:
Code:
                                             Dim theElementCollection As Windows.Forms.HtmlElementCollection
                                             theElementCollection = wb.Document.GetElementsByTagName("textarea")
                                             For Each curElement As HtmlElement In theElementCollection
                                                 If curElement.GetAttribute("classname") = "form-control validator-error" Then
                                                     curElement.InnerText = myString
                                                 End If
                                             Next

Thanks again for the suggestions everyone. Never had such a hard time placing a string into a darn text box...
 
Just an update..I finally managed to place my text in the box. However, now I've hit a new roadblock.. It presses the send button after putting the text in, but still thinks the box is blank for some reason. I've tried to use "Focus" but this has not worked. Is there a SendKeys or something I can use to simulate a mouse click inside the textarea before submitting? Here is what I'm trying..

Code:
                                             For Each element As HtmlElement In wb.Document.GetElementsByTagName("div")
                                                 If element.GetAttribute("classname") = "form-control validator-error" Then
                                                     element.Focus()
                                                     element.InnerText = myString
                                                 End If
                                             Next
 
sorry, my last post had incorrect code. I've also tried using InvokeMember
Code:
For Each element As HtmlElement In wb.Document.GetElementsByTagName("div")
If element.GetAttribute("classname") = "emojionearea-editor" Then
element.Focus()
element.InnerText = myString
element.InvokeMember("click")
End If
Next

I'm thinking part of the problem could be the textarea says it's required (if you look in the original snippet)..however, whenever I try to fill the textarea nothing happens. I had to use the div (as above) to get the text put into the comments box..
 
I think you can start reverse engineering post request.

First check what all variables are passed in post request. Either use dev tool or any extension for that.

After that you can work on your solution.
 
IMO it's easier to use HttpWebRequest and sniff/modify the HTTP packet. Send them in succession after you've gathered data for each step. I started with those types of programs you're working with now and sometimes it's necessary to use them but usually it's not.

Edit: What MisterXYZ said.
 
Back
Top