[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Frontpage - "collect" headlines from newspapers

Hi!
I just wonder how to collect headlines (updated headlines) (5 latest headlines) from some of the newspapers in the country. I use Frontpage 98. Do i have to add a script, make a database??
0
jblandro
Asked:
jblandro
  • 9
  • 6
1 Solution
 
mgfranzCommented:
Check out this link, http://www.mgfic.com/getfile.pl

I use a small Perl script that grabs headlines from Isyndicate.com  If all you want to do is insert lines of code for headlines check out www.iSyndicate.com
0
 
jblandroAuthor Commented:
I've checked it out. It looks good, but i can't get headlines from my own country - norway. Can anyone help me with that....
0
 
mgfranzCommented:
Does Norway have headlines?  ;-)  (just kidding...)

Check with the AP wire for your Country, or a national newspaper for headlines.  If they post news, I can swipe it.  CNN, BBC, ITN and The Norway Post all post headlines, what do you want to display?

Here are some links;

http://www.dagbladet.no/
http://www.dagogtid.no/

And this one looks like a good one to get links from;

http://www.p4.no/

Let me know if you need help.

Mark
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jblandroAuthor Commented:
Well, yes - we got a few headlines in Norway (every 5 weeks or so... :) ), and yes i need help. How do i "collect" them (you use the word swipe - is that the same. Here are some other ursl i want to collect from:

http://www.vg.no
http://www.nettavisen.no
http://www.ntb.no

Thanks for helping...
Jan-Borge
0
 
mgfranzCommented:
Can you run Perl scripts?  I am putting together something for you now, give me an hour or so and I will post a URL.

Mark
0
 
mgfranzCommented:
Can you run Perl scripts?  I am putting together something for you now, give me an hour or so and I will post a URL.

Mark
0
 
mgfranzCommented:
Can you run Perl scripts?  I am putting together something for you now, give me an hour or so and I will post a URL.

Mark
0
 
mgfranzCommented:
Wow... 3 posts from a single submit...

Anyway, check out this URL, http://www.mgfic.com/getNorUrl.pl

Let me know if it's what you want.
0
 
jblandroAuthor Commented:
Yes.... almost :)
But... I want just the headlines.. Not the text nor the pictures. Something like you se at the bottom of the page you got the headlines from (http://www.vg.no).

For exampel: I want to make a table with 4-5 columns, and add headlines from 4-5 of the norwegian newspapers. (i think we got so many newspapers in this country :) )

PS! I hope you dont ruin your sosial -or family life over this..

Thanks for responding so far..

Jan-Borge
0
 
jblandroAuthor Commented:
Hi again.

I just took contact with one of the newspapers. Here is what i "want":
http://www.nettavisen.no/include/nyheter/siste25.txt

Heres the 25 latest headlines from this site. But i order to make use of this page - I have to have a script that collects it every now and then.

But i want also headlines from other papers ... arrrrg.. I think this is a little difficult...., but i still smile

Jan-Borge
0
 
mgfranzCommented:
Check it again... ;-)

http://www.mgfic.com/getNorUrl.pl

We can do this for any site, a group of sites, I even save the data to a .txt file for later purging, http://www.mgfic.com/temp2.txt  This file can be <!--include file="temp2.txt"--> included, the script can be ran in a batch mode every 4 hours if you want...

Boy I love Perl!....
0
 
jblandroAuthor Commented:
YES!
This is what i was looking for. But.. :) when i click on the hyperlinks in getNorUrl.pl i dont get the page, but i guess thats a minor issue.

How can i now implement this perl script, and how can i learn more about perl??

Jan-Borge
0
 
mgfranzCommented:
Yeah thats a minor issue, just need to insert the path to the page in the script.

Here is the script;

# GetNorUrl.pl

# Used to parse an entire file from a specified server and file name.  It will
# then save the parsed file to a location called temp2.txt

use CGI qw(:cgi-lib);
CGI::ReadParse;
use Win32::Internet;

print "Content-type: text/html\n\n";

# Fetch the URL from designated source
$INET = new Win32::Internet();
$htmlfile = $INET->FetchURL("http://www.vg.no/");

$htmlfile =~ s/<!-- START ANNONSER TOPP.*De siste 20 nyhetene\"><BR>//s;
$htmlfile =~ s/<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">.*<TABLE CELLPADDING="6" BORDER="0"><TR>//s;
$htmlfile =~ s/<BR CLEAR=\"all\">.*<\/HTML>/<\/body><\/HTML>/s;
@file = $htmlfile;
foreach $td (@file) {
      $td =~ s/<TD ALIGN="left" VALIGN="top" WIDTH="25%">//g;
      $htmlfile = $td;
}

# Open the temp filehandle for writing and save the resulting string

open (TEMP, ">temp2.txt") || die "Can't open $!";
#while (<IN>) {
   print TEMP $htmlfile;  
#  }
close TEMP;

print <<EOF
$htmlfile
EOF
;

As for learning more about Perl, check with http://www.activestate.com or http://www.cpan.org or http://www.perl.org  Ther eare hundreds of site devoted to Perl, and a couple of great books I use are Learning Perl for Win32 and Programming Perl, both from http://www.ora.com  A great online book store to purchase these books is at http://www.bookpool.com  Fantastic prices on all tech books.

Enjoy,

Mark
0
 
jblandroAuthor Commented:
Thank you very much.
Jan-Borge
0
 
mgfranzCommented:
Yeah thats a minor issue, just need to insert the path to the page in the script.

Here is the script;

# GetNorUrl.pl

# Used to parse an entire file from a specified server and file name.  It will
# then save the parsed file to a location called temp2.txt

use CGI qw(:cgi-lib);
CGI::ReadParse;
use Win32::Internet;

print "Content-type: text/html\n\n";

# Fetch the URL from designated source
$INET = new Win32::Internet();
$htmlfile = $INET->FetchURL("http://www.vg.no/");

$htmlfile =~ s/<!-- START ANNONSER TOPP.*De siste 20 nyhetene\"><BR>//s;
$htmlfile =~ s/<TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">.*<TABLE CELLPADDING="6" BORDER="0"><TR>//s;
$htmlfile =~ s/<BR CLEAR=\"all\">.*<\/HTML>/<\/body><\/HTML>/s;
@file = $htmlfile;
foreach $td (@file) {
      $td =~ s/<TD ALIGN="left" VALIGN="top" WIDTH="25%">//g;
      $htmlfile = $td;
}

# Open the temp filehandle for writing and save the resulting string

open (TEMP, ">temp2.txt") || die "Can't open $!";
#while (<IN>) {
   print TEMP $htmlfile;  
#  }
close TEMP;

print <<EOF
$htmlfile
EOF
;

As for learning more about Perl, check with http://www.activestate.com or http://www.cpan.org or http://www.perl.org  Ther eare hundreds of site devoted to Perl, and a couple of great books I use are Learning Perl for Win32 and Programming Perl, both from http://www.ora.com  A great online book store to purchase these books is at http://www.bookpool.com  Fantastic prices on all tech books.

Enjoy,

Mark
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now