4.0.1 • Published 2 years ago

@dil5han/news-srilanaka v4.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Sri Lanka News

This script is a Node.js module that scrapes the news website "https://www.example.lk" for the latest news articles and returns the information in JSON format. It uses the libraries axios, bodyParser, cheerio, cors, express, moment, openai, and request to make the necessary HTTP requests, parse the HTML response, and format the output.

The script first sends an HTTP request to the website and then selects the third article on the page. It extracts the article's title, summary, image link, content, and publication time, as well as generates a unique ID for the article. The article's content is further processed to remove unnecessary HTML tags and formatting before being returned. The resulting JSON object includes all the extracted information and can be used by other applications to display the latest news articles from News.

For Use
import checkForNewArticlesAndReturn from '@dil5han/news-srilanaka';

async function logArticleTitlesAndLinks() {
  try {
    const keycode = "";
    const articles = await checkForNewArticlesAndReturn(keycode);
    console.log(articles[0])
    articles.forEach(article => {
      console.log(`ID :`+article.ID);
      console.log(`Time :`+article.Time);
      console.log(`Title :`+article.title);
      console.log(`Link :` +article.link);
      console.log(`Link :` +article.imglink);
      console.log(`Content :`+article.content);

    });
  } catch (error) {
    console.error(error);
  }
}

logArticleTitlesAndLinks();
About Keycode

This script works only for those who have the keycode. If you want, try to crack it using a possible keycode cracker. But I would like to say that the module stops working for the requestIP from the 10th wrong keycode you enter. Try it.

If you want to get the keycode

You have to contact me by email.

b.ravindudilshan@gmail.com
4.0.1

2 years ago

4.0.0

2 years ago

1.1.0

2 years ago