Skip to content
Tech News

Gizmodo eBay Strangeness Score Generator

By

Reading time 1 minute

Well, ask and you shall receive. Kind reader K sent us his homebrew GSS generator written in PHP. It’s a fascinating piece of code using high-level algorithms and math to prove that the post length and number of uppercase characters can be used to measure the total insanity of any eBay post. Case in point:

Auction 1 – PLEASE HELP!WHAT’S GROWING ON MY HEAD!! MYSTERY AUCTION GSS Score: 66,731

Auction 2 – EXTRA LARGE HOBO BIG GREEN PURSE BAG RING NEW GSS Score: 1,273

As we see, even if the poster tends to use capital letters, the GSS generator is not fooled.

The GSS Generator is available after the jump for further study. I suspect it might be slightly insecure and therefore would like a few pairs of eyes to ensure that we can indeed host this valuable tool on a server someday, thereby allowing millions of men and women to separate the eBay wheat from the eBay insane people.

Related

eBay Deal of the Day: Vampire Killing Kit

http://www.gizmodo.com/gadgets/gadgets/index.php#ebay-deal-of-the-day-vampire-killing-kit-114284

RUN AT YOUR OWN RISK – I’m not going to go through these to make sure they don’t “rm -rf” your boot dir.

GSS Generator Beta

Enter URL

“;

$end_string = ““;

//Find Begin and end auction crap

$beg_pos = strpos($buffer,$begin_string);

$end_pos = strpos($buffer,$end_string,$beg_pos);

//grab just stuff between begin and end auction comments

$desc_text = substr($buffer,($beg_pos + strlen($begin_string)),($end_pos – $beg_pos));

//Strip out the tags then strip out space

$strip_text = strip_tags($desc_text);

$strip_text = str_replace(” “,””,$strip_text);

//Strip out line breaks and returns (proabbly don’t need to do this)

$strip_text = preg_replace(“/(rn|n|r)/”, “”, $strip_text);

//find lenght of stripped text

$len_strip_text = strlen($strip_text);

//Counter vars

$num_lower = 0;

$num_upper = 0;

$num_other = 0;

//loop through stripped text count upper, lower and other chars

for($x = 0; $x < $len_strip_text; $x++) { $test_char = substr($strip_text,$x,1); $ascii_num = ord($test_char); if( ($ascii_num >= 97) && ($ascii_num <= 122) ){ $num_lower++; } else { if( ($ascii_num >= 65) && ($ascii_num <= 90) ) { $num_upper++; } else { $num_other++; } } } //Calculate Gizmodo Strangeness Score $gss = ($len_strip_text - $num_other) * ($num_upper / $num_lower); echo "URL = $url_to_calc“;

?>

Summary Data:
Total Chars
 
Number uppercase
 
Number lowercase
 
Number other chars
 
Gizmodo

Strangeness Score*

 


*(Number Chars – Number Other Chars) x (Number Upper / Number Lower)

Stripped Text (blank space removed):
“;

echo $strip_text;

} else {

echo “ERROR fetching file”;

}

}

?>

Here is an interesting command-line version in Perl by Thomas:

#!/usr/bin/perl

use LWP::Simple;

{

if (@ARGV[0] eq “”)

{

print “Usage: weirdness.pl n”;

exit;

}

$url = @ARGV[0];

$buffer = get “$url”;

$buffer =~ s/<(?:[^>‘”]*|([‘”]).*?1)*>//gs;

$length = length($buffer);

@uppers = ($buffer =~ /([A-Z])/g);

@lowers = ($buffer =~ /([a-z])/g);

$num_upper = @uppers;

$num_lower = @lowers;

print “Non-html chars: $lengthn”;

print “upper chars: $num_uppern”;

print “lower chars: $num_lowernn”;

#$score = $num_upper/$num_lower;
$ratio = $num_upper/$num_lower;

$score = $ratio * $length;

printf(“upper-to-lower ratio: %.2fn”, $ratio);

printf(“Weirdness score: %.2fn”, $score);

Explore more on these topics

Share this story

Sign up for our newsletters

Subscribe and interact with our community, get up to date with our customised Newsletters and much more.