Hack Forums
[.NET] Fill Youtube Comment Text Box Using WB1 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Fill Youtube Comment Text Box Using WB1 (/showthread.php?tid=5142314)



Fill Youtube Comment Text Box Using WB1 - TR.Gen - Jan 21, 2016

Guys please help me, i have this html code
PHP Code

<?php 
<div class="comment-simplebox-text" role="textbox" aria-multiline="true" contenteditable="true"> 

how do i fill that with text?

i've tried this code but its not working

PHP Code

<?php 
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("textbox")
            If 
element.GetAttribute("classname") = "comment-simplebox-text " Then
                element
.SetAttribute("value", "udin")
            
End If
        
Next 



* - Jackie Chun - Jan 21, 2016

https://developers.google.com/youtube/2.0/developers_guide_protocol_comments


* - TR.Gen - Jan 21, 2016

(Jan 21, 2016 07:24 PM)Jackie Chun Wrote:  https://developers.google.com/youtube/2.0/developers_guide_protocol_comments
i dont want to use api, but 2.0?


* - Hawk HF - Jan 21, 2016

I might be wrong, but I think the tag name is "div" not "textbox."
But even if I'm right, that seems way too easy for YouTube. I feel like they'd have something in place to prevent that.


* - +Haze - Jan 22, 2016

(Jan 21, 2016 07:58 PM)Hawk HF Wrote:  I might be wrong, but I think the tag name is "div" not "textbox."
But even if I'm right, that seems way too easy for YouTube. I feel like they'd have something in place to prevent that.

It is a div, and nah there really isn't much they can do to prevent you from manipulating client side HTML elements.


* - LordCoder - Jan 23, 2016

You first need to open the box, I use the following javascript code:
Code
var innerHTMLs=[],elements=document.getElementsByTagName('div'),classToMatch='box';for(var i=0;i<elements.length;++i){if((' '+elements[i].className+' ').indexOf(' '+classToMatch+' ')!=-1){elements[i].click()}}

After that push the text with this:
Code
var innerHTMLs=[],elements=document.getElementsByTagName('div'),classToMatch='yt-simplebox-text';for(var i=0;i<elements.length;++i){if((' '+elements[i].className+' ').indexOf(' '+classToMatch+' ')!=-1){elements[i].innerHTML=elements[i].innerHTML+'%input%'}}

Replace %input% with your comment text.

Then enable with this:
Code
var innerHTMLs=[],elements=document.getElementsByTagName('button'),classToMatch='yt-uix-button yt-uix-button-size-default yt-uix-button-primary yt-simplebox-button yt-sb-post';for(var i=0;i<elements.length;++i){if((' '+elements[i].className+' ').indexOf(' '+classToMatch+' ')!=-1){elements[i].removeAttribute("disabled")}}

And press it with:
Code
var innerHTMLs=[],elements=document.getElementsByTagName('button'),classToMatch='yt-uix-button-content';for(var i=0;i<elements.length;++i){if((' '+elements[i].className+' ').indexOf(' '+classToMatch+' ')!=-1){elements[i].click()}}

It is updated to the current version of YouTube, so it should work properly.

Cheers,


* - Aristocles - Jan 23, 2016

But, why don"t you use httpwebreequest ? with namevaluecollection. It's esier than scrapping the whole age