Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

My word it is nuts out in GD/GDP

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:54 PM
Original message
My word it is nuts out in GD/GDP
good thing sanity rules in here.
Printer Friendly | Permalink |  | Top
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:54 PM
Response to Original message
1. You know the world is fucked up when
The DU Lounge is where you go to see some sanity. :o
Printer Friendly | Permalink |  | Top
 
bigwillq Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:56 PM
Response to Reply #1
3. When the lounge is the sanest place...
we're all in trouble! :P :)
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:57 PM
Response to Reply #1
4. Yeah, second time in a couple wks I can't go out there.
Ignore thread just don't work, need ignore word or something.
Printer Friendly | Permalink |  | Top
 
LynzM Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 11:02 PM
Response to Reply #4
17. Somebody wrote a script to do that....
But I can't remember who, off the top of my head...
Printer Friendly | Permalink |  | Top
 
Ellen Forradalom Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 11:05 PM
Response to Reply #17
18. That was me
A command-line Perl script. Feed it a string, a forum, your username and password, and it automagically hides threads.
Printer Friendly | Permalink |  | Top
 
Ellen Forradalom Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 11:08 PM
Response to Reply #18
19. The source code
for you Perl hackers out there.

#!/usr/bin/perl -w

#
# The DU Hidebot
# Name: du_hidebot.pl
# Author: Ellen Forradalom
# Purpose: Mass hide threads in a forum based on a word or phrase
#
# Usage:
# % du_hidebot.pl --forum= --hide= \
# --username= --password= <--pages=n>
# forum: one of LBN, Editorials, GD, GDP, Lounge
# hide: hide all threads with this word or phrase
# username, password: for logging in
# pages: only look n pages deep.\
#
# Note: Enclose all phrases or usernames with spaces in quotes:
# --username="My Username" or --hide="Dick Cheney"\n';
#
# Example:
# % du_hidebot.pl --forum=gd --hide=Schiavo --username="Ellen Forradalom" --password="In Your Dreams, Nosey Parker"
# This hid 160+ threads during Schiavopalooza.



use strict;
use WWW::Mechanize;
use Getopt::Long;
use CGI qw(:standard);

my $baseurl = "http://www.democraticunderground.com/discuss";
my $boardurl = "$baseurl/duboard.php?";

# Forum abbreviations

my %abbrevs = (
"Latest Breaking News" => "lbn",
"Editorials and Other Articles" => "ed",
"General Discussion" => "gd",
"General Discussion: Politics" => "gdp",
"The DU Lounge" => "lounge",
);


my %forums = ();


my $mech = WWW::Mechanize->new( autocheck => 1 );

my $forum = undef;
my $hide = undef;
my $pages = undef;
my $username = undef;
my $password = undef;


GetOptions(
"forum=s" => \$forum,
"hide=s" => \$hide,
"pages=s" => \$pages,
"username=s" => \$username,
"password=s" => \$password,

) or exit 1;

usage() unless ($forum && $hide && $username && $password);
$pages ||= 20;

# Log in to DU
$mech->get($boardurl . "az=login");
$mech->submit_form(
form_name => "thisform",
fields => { username => $username, password => $password },
);
die unless ($mech->success);


# Go to DU Forums lobby
$mech->get( $boardurl . "az=show_forums" );

# Get the current forum names and numbers

my @links = $mech->find_all_links(
tag => "a",
url_regex => qr/az=show_topics&forum=\d+/i
);

foreach my $l (@links) {
my $url = $l->url();
my $text = $l->text();

my $q = new CGI($url);

next if $text eq "";

if ($abbrevs{$text}) {
$forums{$abbrevs{$text}} = $q->param("forum");
}
}

my @hide_forums = split /,/, $forum;
my @hidden;

