Skip to content

Instantly share code, notes, and snippets.

@jacyzon
Created December 25, 2013 11:33
Show Gist options
  • Save jacyzon/8122435 to your computer and use it in GitHub Desktop.
Save jacyzon/8122435 to your computer and use it in GitHub Desktop.
Find total stuck volume
#!/usr/bin/perl -w
use HTML::TreeBuilder::XPath;
use WWW::Mechanize;
print "Please enter stock symbol: ";
chomp ($num = <STDIN>);
my $xpath = q{/html/body/div/div/div/div/div/div/table[@id='table2']/tr[3]/td[1]};
my $url = "http://finance.yahoo.com/q?s=$num.TW";
my $html = WWW::Mechanize->new->get($url)->decoded_content();
my $tree= HTML::TreeBuilder::XPath->new()->parse_content($html);
my $res = $tree->findvalue($xpath);
print "Volume: $res\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment