There exists 1000s of news website on Internet. The problem is that many websites changes over time. The structure constantly changes and it is not always easy to write the parser to get the appropriate information. There are several concerns. How do you find which are the 'new' news? What do you do when the story spans several pages?. How do you find where are the links for the stories?. How do you know which are not the advertizes or logo and the actual image for the story?
You've just hit on the difference between a programming interface and an implementation of that interface. While the specific details of a site's design may change over time, there are certain characteristics inherent to the data that should always exist. A well-designed solution for scraping news articles would have some sort of API that defines common attributes of all articles, and a set of site-specific implementations of this API. If a single site changes its structure, then just change the implementation while keeping the API consistent.
For example, smalhotra discusses "title, publisher, date, author, byline, content, category, related articles, related links, imbedded images" as being general classes of information, that a news article could have.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.