Skip to content
Tenshi Hinanawi edited this page Apr 30, 2012 · 1 revision

Table of Contents

YouFlood

This tool was created in order to have an actual, decent program which ups page views on a youtube video. It does this using perl, with curl doing the http grunt-work.

Bugs

  1. None that I know of

Youtube Dox

As of August 12, 2009, Youtube increases number of hits for a video by one everytime the flash object is loaded. The hard bit is finding a single token hash which identifies your computer (I think). A new one is assigned every time you reload the page. The problem with finding it is that the embedded object is created with javascript, and all the javascript on youtube is obfuscated to a ridiculous degree. Seriously, don't fucking look at the base-something-something.js file, it's a fucking wall of text. But that's neither here nor there, since the token (the variable $yummy in the script) is found on the actual page. Just view the source, then ctrl-f "swfArgs", it's in there as the value 't'. Anyway, with this token we can pretend we're the flash object, letting the server know that the page is getting visited.

Youtube (Google) has multiple servers all over in what's called a "cloud". If you do a dns lookup for www.youtube.com you'll get back something like five different servers. This was a problem in the original version of Youflood, since the two curl calls would often go to two different servers, when the needed to go to the same one. This is why the program currently uses host to find the ip and then chooses randomly. If anyone knows of a better way to do DNS lookup that could possibly go through tor (SOCKS), feel free to add it. It would be great if the modification didn't need to use any obscure perl modules as well.

Youtube appears to have some kind of video-page-view locking mechanism if it detects a flood from a single ip address. Youflood can use tor, which works about 3 time slower (depending on the node), but the ip gets changed every ten minutes or something like that, so it ought to circumvent this to some degree. Just use the -t option. Even without tor, there is a random wait in between each request, which will hopefully throw off the locking mechanism.

Source (Last updated August 12, 2009)

The script has a random wait in between each request, mostly to prevent flags getting raised at jewtube headquarters. Here is the source:

#!/usr/bin/perl

my $tor = '';
my @dns;

#Creates a list of ip addresses which can be used. Does it pretty sexily too, I think
#This is also the part which leaks like a motherfucker. It does not and can not go through tor
#This part also assumes that you have the host program.
foreach (`host www.youtube.com`) {
	push(@dns,$1) if /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/;
}

#Usage
if (!@ARGV) {
	print "\n USAGE: youflood [-t] <URL>\n\n<URL>: Full, clean url of the youtube video (including http://)\n\tShould look like this: http://www.youtube.com/watch?v=cofkDkdAiUy\n-t: Use tor (localhost:9050)\n\n";
	exit;
}

elsif (@ARGV == 2) {
	$tor = '--socks4a localhost:9050 ';
}

my $url = $ARGV[-1]; #Get URL from parameters
(my $video_id) = $url =~ /http:\/\/www\.youtube\.com\/watch\?v=(.+)$/; #Extract video's id


for (my $i = 1; ; $i++) { #Begin infinite loop

	print "===== $i\n";

	my $rand_dns = int(rand(@dns)); #We don't want to be using the same server each time, now do we?
	
	my $yummy = getYummy($rand_dns); #Get the yummy token variable.
	print "t='$yummy'\n";

	sendYummy($rand_dns);
	
	#Generate random integer for pause
	my $rand = int(rand(8));
	print "pausing $rand seconds\n";
	sleep($rand);
}

#This sub-procedure gets the hash-token-whateverthefuckitis
sub getYummy {
	print "Retrieving t (whatever that is)...";
	my $page = `curl $tor-A 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)' -H "Host: www.youtube.com" http://$dns[$_[0]]/watch?v=$video_id 2>/dev/null`; #Gets youtube page 
	$page =~ s/\n|\t//g; #Removes all newlines and tabs, I don't know that this is necessary. It doesn't hurt though

	(my $swfArgs) = $page =~ /var swfArgs = (.+?);/; #Extracts swfArgs from javascript on the page
	(my $yummy) = $swfArgs =~ /"t": "(.+?)"/; #Gets 't' value (the yummy variable) from the swfArgs

	#If something goes wrong, this will try again until it goes right
	if (!$yummy) {
		print "failed, got this instead:\n$page\nxxxxx getYummy:Trying again\n";
		$yummy = getYummy($_[0]);
	}

	return $yummy;
}

#This sub-procedure sends the actual request.
sub sendYummy {
	print "Sending video request...";
	my $response = `curl $tor-A 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)' -H "Host: www.youtube.com" http://$dns[$_[0]]/get_video?video_id=$video_id\\&t=$yummy\\&el=detailpage\\&ps=\\&fmt=34\\&noflv=1 2>/dev/null`; #The important part. This is what actually increases the page count.
	
	#Should receive a blank response. Otherwise, assume something went wrong
	if ($response) {
		print "failed, got this:\n$page\nxxxxx sendYummy:Trying again\n";
		$response = sendYummy($_[0]);
	}
	print "Request sent, ";
}

Comment

Make sure you have the curl and host package installed, for example on ubuntu you should type in console

 sudo apt-get install curl

These are both standard packages, so there shouldn't be any problems getting them in modern distros like Ubuntu or Fedora

Limitations

The newest version has support for tor, using the -t option. It assumes your tor is listening on localhost:9050, which is the default. Change it if necessary. The important point which needs to be made is that the tor function is not to keep you anonymous. It is simply there to trick the locking mechanism by continually changing the ip. The portion of the program using host does not go through tor, and I do not believe it can be made to go through tor. This shouldn't be a problem legally or in any other sense really (there is no law regarding upping youtube page views), but it is something to be noted. Category:Tools

Clone this wiki locally