# Now get the forum listings and start hiding.
foreach my $h (@hide_forums) {
foreach my $page (1..$pages) {

my $url = $boardurl . "az=show_topics&forum=$forums{$h}=$page";
warn "$h: page $page\n";


$mech->get($url);

my @threadlinks = $mech->find_all_links(
tag => "a",
text_regex => qr/$hide/i
);

foreach my $tl (@threadlinks) {
my $url = $tl->url_abs();
my $text = $tl->text();

my $qs = (split /\?/, $url)<1>;
my $q = new CGI($qs);
my $az = $q->param('az');

my ($forum, $thread);
if ($az eq "show_mesg") {
$forum = $q->param("forum");
$thread = $q->param("topic_id");
} elsif ($az eq "view_all") {
($forum, $thread) = $q->param("address") =~ /^(\d+)x(\d+)$/;
} else {
warn "$az: don't know what this is;"
}

my $hl = $mech->find_link(
url_regex => qr/az=hide_thread&forum=$forum&thread=$thread/i
);

my $hideurl = $baseurl . "/" . $hl->url();
$mech->get( $baseurl . "/" . $hl->url() );

if ( $mech->content() =~ /You have hidden the thread/) {
push @hidden, "$h: ". $tl->text();
}
$mech->back();
}
}
}

print "Hid ", scalar @hidden, " threads:\n";
map { print "$_\n"; } @hidden;



sub usage {

print "Usage:\n";
print "$0 --forum= --hide= --username= --password= <--pages=n>\nwhere\n";

print "--forum: one of LBN, Editorials (ED), GD, GDP or the Lounge\n";
print "--hide: hide all threads containing this word or phrase\n";
print "--username, --password: for logging in\n";
print "--pages=n: only look n pages deep, starting from top. Optional; default is 20 pages deep\n\n";
print 'Enclose all phrases or usernames with spaces in quotes: --username="My Username" or --hide="Dick Cheney"\n';

exit 1;


}

Printer Friendly | Permalink |  | Top
 
LynzM Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 11:20 PM
Response to Reply #18
20. We need a little bowing-down smiley....
Because damn, that rocks that you wrote that. :bounce:
Printer Friendly | Permalink |  | Top
 
Ellen Forradalom Donating Member (1000+ posts) Send PM | Profile | Ignore Sun May-14-06 01:00 AM
Response to Reply #20
22. It sure came in handy
during Schiavopalooza and Popemania.
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:55 PM
Response to Original message
2. Purple Tuesday ixjdardtmivt. n/t
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:58 PM
Response to Reply #2
5. asldyebfil?
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 09:59 PM
Response to Reply #5
6. dreblorjginy!
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:01 PM
Response to Reply #6
7. har har har! xiptlinepeo
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:03 PM
Response to Reply #7
8. pfjlizniak! afloued bk bk bq
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:04 PM
Response to Reply #8
9. !
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:06 PM
Response to Reply #9
10. n!xslva msh :/
Printer Friendly | Permalink |  | Top
 
Random_Australian Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:07 PM
Response to Reply #10
11. neither of you two have partners, I'm guessing.
ok that was a little mean. ;)
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:09 PM
Response to Reply #11
12. Geez... you try to do your part to dispel the incipient sanity, and you
get insulted.

phfffffft!
Printer Friendly | Permalink |  | Top
 
Random_Australian Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:11 PM
Response to Reply #12
13. It's an old Micallef skit. He's interviewing the world champion scrabble
player. Wanna hear it?
Printer Friendly | Permalink |  | Top
 
qnr Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:12 PM
Response to Reply #13
14. No way. I'm supposed to be programming. But my output was more
coherent in this thread for a while there...
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:31 PM
Response to Reply #11
15. You guessed wrong.
aosldhrnrnrrmrmr
Printer Friendly | Permalink |  | Top
 
ContraBass Black Donating Member (1000+ posts) Send PM | Profile | Ignore Sat May-13-06 10:33 PM
Response to Original message
16. It's going to get a lot worse before it gets better.
Hide the children.
Printer Friendly | Permalink |  | Top
 
uppityperson Donating Member (1000+ posts) Send PM | Profile | Ignore Sun May-14-06 12:11 AM
Response to Reply #16
21. I just popped in there and got called all sorts of things
shameful, rude, neocon republican, but never was told I was uppity. Oh well. Good night.
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Tue Apr 30th 2024, 06:43 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC