From 90aa11d039fb04296e8142a37e61dd19226d21c8 Mon Sep 17 00:00:00 2001 From: Sasmeee Date: Thu, 27 Jul 2023 15:38:40 +0530 Subject: [PATCH] Publish Ip-Locator --- README.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ index.js | 1 + package.json | 33 +++++++++++++++++++++ test.js | 14 +++++++++ 4 files changed, 131 insertions(+) create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json create mode 100644 test.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e43b87 --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# **IP Locator** - NPM Pacakge for get IP data + +IP-Locator is a versatile package that allows you to easily retrieve valuable information based on IP Addresses. With IP-Locator, you can effortlessly access user location details, country-specific data, and even obtain real-time weather updates, all in a single package. This project is based on Javascript. + +_Coded by: [Sasmitha Ashinsana](https://github.com/sasmeee)_ + +## Installation + +``` +npm i @sasmeee/ip-locator +``` + +## Usage + +```js +const getGeoData = require("@sasmeee/ip-locator"); +``` + +## Note + +> **Note:** You should use a valid IP address for doing that. + + +## Methods + +### getGeoData(ip) + +Code: + +```js +const ip = "112.134.193.130"; // Enter your IP here + +const data = await getGeoData(ip); +console.log(data); +``` + +Output: + +```json +{ + "ip": "112.134.193.130", + "city": "Panadura", + "region": "Kalutara District (13)", + "country": "Sri Lanka", + "postal_code": "12500", + "continent": "Asia (AS)", + "coordinates": { + "lat": "6.7154", + "long": "79.9019" + }, + "time": "2023-07-27 13:23:47 (Asia/Colombo)", + "country_data": { + "common_name": "Sri Lanka", + "cca2": "LK", + "official": "Democratic Socialist Republic of Sri Lanka", + "subregion": "Southern Asia", + "languages": "Sinhala, Tamil", + "currencies": "{\"LKR\":{\"name\":\"Sri Lankan rupee\",\"symbol\":\"Rs රු\"}}", + "timezones": "UTC+05:30", + "area": 65610, + "population": 21919000, + "independent": true, + "capital": "Sri Jayawardenepura Kotte", + "flags": { + "svg": "https://flagcdn.com/lk.svg", + "png": "https://flagcdn.com/w320/lk.png" + } + }, + "weather": { + "temperature": "+30°C", + "skyCondition": "cloudy", + "weatherCondition": "↗19km/h" + } +} +``` + +## License + +This project is protected by the `MIT License.` + +## Disclaimer + +If you have any complain about this package, please contact via sl.travamaker@gmail.com diff --git a/index.js b/index.js new file mode 100644 index 0000000..d0edc6d --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +(function(_0xc96952,_0x57474b){function _0x59a4d9(_0x11b161,_0x322343,_0x2019ca,_0xc2adb){return _0x3917(_0xc2adb-0x4b,_0x322343);}const _0x6f5a2e=_0xc96952();function _0x5218b6(_0x1e714,_0x4efac9,_0x51497c,_0x2b6f80){return _0x3917(_0x1e714- -0x2c4,_0x2b6f80);}while(!![]){try{const _0xe15018=parseInt(_0x59a4d9(0x2a9,0x29a,0x28f,0x275))/(-0x2337+-0xf66+0x155*0x26)*(parseInt(_0x5218b6(-0x8d,-0xa3,-0xbf,-0xa3))/(-0x10c4+-0x2*0xe77+-0x2*-0x16da))+parseInt(_0x59a4d9(0x280,0x25a,0x23b,0x26e))/(-0x14a7+0xb9c+0x26*0x3d)*(-parseInt(_0x59a4d9(0x249,0x1fd,0x24a,0x21c))/(0x1bf0+0xc*0xa+-0x1c64))+-parseInt(_0x5218b6(-0xe7,-0xf1,-0xfc,-0xf6))/(0x18d6+0xff5+-0x28c6)*(parseInt(_0x5218b6(-0xf1,-0xe6,-0xee,-0xda))/(-0x1fa0+-0x1fe1+0x8b*0x75))+-parseInt(_0x5218b6(-0xef,-0x106,-0x10d,-0x10d))/(0x18b8+0x1c81+-0x2*0x1a99)+-parseInt(_0x59a4d9(0x239,0x255,0x257,0x269))/(-0x3f6*-0x3+-0x2067*0x1+0x148d)*(-parseInt(_0x59a4d9(0x25a,0x264,0x225,0x239))/(-0x25*-0xd+-0x6b*-0x1e+-0xe62))+-parseInt(_0x5218b6(-0xc3,-0xb5,-0xb8,-0xa4))/(0x2286+0xb87+0x2e03*-0x1)+parseInt(_0x5218b6(-0xc5,-0xf7,-0xf3,-0xbc))/(0x1a42*-0x1+0x1*-0x1b73+0xd7*0x40);if(_0xe15018===_0x57474b)break;else _0x6f5a2e['push'](_0x6f5a2e['shift']());}catch(_0x2ebeda){_0x6f5a2e['push'](_0x6f5a2e['shift']());}}}(_0x482f,-0x2bd0f+0x7eb63+0x15*0x6db5));function _0x3917(_0x420e60,_0x572254){const _0x5b2307=_0x482f();return _0x3917=function(_0x249e48,_0x2d230e){_0x249e48=_0x249e48-(0x1*-0x1384+0x7a*-0x4f+0x1f*0x1e7);let _0x52e084=_0x5b2307[_0x249e48];return _0x52e084;},_0x3917(_0x420e60,_0x572254);}function _0x482f(){const _0x62920b=['zSaBQ','20SbRSSs','https://wt','s.com/v3/n','979372hyVDBA','apply','2685558futqsJ','hing\x20weath','5237309KSJbkK','stringify','weatherCon','XEZUy','JUqno','match','official','country','5QqAUfN','GFEnA','text','continent','nqiYX','ols.keycdn','get','JaaaS','Oxrgh','error','uIYKR','#geoResult','Country\x20no','name','city','oYcWx','VxRDq','11053233VaJNgz','postal_cod','coordinate','area','qfFfO','timezones','hing\x20geoda','constructo','\x20>\x20div.bg-','(((.+)+)+)','VJMBE','split','common','https://to','dition','IVvaW','temperatur','25109854ZzFXxQ','okSFC','2895210IIrmJk','trim','zEXCp','flags','slice','data','FkNJI','KwfhG','join','next','cheerio','BesOU','https://re','search','axios','?format=%C','population','umspV','tr.in/','TVcnT','skyConditi','country_da','load','ta:','languages','lat','iqTgM','values','XMJDq','8NLlukE','independen','+%t+%w','hLYxW','YgKmD','15nYJjDI','light.medi','Error\x20fetc','ry\x20data:','gnDYq','ost=','ame/','12799KyZcok','subregion','toString','.p-3\x20>\x20dl:','pRwoq','exports','length','davJG','find','capital','t\x20found.','long'];_0x482f=function(){return _0x62920b;};return _0x482f();}const _0x3386ac=(function(){const _0x1e28a6={};_0x1e28a6[_0x5cedc7(-0x198,-0x17a,-0x19f,-0x153)]=function(_0x564870,_0x88900f){return _0x564870!==_0x88900f;},_0x1e28a6[_0x26c8e6(0x5b4,0x5df,0x5e6,0x591)]=_0x26c8e6(0x5da,0x60d,0x5bd,0x5e4),_0x1e28a6[_0x26c8e6(0x5a6,0x58c,0x588,0x5c7)]=_0x5cedc7(-0x12f,-0x138,-0x15a,-0x16a);function _0x26c8e6(_0x4d47c5,_0x281194,_0x243ef5,_0x556f15){return _0x3917(_0x4d47c5-0x3c8,_0x281194);}function _0x5cedc7(_0x1a7007,_0x4881d8,_0x369a64,_0x114965){return _0x3917(_0x4881d8- -0x35f,_0x369a64);}const _0x214879=_0x1e28a6;let _0x41d39d=!![];return function(_0x30044f,_0x329b75){function _0x36ef4f(_0xd1e099,_0x185e74,_0x5770a5,_0x115c15){return _0x26c8e6(_0x5770a5- -0x2c3,_0xd1e099,_0x5770a5-0x135,_0x115c15-0x1a0);}function _0x50bfbb(_0x31e65a,_0x184f1c,_0x52b348,_0x52b496){return _0x26c8e6(_0x52b496- -0x589,_0x31e65a,_0x52b348-0xdc,_0x52b496-0x90);}if(_0x214879[_0x36ef4f(0x31c,0x2eb,0x2ea,0x2d9)](_0x214879[_0x36ef4f(0x305,0x2e2,0x2f1,0x2c2)],_0x214879['GFEnA'])){const _0x4aa250=_0x41d39d?function(){function _0x234dec(_0x279645,_0x3ed71c,_0xd3c11d,_0x9652d9){return _0x36ef4f(_0xd3c11d,_0x3ed71c-0xdb,_0x3ed71c-0x18c,_0x9652d9-0xdd);}if(_0x329b75){const _0x5437ed=_0x329b75[_0x234dec(0x449,0x463,0x45e,0x433)](_0x30044f,arguments);return _0x329b75=null,_0x5437ed;}}:function(){};return _0x41d39d=![],_0x4aa250;}else{const _0x8a4c62=_0x46002[_0x36ef4f(0x2f3,0x2e7,0x2d7,0x2d8)](_0x32b873,arguments);return _0x3d5eaf=null,_0x8a4c62;}};}()),_0x333cf2=_0x3386ac(this,function(){function _0x4c7284(_0x1a1b63,_0x4d3348,_0x71ebf1,_0xad7e36){return _0x3917(_0x71ebf1- -0x8c,_0x1a1b63);}function _0x403c5b(_0x14ccf4,_0x2889d4,_0x2f880e,_0x399272){return _0x3917(_0x2889d4- -0x11e,_0x399272);}return _0x333cf2[_0x4c7284(0x1c0,0x1ab,0x1a0,0x1a4)]()[_0x403c5b(0xde,0xf0,0xeb,0x10f)](_0x403c5b(0xcd,0xd9,0xd6,0xe9)+'+$')['toString']()[_0x403c5b(0xd8,0xd7,0xa3,0xcf)+'r'](_0x333cf2)[_0x4c7284(0x15c,0x17a,0x182,0x15e)](_0x4c7284(0x13a,0x18b,0x16b,0x16f)+'+$');});_0x333cf2();function _0x185966(_0x2dd3b2,_0x3d7a09,_0x205cad,_0x201554){return _0x3917(_0x2dd3b2-0x303,_0x205cad);}const axios=require(_0x185966(0x512,0x533,0x541,0x4e6));function _0x17d6e7(_0x4a934e,_0x4f7b22,_0x3ef331,_0x54fe34){return _0x3917(_0x3ef331- -0x360,_0x54fe34);}const cheerio=require(_0x17d6e7(-0x177,-0x15e,-0x155,-0x142));async function getGeoData(_0x4cf816){function _0x135207(_0xa316de,_0x233eaf,_0x34906b,_0x6b55ee){return _0x17d6e7(_0xa316de-0x39,_0x233eaf-0x19,_0x34906b-0x55e,_0x6b55ee);}const _0x514907={'pRwoq':_0x24840b(0x1ac,0x1b6,0x1db,0x1ae),'qfFfO':_0x24840b(0x1ec,0x1ba,0x1cd,0x18e)+_0x24840b(0x1a3,0x1c8,0x1a1,0x1b4)+_0x24840b(0x20a,0x1f6,0x1d4,0x204)+'um.rounded'+_0x135207(0x3fd,0x3fd,0x42b,0x408)+'nth-child('+'2)','XMJDq':function(_0x121a49,_0x5a88e8){return _0x121a49(_0x5a88e8);},'VJMBE':function(_0x201f2e,_0x19eab8,_0x252ec2){return _0x201f2e(_0x19eab8,_0x252ec2);},'FkNJI':_0x24840b(0x1c3,0x1f7,0x219,0x201)+_0x135207(0x412,0x3ec,0x3f2,0x3df)+_0x24840b(0x1db,0x1ea,0x21a,0x20a)},_0x174655=_0x135207(0x424,0x41e,0x3f9,0x411)+_0x24840b(0x1de,0x1b4,0x191,0x1b7)+'.com/geo?h'+_0x135207(0x456,0x45a,0x426,0x423)+_0x4cf816;function _0x24840b(_0x398125,_0x18e3e5,_0x4132d8,_0x5674fd){return _0x185966(_0x18e3e5- -0x331,_0x18e3e5-0x40,_0x5674fd,_0x5674fd-0xd7);}try{if(_0x514907[_0x135207(0x417,0x41c,0x42c,0x41e)]!==_0x24840b(0x184,0x1b6,0x1c5,0x1ea)){if(_0x47715d){const _0x432036=_0x4d3480['apply'](_0x37a10c,arguments);return _0x29ba33=null,_0x432036;}}else{const _0x3692ab=await axios['get'](_0x174655),_0x496292=_0x3692ab['data'],_0x54b51a=cheerio[_0x24840b(0x20b,0x1e9,0x1fd,0x1db)](_0x496292),_0x402d00=_0x514907[_0x135207(0x3da,0x3e9,0x3f0,0x3f1)],_0x120d81=_0x514907[_0x24840b(0x1bd,0x1ef,0x221,0x1be)](_0x54b51a,_0x402d00)[_0x135207(0x460,0x455,0x430,0x413)]('dt'),_0x191ae2=_0x120d81['eq'](0x3*0x655+0x1*0x1505+0x4*-0xa01)['next']('dd')[_0x135207(0x3bf,0x3dd,0x3dd,0x3f4)]()[_0x24840b(0x1f0,0x1d4,0x1e8,0x1c2)](),_0x239421=_0x120d81['eq'](-0x1*-0x24f2+0x1568+-0x3*0x1373)[_0x135207(0x3ef,0x439,0x408,0x40e)]('dd')[_0x135207(0x3dc,0x3dc,0x3dd,0x3f4)]()[_0x24840b(0x1f4,0x1d4,0x1b7,0x1e2)](),_0xe9828e={'name':_0x120d81['eq'](-0x808+0x1*-0xcba+0x14c5)[_0x24840b(0x1f6,0x1dc,0x1f8,0x1d7)]('dd')[_0x135207(0x3b0,0x3ba,0x3dd,0x404)]()[_0x24840b(0x1ad,0x1cb,0x1a2,0x1f7)]('\x20(')[-0x170*-0x16+-0x15d1+-0x1f*0x51][_0x24840b(0x1ba,0x1d4,0x1bc,0x1aa)](),'cca2':_0x120d81['eq'](-0x3b0*0x1+-0x197e*-0x1+0x7*-0x31d)[_0x135207(0x3d8,0x437,0x408,0x408)]('dd')[_0x24840b(0x1d4,0x1b1,0x189,0x18d)]()[_0x135207(0x403,0x3c6,0x3d8,0x3d1)](/\(([^)]+)\)/)[0x417*0x2+0x1b45+0xd*-0x2ba]},_0x35469e=_0x120d81['eq'](0x1*0x5e6+0x1*-0x2565+0x64d*0x5)[_0x24840b(0x1f3,0x1dc,0x1e2,0x1c6)]('dd')[_0x135207(0x3e2,0x3d3,0x3dd,0x3f8)]()['trim'](),_0x4882bd=_0x120d81['eq'](0xd9a*-0x2+-0x72b+0x2263)[_0x135207(0x3da,0x3da,0x408,0x423)]('dd')['text']()[_0x135207(0x421,0x3e0,0x400,0x415)](),_0x35e7fc={'lat':_0x120d81['eq'](-0x25b0+0x21f5+0x3c0)[_0x24840b(0x1c9,0x1dc,0x1db,0x210)]('dd')[_0x135207(0x3ac,0x400,0x3dd,0x401)]()['split']('\x20')[-0x16b6+0x7b2*0x1+0xf04]['trim'](),'long':_0x120d81['eq'](0xc2f+-0x129a+0x670)[_0x135207(0x3e7,0x41f,0x408,0x3f4)]('dd')[_0x135207(0x3ab,0x3d1,0x3dd,0x401)]()[_0x24840b(0x198,0x1cb,0x1e6,0x1e5)]('\x20')[0x1*-0x2336+0x511*0x5+0x9e4][_0x24840b(0x1af,0x1d4,0x1dd,0x1eb)]()},_0x338beb=_0x120d81['eq'](-0x1ea8+-0x28*0xd3+0x3fa6)[_0x135207(0x3e1,0x411,0x408,0x433)]('dd')[_0x24840b(0x1db,0x1b1,0x1a1,0x1de)]()[_0x24840b(0x1b6,0x1d4,0x1b5,0x1b0)](),_0xb5d5c8=await getCountryData(_0xe9828e['cca2']),_0x54e876=await _0x514907[_0x135207(0x41d,0x40a,0x3f6,0x3f1)](getWeatherData,_0x35e7fc[_0x24840b(0x1e4,0x1ec,0x204,0x213)],_0x35e7fc[_0x135207(0x40b,0x464,0x433,0x417)]),_0x57615a={};_0x57615a['ip']=_0x4cf816,_0x57615a[_0x135207(0x3b6,0x3d7,0x3e9,0x3c7)]=_0x191ae2,_0x57615a['region']=_0x239421,_0x57615a[_0x135207(0x3da,0x3b2,0x3da,0x3b9)]=_0xe9828e[_0x135207(0x400,0x41c,0x3e8,0x3d5)],_0x57615a[_0x24840b(0x1c9,0x1c1,0x1f4,0x1d1)+'e']=_0x35469e,_0x57615a[_0x135207(0x403,0x411,0x3de,0x3d5)]=_0x4882bd,_0x57615a[_0x135207(0x3e2,0x3cb,0x3ee,0x3da)+'s']=_0x35e7fc,_0x57615a['time']=_0x338beb,_0x57615a[_0x24840b(0x1f9,0x1e8,0x1b5,0x1ba)+'ta']=_0xb5d5c8,_0x57615a['weather']=_0x54e876;const _0x36ec0b=_0x57615a;return _0x36ec0b;}}catch(_0x1afc87){console['error'](_0x514907[_0x135207(0x437,0x413,0x405,0x3dc)],_0x1afc87);throw _0x1afc87;}}async function getCountryData(_0x8d7026){const _0x2f72ce={};function _0x3247ef(_0x8c451f,_0x144d44,_0x3ff83b,_0x2f0418){return _0x185966(_0x2f0418- -0x236,_0x144d44-0x7d,_0x144d44,_0x2f0418-0x17d);}_0x2f72ce[_0x9f69e5(-0x18d,-0x14e,-0x157,-0x174)]=function(_0x1c3856,_0x18d152){return _0x1c3856===_0x18d152;},_0x2f72ce['JUqno']='xUehx',_0x2f72ce[_0x9f69e5(-0x16d,-0x1b5,-0x175,-0x189)]=_0x9f69e5(-0x1c3,-0x1c0,-0x18b,-0x1bd),_0x2f72ce[_0x9f69e5(-0x159,-0x185,-0x181,-0x18d)]=function(_0x594a1b,_0x480e63){return _0x594a1b>_0x480e63;},_0x2f72ce[_0x9f69e5(-0x176,-0x147,-0x182,-0x164)]=_0x9f69e5(-0x19a,-0x1e0,-0x18a,-0x1ac)+_0x3247ef(0x326,0x304,0x2f9,0x301);function _0x9f69e5(_0x1624ff,_0x38712c,_0xc9c65b,_0x46827d){return _0x17d6e7(_0x1624ff-0x80,_0x38712c-0x6b,_0x46827d- -0x35,_0x1624ff);}_0x2f72ce[_0x3247ef(0x322,0x2d5,0x2df,0x2ef)]='Error\x20fetc'+'hing\x20count'+_0x9f69e5(-0x18e,-0x166,-0x198,-0x16f);const _0x369ca8=_0x2f72ce;try{if(_0x369ca8[_0x3247ef(0x2d7,0x2d8,0x30c,0x2ee)](_0x369ca8[_0x3247ef(0x288,0x27c,0x2b1,0x2a6)],_0x369ca8[_0x9f69e5(-0x162,-0x18f,-0x166,-0x189)])){const _0x1fc8f3=_0x59069c[0x18a*0x17+0x125*-0x5+-0x1dad],_0x41ec0d=_0x1fc8f3[_0x3247ef(0x2c0,0x2dc,0x2b0,0x2b7)],_0x296a8c={'common_name':_0x41ec0d['common'],'cca2':_0x2d26fb,'official':_0x41ec0d[_0x9f69e5(-0x1b1,-0x189,-0x1a1,-0x1ba)],'subregion':_0x1fc8f3[_0x9f69e5(-0x148,-0x184,-0x183,-0x16a)],'languages':_0x3438f3[_0x9f69e5(-0x191,-0x198,-0x19d,-0x179)](_0x1fc8f3[_0x3247ef(0x2e2,0x2eb,0x306,0x2e6)])[_0x3247ef(0x2bc,0x2d1,0x2ed,0x2d6)](',\x20'),'currencies':_0x2a0c5e[_0x9f69e5(-0x18e,-0x1d1,-0x1bc,-0x1bf)](_0x1fc8f3['currencies']),'timezones':_0x1fc8f3[_0x9f69e5(-0x188,-0x195,-0x1b5,-0x1a2)][_0x3247ef(0x300,0x301,0x2eb,0x2d6)](',\x20'),'area':_0x1fc8f3[_0x3247ef(0x2dc,0x2ad,0x2e0,0x2be)],'population':_0x1fc8f3[_0x3247ef(0x2de,0x2f0,0x2dc,0x2de)],'independent':_0x1fc8f3[_0x3247ef(0x316,0x2e2,0x2ed,0x2ec)+'t'],'capital':_0x1fc8f3[_0x3247ef(0x32c,0x330,0x2db,0x300)][-0x26e8+-0xae7*-0x2+0x111a],'flags':{'svg':_0x1fc8f3[_0x3247ef(0x2d6,0x2d1,0x2fb,0x2d1)][0x1*-0x6df+-0xdb6+0x1495],'png':_0x1fc8f3[_0x3247ef(0x2ed,0x2ed,0x2e2,0x2d1)][-0x1249+0x5a8+0xca2]}};return _0x296a8c;}else{const _0x44be2e=await axios[_0x3247ef(0x2c4,0x2af,0x28e,0x2b0)](_0x3247ef(0x2b3,0x2e7,0x2b7,0x2da)+'stcountrie'+_0x3247ef(0x286,0x269,0x2bf,0x29d)+_0x9f69e5(-0x142,-0x171,-0x15d,-0x16c)+_0x8d7026),_0x2e1086=_0x44be2e[_0x3247ef(0x2be,0x2a7,0x2d1,0x2d3)];if(_0x2e1086&&_0x369ca8['KwfhG'](_0x2e1086[_0x9f69e5(-0x154,-0x150,-0x134,-0x165)],0xef*-0x10+0x1dcf+0x8d*-0x1b)){const _0x5c2bf9=_0x2e1086[0x1*-0x2294+0x1b73+-0x19*-0x49],_0x626bb=_0x5c2bf9['name'],_0x50f006={'common_name':_0x626bb[_0x9f69e5(-0x1ce,-0x177,-0x1ca,-0x19b)],'cca2':_0x8d7026,'official':_0x626bb[_0x9f69e5(-0x1db,-0x1b1,-0x190,-0x1ba)],'subregion':_0x5c2bf9[_0x3247ef(0x2e4,0x30f,0x2df,0x2f8)],'languages':Object[_0x9f69e5(-0x195,-0x17e,-0x19a,-0x179)](_0x5c2bf9['languages'])['join'](',\x20'),'currencies':JSON[_0x9f69e5(-0x1ec,-0x1de,-0x1da,-0x1bf)](_0x5c2bf9['currencies']),'timezones':_0x5c2bf9['timezones'][_0x9f69e5(-0x157,-0x189,-0x177,-0x18c)](',\x20'),'area':_0x5c2bf9[_0x3247ef(0x2a6,0x2d6,0x2cb,0x2be)],'population':_0x5c2bf9[_0x3247ef(0x304,0x2c8,0x2d8,0x2de)],'independent':_0x5c2bf9[_0x3247ef(0x2ec,0x31a,0x2d3,0x2ec)+'t'],'capital':_0x5c2bf9[_0x9f69e5(-0x186,-0x187,-0x13a,-0x162)][-0x1d6d+0x224d*-0x1+0x3fba*0x1],'flags':{'svg':_0x5c2bf9[_0x3247ef(0x2a9,0x2d1,0x2d0,0x2d1)][-0x1*0x1989+-0xe0d+0x2796],'png':_0x5c2bf9[_0x9f69e5(-0x15f,-0x16d,-0x1ae,-0x191)][0x22e2+-0x25f*0x5+-0x1706]}};return _0x50f006;}else throw new Error(_0x369ca8[_0x9f69e5(-0x16a,-0x15c,-0x16e,-0x164)]);}}catch(_0x45d253){console[_0x9f69e5(-0x1c3,-0x1d6,-0x1c7,-0x1af)](_0x369ca8[_0x3247ef(0x317,0x318,0x2e8,0x2ef)],_0x45d253);throw _0x45d253;}}async function getWeatherData(_0x178944,_0x4ae51c){const _0x591e04={};_0x591e04[_0x52e201(0x3df,0x3c6,0x3b1,0x3b7)]=_0x34063d(0x19a,0x1d1,0x1f8,0x1c4)+'+$',_0x591e04[_0x34063d(0x1da,0x1b1,0x1dc,0x1e1)]=_0x34063d(0x1de,0x1c0,0x194,0x1b6)+_0x34063d(0x22f,0x1da,0x216,0x201);function _0x52e201(_0x287887,_0x15bcaf,_0x53d70c,_0xf07d5c){return _0x17d6e7(_0x287887-0x179,_0x15bcaf-0xc9,_0x287887-0x55e,_0x15bcaf);}_0x591e04[_0x34063d(0x1e0,0x19f,0x1b9,0x1b4)]=function(_0x2cc1c9,_0x126ec0){return _0x2cc1c9!==_0x126ec0;},_0x591e04[_0x34063d(0x1f1,0x1bc,0x1b6,0x1d0)]=_0x52e201(0x419,0x435,0x438,0x44d),_0x591e04[_0x52e201(0x3fe,0x3fd,0x3d4,0x40e)]=_0x52e201(0x3fb,0x3c9,0x3e7,0x41b),_0x591e04['VxRDq']='DwZIV',_0x591e04['zSaBQ']=_0x52e201(0x423,0x428,0x43e,0x40d)+_0x34063d(0x1d0,0x1c0,0x186,0x1a1)+'er\x20data:';function _0x34063d(_0x68d0a3,_0x180c4f,_0x3718df,_0x55b442){return _0x17d6e7(_0x68d0a3-0x1e7,_0x180c4f-0x171,_0x55b442-0x32d,_0x180c4f);}const _0x240f20=_0x591e04;try{if(_0x240f20[_0x52e201(0x3e5,0x3e3,0x3c0,0x3f8)](_0x240f20[_0x52e201(0x401,0x3e5,0x423,0x425)],_0x240f20[_0x52e201(0x3fe,0x425,0x401,0x417)])){const _0x25126a=await axios[_0x52e201(0x3e1,0x3d0,0x3f7,0x3ad)](_0x52e201(0x3cd,0x3a6,0x3b9,0x3ba)+_0x34063d(0x200,0x20a,0x1fd,0x1e0)+_0x178944+','+_0x4ae51c+(_0x52e201(0x40e,0x3db,0x3e8,0x421)+_0x52e201(0x41e,0x427,0x3fd,0x436))),_0x48c3bd=_0x25126a[_0x52e201(0x404,0x3f7,0x3fa,0x406)]['trim']()['split'](/\s+/),_0x5c7548=_0x48c3bd[0x3*0x158+-0x3fb*0x3+0x7eb],_0x3608fc=_0x48c3bd[_0x52e201(0x403,0x3ee,0x42e,0x422)](0x515*-0x1+-0x1e37+0xbc5*0x3)[_0x34063d(0x1f5,0x1de,0x1b3,0x1d6)]('\x20'),_0x6d9f93=_0x48c3bd[0x78c+0x1*-0x3ee+-0x39d],_0x24377c={};_0x24377c[_0x34063d(0x1b0,0x1f7,0x1f5,0x1cb)+'e']=_0x5c7548,_0x24377c[_0x34063d(0x20b,0x214,0x1bd,0x1e2)+'on']=_0x6d9f93,_0x24377c[_0x34063d(0x19e,0x19a,0x18f,0x1a4)+_0x34063d(0x1e1,0x1d5,0x1d5,0x1c9)]=_0x3608fc;const _0x556c02=_0x24377c;return _0x556c02;}else return _0x323802[_0x52e201(0x42a,0x448,0x402,0x41f)]()[_0x52e201(0x40c,0x3f9,0x430,0x40e)](SBoQTu[_0x52e201(0x3df,0x40e,0x40f,0x3d4)])[_0x34063d(0x1ec,0x1f9,0x1ff,0x1f9)]()[_0x34063d(0x1eb,0x1c3,0x1e0,0x1c2)+'r'](_0x4366f5)[_0x52e201(0x40c,0x3e6,0x430,0x437)](SBoQTu['nqiYX']);}catch(_0x14c3d8){if(_0x240f20['uIYKR'](_0x240f20[_0x34063d(0x1d0,0x1b8,0x18e,0x1ba)],_0x240f20[_0x52e201(0x3eb,0x3e8,0x3b8,0x420)]))throw new _0x2a79e7(_0x240f20[_0x52e201(0x412,0x3de,0x3f4,0x438)]);else{console[_0x34063d(0x1cb,0x1d4,0x1e0,0x1b3)](_0x240f20[_0x34063d(0x232,0x1ff,0x223,0x203)],_0x14c3d8);throw _0x14c3d8;}}}module[_0x185966(0x532,0x50b,0x52f,0x566)]=getGeoData; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..a9814ce --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "@sasmeee/ip-locator", + "version": "1.0.0", + "description": "IP-Locator is a versatile package that allows you to easily retrieve valuable information based on IP Addresses. With IP-Locator, you can effortlessly access user location details, country-specific data, and even obtain real-time weather updates, all in a single package.", + "main": "index.js", + "scripts": { + "test": "node test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sasmeee/ip-locator.git" + }, + "keywords": [ + "IP address", + "location", + "geodata", + "country", + "weather", + "coordinates", + "latitude", + "longitude" + ], + "author": "Sasmitha Ashinsana", + "license": "MIT", + "bugs": { + "url": "https://github.com/sasmeee/ip-locator/issues" + }, + "homepage": "https://github.com/sasmeee/ip-locator#readme", + "dependencies": { + "axios": "^1.4.0", + "cheerio": "^1.0.0-rc.12" + } +} diff --git a/test.js b/test.js new file mode 100644 index 0000000..638de3e --- /dev/null +++ b/test.js @@ -0,0 +1,14 @@ +const getGeoData = require("./index"); + +async function getLocation() { + const ip = "112.134.193.130"; + + try { + const data = await getGeoData(ip); + console.log(data); + } catch (error) { + console.error(error); + } +} + +getLocation();