1.1.0 • Published 10 months ago

@sl-code-lords/esana-news v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Status GitHub Issues GitHub Pull Requests License


📝 Table of Contents

🧐 About

The unofficial Scrap Esana

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

yarn add @sl-code-lords/esana-news

or

npm i @sl-code-lords/esana-news

🎈 Usage

const Esana = require('@sl-code-lords/esana-news')

var api = new Esana()

get news

await api.news('98691')
{
  news_url: 'https://www.helakuru.lk/esana/98967',
  news_id: 98967,
  TITLE: 'ශ්‍රී ලංකා රුපියල ආසියාවේ දුර්වලතම මුදල් ඒකකය බවට පත් වී ඇති බව Bloomberg වාර්තා කරයි',
  DESCRIPTION: ' ',
  COVER: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/dollar-rupee.jpg',
  URL: 'https://www.helakuru.lk/esana/98967',
  PUBLISHED: '2023-07-25 19:16:49',
  sub_img: [],
  full_news: 'මේ වසරේ මුල් භාගය තුළ ආසියාවේ හොඳම ක්‍රියාකාරීම මුදල් ඒකකය බවට පත්වූ ශ්‍රී ලංකා රුපියල, මේ වන විට ආසියාවේ දුර්වලතම මුදල් ඒකකය බවට පවත්ව ඇති බව Bloomberg වෙබ් අඩවිය වාර්තා කර තිබෙනවා.\n' +
    '\n' +
    'ඒ අනුව එම වෙබ් අඩවිය පෙන්වා දෙන්නේ අඛණ්ඩව දින 14 ක කාලයක් තුළ රුපියල 6% කින් අවප්‍රමාණයවී ඇති බවයි.\n' +
    '\n' +
    'පොලී අනුපාත කප්පාදුව සහ ආනයන පාලනයන් ලිහිල් කිරීම හේතුවෙන් තවදුරටත් රුපියල අවප්‍රමාණය විය හැකි බවත් වසර අවසානය වන විට ඩොලරය රුපියල් 355 ක් දක්වා ඉහළ යනු ඇති බවත් එම වෙබ් අඩවිය වැඩිදුරටත් සඳහන් කර තිබෙනවා.'
}

get latest news id

await api.latest_id()
{
  code: 200,
  code_creator: { name: 'Ravindu_Manoj', github: '@ravindu01manoj' },
  results: {
    latest_news_url: 'https://www.helakuru.lk/esana/98691',
    news_id: 98691
  }
}

get news Comments

await api.comments('98691')
{
  code: 200,
  code_creator: { name: 'Ravindu_Manoj', github: '@ravindu01manoj' },
  results: [
    {
      comment_id: '5070483',
      name: 'Tharani De Silva',
      comment: 'අපේ කකුල් කඩලා රෝද පුටුවක් දුන්නා කියලා උඹලට ආයේ රැවටෙන්නේ නෑ',
      ago: '30m Ago',
      img: 'https://esana.helakuru.lk/p/g/59255a58332310011e17a4ba9b16ec53.png'
    },
    {
      comment_id: '5070482',
      name: 'Indhunil Gamage',
      comment: 'නිකමිි දුන්නත් × වානා',
      ago: '35m Ago',
      img: 'https://esana.helakuru.lk/p/g/5e2bef68694fd3592fd3dc0eda4be484.png'
    },
    {
      comment_id: '5070481',
      name: 'Ravee Kumara',
      comment: 'hodai',
      ago: '46m Ago',
      img: 'https://esana.helakuru.lk/p/g/53dcda3cecd5495051accd2ddd89249c.png'
    },
    {
      comment_id: '5070479',
      name: 'Gaminda Tennakoon',
      comment: 'සතුටින් හිටප්ස්ල්ලා,EPF එකට කෙලවෙනකං...',
      ago: '56m Ago',
      img: 'https://esana.helakuru.lk/p/g/ceb401a4f5217e836b886c92e19e100b.png'
    },
    ... 283 more items
  ]
}

get news list

await api.list()
{
  code: 200,
  code_creator: { name: 'Ravindu_Manoj', github: '@ravindu01manoj' },
  results: [
    {
      id: '98691',
      title: 'ලිට්‍රෝ ගෑස් මිල හෙට සිට අඩු වෙයි‍',
      thumb: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/litro-gas[1].jpg'
    },
    {
      id: '98690',
      title: 'පෞද්ගලික විශ්ව විද්‍යාලවල අධ්‍යාපනය හැදැරීමට පොලී රහිත ණය සඳහා අයදුම් කිරීම හෙට ආරම්භ වෙයි',
      thumb: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/exam-re.jpg'
    },
    {
      id: '98689',
      title: 'මේ වසරේ ඩෙංගු වැළඳීමෙන් පුද්ගලයින් 31 ක් මරුට',
      thumb: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/dengue[1].jpg'
    },
    {
      id: '98687',
      title: 'අධි ඇසළ පොහොය අදයි',
      thumb: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/poya[1].jpg'
    },
    {
      id: '98688',
      title: 'දේශීය ණය ප්‍රතිව්‍යුහගතකරණයට පසුබිම සකස් කිරීම සඳහා දේශීය ආදායම් බදු පනත සංශෝධනය කරන්න වෙනවා - මුදල් රාජ්‍ය අමාත්‍ය',
      thumb: 'https://helakuru.sgp1.cdn.digitaloceanspaces.com/esana/images/lib/ranjith-siyabalapitiya-new[1].jpg'
    },
    ... 33 more items
  ]
}

Loop For New News

var callback = async (full_news) => {
  console.log(full_news)
}
var ms = 60*1000 // 60 seconds
await api.news_loop(callback,ms)

Clear Loop

await api.clear_loop()

✍️ Authors

See also the list of contributors who participated in this project.

1.1.0

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago