WILDAN_IZZUDIN

[JS] GET COOKIES

Jul 28th, 2021
1,023
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let request = require('request')
  2. let Cookie = require('request-cookies').Cookie
  3.  
  4. const coki = url => {
  5.     return new Promise(async(resolve, reject) => {
  6.         request.get(url, function(err, response) {
  7.         if(err) return resolve({ creator: '@neoxrs – Wildan Izzudin', status: false })
  8.         let cok = response.headers['set-cookie'], data = []
  9.         for (let i in cok) cookie = new Cookie(cok[i]), data.push({ cookie: cookie.key + '='+ cookie.value, expired: cookie.expires })
  10.             resolve({ creator: '@neoxrs – Wildan Izzudin', status: true, data })
  11.         })
  12.     })
  13. }
RAW Paste Data