Well, there are a couple ways. The first is that sandracires link you posted. If you view their javascript and then break it apart (or just watch the traffic in fiddler), it accesses a comments.php page on its site and passes in page numbers. The URL format is: http://www.sandracires.com/en/client/youtube/comments.php?v=videoID&page=1.
However, I'm not sure of the legality of that, so I don't recommend it.
I used Fiddler on Youtube itself and here's what I came up with.
http://youtube.com/watch_ajax?action_get_comments=1&v=videoID&p=4&commentthreshold=-5&commenttype=everything&last_comment_id=teKFzQ8cbHNiI0ouIIqSS7lHeH2TZ8eWGlW-0D0Fx5U&page_size=500&source=w
- v = videoID
- p = page number
- commentthreshold = ???
- commenttype = comment type (everything is the only enum value I know of)
- last_comment_id = comment right before the ones to load
- page_size = amount of comments to return
- source = ??? (maybe w for web)
You might be able to remove the source parameter and others.
I'm not entirely sure if these are all correct. I think p is page number, which would allow you to pull comments without the last_comment_id
parameter (it's working for me like this). I did also get the last_comment_id
parameter working (where p stays constant) by parsing the resulting XML and finding ?lc=LASTCOMMENTIDHERE
.
There seems to be a max of 500 at once. Yes, I've tried 501. As I've noted, the data comes back in XML form. Each comment looks like this:
<div class="content clearfix">
<p class="metadata">
<span class="author ">
<a href="/user/mindmonkey00" class="g-hovercard yt-uix-sessionlink yt-user-name " data-sessionlink="ei=-LFcUvCPNsn-sAf7jIGgAg" dir="ltr" data-ytid="UCAufDxGRQh_LlF5tD6StNtw" data-name="">mindmonkey00</a>
</span>
<span class="time" dir="ltr">
<a dir="ltr" href="http://www.youtube.com/comment?lc=teKFzQ8cbHNkP8a89kiIEtWqiTRiAkKtSnvEHB_hXG4">
3 weeks ago
</a>
</span>
</p>
<div class="comment-text" dir="ltr">
<p>You didn't answer my question?</p>
</div>
<div class="comment-actions">
<button onclick=";return false;" type="button" class="start comment-action create-channel-lightbox yt-uix-button yt-uix-button-link yt-uix-button-size-default" data-upsell="comment" role="button"><span class="yt-uix-button-content">Reply </span></button>
<span class="separator">·</span>
<span ><button title="Vote Up" onclick=";return false;" type="button" class="start comment-action-vote-up comment-action yt-uix-button yt-uix-button-link yt-uix-button-size-default yt-uix-button-has-icon yt-uix-tooltip yt-uix-button-empty" data-tooltip-show-delay="300" data-action="vote-up" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-watch-comment-vote-up" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" alt="Vote Up" title=""></span></button></span><span ><button title="Vote Down" onclick=";return false;" type="button" class="end comment-action-vote-down comment-action yt-uix-button yt-uix-button-link yt-uix-button-size-default yt-uix-button-has-icon yt-uix-tooltip yt-uix-button-empty" data-tooltip-show-delay="300" data-action="vote-down" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-watch-comment-vote-down" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" alt="Vote Down" title=""></span></button></span>
</div>
</div>
Keep in mind that by trying to circumvent Youtube's API rules, you will probably have to redo this process every once in a while. They will probably change up the URL.