Changeset 2054
- Timestamp:
- 12/04/08 01:55:48
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/assets/plugins/Filter-FindEnclosures/zshare.pl
r2024 r2054 1 1 sub handle { 2 2 my ($self, $url) = @_; 3 $url =~ qr!http://www.zshare.net/(download|audio)/[0-9a-f]+!;3 ($url =~ qr!http://www\.zshare\.net/(download|audio)/[0-9a-f]+!) || ($url =~ qr!^http://sharebee\.com/[0-9a-f]+!); 4 4 } 5 5 6 6 sub find { 7 7 my($self, $args) = @_; 8 8 my $response; 9 9 my $uri = $args->{url}; 10 11 if($uri =~ /sharebee/) { 12 $response = LWP::UserAgent->new->get($uri); 13 if($response->content =~ m!(http://www\.zshare\.net/download/[0-9a-f]+/)!) { 14 $uri = $1; 15 } 16 } 17 10 18 $uri =~ s/audio/download/; 11 my $response = LWP::UserAgent->new->get($uri); 12 if($response->content =~ m/link = '(http:\/\/.+\.zshare\.net\/download\/[^']+?)';/) { 13 my $enclosure_url = $1; 19 $response = LWP::UserAgent->new->post( 20 $uri, 21 ['download' => 1]); 22 if($response->content =~ m/('h','t','t','p'.+?')\);link/) { 23 my $enclosure_url = $1; 24 $enclosure_url =~ s/[',]//g; 14 25 my $enclosure = Plagger::Enclosure->new; 15 26 $enclosure->url($enclosure_url); trunk/plagger/t/plugins/Filter-FindEnclosures/zshare.t
r1985 r2054 5 5 test_requires_network 'www.zshare.net:80'; 6 6 7 plan tests => 2;7 plan tests => 3; 8 8 run_eval_expected; 9 9 … … 21 21 link: http://buycheapviagraonlinenow.com/1 22 22 body: | 23 Here's a link to zShare. <a href="http://www.zshare.net/download/ 4385403840872c/">test</a>23 Here's a link to zShare. <a href="http://www.zshare.net/download/52199786e5e37595/">test</a> 24 24 - title: Test 2 25 25 link: http://buycheapviagraonlinenow.com/2 26 26 body: | 27 Here's a link to zShare. <a href="http://www.zshare.net/audio/4385403840872c/">test</a> 27 Here's a link to zShare. <a href="http://www.zshare.net/audio/52199786e5e37595/">test</a> 28 - title: Test 3 29 link: http://buycheapviagraonlinenow.com/3 30 body: | 31 Here's a link to ShareBee. <a href="http://sharebee.com/786015ba">test</a> 28 32 29 33 - module: Filter::FindEnclosures 30 34 --- expected 31 like $context->update->feeds->[0]->entries->[0]->enclosure->url, qr!http://upsilon.zshare.net/download/[0-9a-f]+/[0-9]+/4385403/test.txt!; 32 like $context->update->feeds->[0]->entries->[1]->enclosure->url, qr!http://upsilon.zshare.net/download/[0-9a-f]+/[0-9]+/4385403/test.txt!; 35 like $context->update->feeds->[0]->entries->[0]->enclosure->url, qr!http://[\d\w]+\.zshare\.net/download/[0-9a-f]+/\d+/\d+/test.txt!; 36 like $context->update->feeds->[0]->entries->[1]->enclosure->url, qr!http://[\d\w]+\.zshare\.net/download/[0-9a-f]+/\d+/\d+/test.txt!; 37 like $context->update->feeds->[0]->entries->[2]->enclosure->url, qr!http://[\d\w]+\.zshare\.net/download/[0-9a-f]+/\d+/\d+/test.txt!;
