בשביל לראות את ההרצאות מדב-קונף תפעילו את הסריפט הבא.
עריכה - אני לא בטוח שכולם עדיין תומכים בגירסה 0.9 אז הנה עבור גירסה 2.0 :
, זה יהיה נחמד אם משהוא יוכל להריץ על איזה שרת
עריכה - אני לא בטוח שכולם עדיין תומכים בגירסה 0.9 אז הנה עבור גירסה 2.0 :
#!/usr/bin/perl
use LWP 5.64; # Loads all important LWP classes, and makes
use HTTP::Cookies; # Allow work with cookies
use WWW::Mechanize;
use XML::RSS;
use Encode qw(decode encode);
use Data::Dumper;
my $browser = LWP::UserAgent->new;
$browser->cookie_jar( HTTP::Cookies->new(
'file' => '/tmp/headers',
# where to read/write cookies
'autosave' => 1,
# save it to disk when done
));
$browser->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
my $url = "https://wiki.debconf.org/wiki/Videoteam/Subtitles/videos_debconf15";
my $response = $browser->get( $url );
#for each cookie we got, add it to the current jar
$browser->cookie_jar->extract_cookies( $response );
$response = $browser->get( $url );
my $rss = XML::RSS->new( version => '2.0' );
$rss->channel(
title => "video grabber for $url",
link => "$url",
description => "debconf video grabber ");
$rss->parsefile("$0.rss") if -f "$0.rss";
my $link = $response->content;
while ($link =~ /<a[ \t]*.*class="external text" href="(.*)">(.*)<\/a>/g)
{
my $waslinkfoundinarrayofitems=0;
#don't ask me why but mode insert with RSS 2.0 failed to identify duplicates on my machine
for my $item (@{$rss->{'items'}})
{
if ($item->{'link'} eq $1)
{
$waslinkfoundinarrayofitems=1;
}
}
if ($waslinkfoundinarrayofitems eq 0)
{
$rss->add_item( title => $2,description=> "Debconf video $2",link=>$1,language=>"en-us", enclosure => { url => $1, type=>"video/webm"}, mode => 'insert');
}
$link =~ s/<a[ \t]*.*class="external text" href="(.*)">(.*)<\/a>//;
}
$rss->save("$0.rss");
__END__
=head1 NAME
vg RSS - a script to get an RSS from debconf videos.
=head1 SYNOPSIS
Create an RSS 0.9 file based on the messages page.
=head1 DESCRIPTION
This script provide a basic example on how one could get the RSS from the rusty pages without the RSS interface,
=head1 BUGS
=head1 AUTHOR
Original code:Boris Shtrasman
=head1 COPYRIGHT
Copyright (c) 2015 Boris Shtrasman
=head1 LICENSE
this script is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
=head1 CREDITS
Rael Dornfest <rael@oreilly.com>
Jonathan Eisenzopf <eisen@pobox.com>
Wojciech Zwiefka <wojtekz@cnt.pl>
Chris Nandor <pudge@pobox.com>
=head1 SEE ALSO
perl(1), XML::Parser(3), LWP(3), XML::RSS(3),HTTP::Cookies(3)
=cut
#!/usr/bin/perl
use LWP 5.64; # Loads all important LWP classes, and makes
use HTTP::Cookies; # Allow work with cookies
use WWW::Mechanize;
use XML::RSS;
use Encode qw(decode encode);
my $browser = LWP::UserAgent->new;
$browser->cookie_jar( HTTP::Cookies->new(
'file' => '/tmp/headers',
# where to read/write cookies
'autosave' => 1,
# save it to disk when done
));
$browser->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
my $url = "https://wiki.debconf.org/wiki/Videoteam/Subtitles/videos_debconf15";
my $response = $browser->get( $url );
#for each cookie we got, add it to the current jar
$browser->cookie_jar->extract_cookies( $response );
$response = $browser->get( $url );
my $rss = XML::RSS->new( version => '0.9' );
$rss->channel(
title => "video grabber for $url",
link => "$url",
description => "vg");
$rss->parsefile("$0.rss") if -f "$0.rss";
my $link = $response->content;
while ($link =~ /<a[ \t]*.*class="external text" href="(.*)">(.*)<\/a>/g)
{
$rss->add_item( title => $2, link => $1, mode => 'insert');
$link =~ s/<a[ \t]*.*class="external text" href="(.*)">(.*)<\/a>//;
}
$rss->save("$0.rss");
__END__
=head1 NAME
vg RSS - a script to get an RSS from debconf videos.
=head1 SYNOPSIS
Create an RSS 0.9 file based on the messages page.
=head1 DESCRIPTION
This script provide a basic example on how one could get the RSS from the rusty pages without the RSS interface,
=head1 BUGS
=head1 AUTHOR
Original code:Boris Shtrasman
=head1 COPYRIGHT
Copyright (c) 2015 Boris Shtrasman
=head1 LICENSE
this script is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
=head1 CREDITS
Rael Dornfest <rael@oreilly.com>
Jonathan Eisenzopf <eisen@pobox.com>
Wojciech Zwiefka <wojtekz@cnt.pl>
Chris Nandor <pudge@pobox.com>
=head1 SEE ALSO
perl(1), XML::Parser(3), LWP(3), XML::RSS(3),HTTP::Cookies(3)
=cut
אין תגובות:
הוסף רשומת תגובה