@hansaka02/news-fetcher
Version:
An advanced Node.js module to fetch the latest news from Google News RSS.
1 lines • 2.09 kB
JavaScript
function _0x4d69(_0x1862ae,_0x5c148b){const _0x3830d7=_0x3830();return _0x4d69=function(_0x4d69e4,_0x3ebaad){_0x4d69e4=_0x4d69e4-0x125;let _0x24662e=_0x3830d7[_0x4d69e4];return _0x24662e;},_0x4d69(_0x1862ae,_0x5c148b);}const _0x58c238=_0x4d69;(function(_0x59da36,_0x376a57){const _0x31fe02=_0x4d69,_0x1c89ac=_0x59da36();while(!![]){try{const _0x2dbba4=-parseInt(_0x31fe02(0x129))/0x1*(parseInt(_0x31fe02(0x127))/0x2)+parseInt(_0x31fe02(0x136))/0x3*(-parseInt(_0x31fe02(0x13b))/0x4)+-parseInt(_0x31fe02(0x125))/0x5*(parseInt(_0x31fe02(0x128))/0x6)+-parseInt(_0x31fe02(0x13a))/0x7*(-parseInt(_0x31fe02(0x137))/0x8)+parseInt(_0x31fe02(0x12a))/0x9*(-parseInt(_0x31fe02(0x12e))/0xa)+-parseInt(_0x31fe02(0x130))/0xb+parseInt(_0x31fe02(0x134))/0xc;if(_0x2dbba4===_0x376a57)break;else _0x1c89ac['push'](_0x1c89ac['shift']());}catch(_0x54145d){_0x1c89ac['push'](_0x1c89ac['shift']());}}}(_0x3830,0xee858));function _0x3830(){const _0x49e8ae=['item','text','8350748crZeur','144688oILFAi','6158105sVjATM','message','2kcDaXL','6fRPlHl','224642VxrPwD','27LTnyNz','all','channel','link','3481880tpvpOr','node-fetch','1667754iUIsVt','getNews','title','https://news.google.com/rss','33578172erkaeG','xml2js','30oGkgOK','8CfAVpK'];_0x3830=function(){return _0x49e8ae;};return _0x3830();}const fetch=require(_0x58c238(0x12f)),{parseStringPromise}=require(_0x58c238(0x135));exports[_0x58c238(0x131)]=async function getNews({category:category=_0x58c238(0x12b),query:query=''}={}){const _0x3967ea=_0x58c238;let _0x4656d9=_0x3967ea(0x133);if(query)_0x4656d9='https://news.google.com/rss/search?q='+encodeURIComponent(query);else category!=='all'&&(_0x4656d9=_0x4656d9+'/headlines/section/topic/'+category['toUpperCase']());try{const _0x42a829=await fetch(_0x4656d9),_0x12190e=await _0x42a829[_0x3967ea(0x139)](),_0x43efc3=await parseStringPromise(_0x12190e),_0x281910=_0x43efc3['rss'][_0x3967ea(0x12c)][0x0][_0x3967ea(0x138)]||[];return _0x281910['map'](_0x47f149=>({'title':_0x47f149[_0x3967ea(0x132)][0x0],'link':_0x47f149[_0x3967ea(0x12d)][0x0]}));}catch(_0x251a23){return{'error':_0x251a23[_0x3967ea(0x126)]};}};