Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Challenge: Search Engine 'suggest' streams

Name: Anonymous 2007-09-27 9:56 ID:4+VA+Lq/

Google and Yahoo both offer 'suggest' features on their search engines. Basically, you type something and it will try to intelligently guess the rest of your search term and it will provide you will other relevant terms.

The streams are pretty similar in the fact that they both deliver their results in JavaScript Object Notation format: Specifically, JSON arrays.

The number of array values and their relevance to the key words varies a lot between the streams:

http://suggestqueries.google.com/complete/search?output=firefox&qu=4chan
http://ff.search.yahoo.com/gossip?output=fxjson&command=4chan

Yahoo yields the most potential keywords, yet Google's are (seemingly) more relevant

They core of the challenge is this: produce something (be it a toy or something genuinely useful) that makes use of either or both of these streams.

This challenge is 'open': Any language, platform or operating system is acceptable. Also there will be no judge, only the denizens of /prog/, eager to rip your source code apart.

I would wish you good luck, but EXPERT PROGRAMMERS do not need it.

Name: Anonymous 2007-09-27 10:24 ID:L/pr3+tj

Lol Wut 2.0

Name: Anonymous 2007-09-27 10:27 ID:Heaven

>>2
AY-SNYCHRONE-US JARVASCRIPTZ AND EX EM EL

Name: Anonymous 2007-09-27 14:20 ID:Fr25mvEs

>>1
Here's my suggest search system in Python:


import random
def SuggestSearch(s):
    '''SuggestSearch(query) -> suggested_query'''
    return random.choice([
        'porn', 'pr0n', 'incest', 'sister fuck',
        'japanese schoolgirls', 'lesbians',
        'anal sex', 'footjob',
    ])

Name: Anonymous 2007-09-27 14:21 ID:Fr25mvEs

>>4
Oh and like Google's, my system doesn't return the most keywords but they're more relevant.

Name: Anonymous 2007-09-27 14:36 ID:bd1a/ttm

Here's my shot. It takes a keyword, queries Google or Yahoo, picks another keyword at random from what it just got, does another query, and so on. Q&D, but It Works For Me.

It needs simplejson in addition to the standard lib, as I didn't feel like writing my own parser:
http://www.undefined.org/python/

-h will show you all the fancy options, or you can just read the source.

If the indentation is fucked up, I shall be very upset with 4chan. (WHITESPACE SENSITIVITY FTW/L!)

#!/usr/bin/env python
# jsondegrees.py
# Who cares who wrote it?
# Copyright? Wut?

import simplejson
import sys, random, urllib

def pickKeyword(url):
    """Accepts: a URL to a JSON-encoded list of keyword suggestions.
Returns: a random keyword from the list, or False if there are no suggestions."""
    f = urllib.urlopen(url)
    keywords = simplejson.load(f)
    if keywords[1]:
        return random.choice(keywords[1])
    else:
        return False

def google(keyword):
    """Accepts: a search keyword.
Returns: a random related keyword, according to Google, or False if there are no suggestions."""
    url = 'http://suggestqueries.google.com/complete/search?output=firefox&qu=' + \
            urllib.quote(keyword)
    return pickKeyword(url)

def yahoo(keyword):
    """Accepts: a search keyword.
Returns: a random related keyword, according to Yahoo, or False if there are no suggestions."""
    url = 'http://ff.search.yahoo.com/gossip?output=fxjson&command=' + \
            urllib.quote(keyword)
    return pickKeyword(url)

if __name__ == '__main__':
    from optparse import OptionParser
    parser = OptionParser(usage="%prog [options] keyword",
            version="%prog v0.1a1")
    parser.set_defaults(engine=google, steps=3)

    parser.add_option("-n", "--number",
            type="int",
            dest="steps",
            help="number of steps along the keyword trail")

    parser.add_option("-g", "--google",
            action="store_const",
            dest="engine",
            const=google,
            help="use Google's keyword recommendation engine")

    parser.add_option("-y",
            "--yahoo",
            action="store_const",
            dest="engine",
            const=yahoo,
            help="use Yahoo's keyword recommendation engine")

    options, args = parser.parse_args()
    keyword = args[0]

    for i in range(0, options.steps + 1):
        if keyword:
            print "%i: %s" % (i, keyword)
            keyword = options.engine(keyword)
        else:
            print "End of the line!"
            sys.exit(0)

Name: Anonymous 2007-09-27 15:09 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:09 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:10 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:10 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:10 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:10 ID:kkeycjI3

fagchan

Name: Anonymous 2007-09-27 15:12 ID:debV3EXm

child

Did you mean: child porn?

now that's awesome!

Name: Anonymous 2007-09-27 15:15 ID:EmAs/qr9


#!/usr/bin/perl                                                                                                      
#this is an unelegant peace of shit, enjoy.                                                                          
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
my $uri = "http://suggestqueries.google.com/complete/search?output=firefox&qu=";
my $word = <STDIN>;
$mech->get( "$uri $word");
$content = $mech->content;
$content =~ s/\[//g;$content =~ s/\]//g;
@array = split(/\",\"/, $content);

foreach $result (@array) {
    print $result;
    print "\n";
}
exit;

Name: Anonymous 2007-09-27 17:23 ID:1jyyRW/U

A simple sentence generator.

4chan rapidshare downloader for xm radio 1.4 literary devices with mathematical modeling agency faqs in circuit city search the webster dictionary define reference letter sample resignation letters and sounds of the underground london eye twitching

#!/usr/bin/perl

use LWP::Simple;
$url = "http://suggestqueries.google.com/complete/search?output=firefox&qu=";
$word = $ARGV[0];
for (1..25) {
    $content = get($url . $word);
    @matches = $content =~ /"([^"]+\s)(\w+)"/g;
    last if not @matches;
    $x = int(rand(@matches / 2));
    $line .= $matches[2 * $x];
    $word = $matches[2 * $x + 1];
}
print $line . "\n";

Name: Anonymous 2007-09-27 18:15 ID:4+VA+Lq/

>>15
sounds of the underground london eye twitching

Now that is cool.

Name: Anonymous 2007-09-27 18:26 ID:rHv2I9Hu

>>15
Delicious perl example, it is made of ?%"/?"% and regex

Name: Anonymous 2007-09-27 19:38 ID:Heaven

4chan fortune telling time zones

lol

Name: Anonymous 2007-09-29 17:01 ID:qw8Dr0BM

bump

Name: Anonymous 2007-09-29 17:47 ID:JXMMG7sw

4chan archives of general psychiatry degree programs of study tips on getting pregnant dogs

Oh, shit! They've got pregnant dogs.

Name: Anonymous 2007-09-29 18:30 ID:SWqy+j0/

4chan fortune 500 internal server error 404 error loading operating system requirements traceability matrix game stop smoking pipes drum sets of musical

Name: Anonymous 2009-03-06 10:19

The college bookstore to   read this semester   transferring to another   if you have   done me wrong   But wait you   just solved my   problem Thank you   for your advice   8 and sorry   to be this   poor soul is!

Name: Anonymous 2010-12-26 18:10

<

Name: Anonymous 2012-06-25 23:33

ၦᄐ杲䤧䁹剹ㅃ㍅荵ᆖ癨ᢇȱ遢ဧ攒蔈琀癀扙䤔≁⑴袐႓憆坱玖㕃斕䘷᠘换莑覇ᘰ茲祄∴ㅣ搣偒⦕斓ᙤ㝉䕗ٶ茠化㙥敵ㄅ酨焖瑧灨圧㕙⤧⁡⡲ط␢䑶犇ᄩ覃ၙ㔈श耗ㅱ㤥憕ܑ莗⑉桲疉萲ᘓ搁饰ن皂桰咁✃䜣锅╴#礤㊖酇儡䜳❘莅ኂ㤕吶㘒镈琒䦓䡒⥂其䄵䄧㉕頢⊗〇偠ڈ᠃㍤顰䉆⤥ܓ餔垑䀈㍦▙㙕匈⠵͆瀩㕔蠇熒ؒ倩舶犖䝉昅㌢⥇榅唂ᕰ㉧焂瘔㦂ᒒ䘓袗㞃᥉犁A✁䐘瀖鐅₇ᚁ悆Ԑȷ▅投⠒襧斔㝹Α覉⤈㐙㝄醁碈⤉❒逥␣昉恑頴祅䡐㒆捡有荈ខ礀ࠑႇ蝅ጢ䢕ေ㈤硐䊘ސ偘镔扃傄㑠ք頤䍳䀦䠱ፇန錗霉靲␀ᥥ蝣ↆ噑啂鉗傅ᐨ畗Ȁ蠆ታ腗垒鎘䤅و❇ŧ⑔袇瘇儔蔂舕╣昲坴䠷䐰脑憒瘄䠤啇锇阆ㅥ指瑒斀鍀蠨塴䅷褂硩睃䕣怣Գ䌧蔠さ❐㡇وԘ偣Ţ❷V䉶蕄褂ぷ㉣褢ᕧ⌷䀖᠔ձ爱挷ᙹ阗ࡐ

Don't change these.
Name: Email:
Entire Thread Thread List