Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.   'streamkiste.tv': {
  3.     regex: /https?:\/\/(?:www\.)?streamkiste\.tv\/(?:movie\/[\w-]+(\d{4})-(\d+)|(#captcha$))/,
  4.     groups: ['year', 'id', 'captcha'],
  5.     getInfo() {
  6.       return this.bot.fetch(this.url, {
  7.         match: /<title>([^<]*) HD Stream &raquo; StreamKiste\.tv<\/title>[\s\S]+pid:"(\d+)/,
  8.         $: true
  9.       }).then(({ match, $ }) => {
  10.         this.title = match[1]
  11.         const pid = match[2]
  12.         const rlss = $('#rel > option').map((i, e) => {
  13.           console.log(e.attribs)
  14.           return e.attribs
  15.         }).toArray().filter(({ selected }) => selected != undefined)
  16.         const mirrors = $('[href=\'#video\']').map((i, e) => {
  17.           return e.attribs
  18.         }).toArray().reduce((acc, attribs) => {
  19.           let { 'data-mirror': mirror, 'data-host': host, title } = attribs
  20.           title = (title.match(/'([^']+)/) || [])[1]
  21.           if (!/^nxload/i.test(title)) return acc
  22.           if (!acc[title]) acc[title] = []
  23.           acc[title].push({ host, mirror})
  24.           return acc
  25.         }, {})
  26.         console.log(pid)
  27.         console.log(rlss)
  28.         console.log(mirrors)
  29.         return this.bot.fetch(this.url, {
  30.           method: 'POST',
  31.           form: {
  32.             req: '3',
  33.             pid,
  34.             ...Object.values(mirrors).pop().pop(),
  35.             rel: rlss.pop().data,
  36.             token: this.bot.API.add.captchas.pop()
  37.           },
  38.           customerr: [302]
  39.         })
  40.       }).then(({ res, body, statusCode }) => {
  41.         let url
  42.         if (statusCode === 302) url = res.headers.location
  43.         else url = body
  44.         console.log(url)
  45.         this.matchUrl(url, this.bot.API.add.providerlist)
  46.         return this.getInfo().then(addition => {
  47.           addition.title = title
  48.           if (addition.type === 'cm' && !addition.duration)
  49.           return this.bot.API.add.getDuration(addition)
  50.           return addition
  51.         })
  52.       })
  53.     },
  54.     userScript: function() {
  55.       if (!this.match[3]) return
  56.       const setup = () => {
  57.         grecaptcha.render({
  58.           sitekey: '6LcGFzMUAAAAAJaE5lmKtD_Oi_YzC837_Nwt6Btv',
  59.           size: 'invisible',
  60.           callback: captcha => {
  61.             console.log(captcha)
  62.             GM.xmlHttpRequest({
  63.               method: 'GET',
  64.               url: `${config.weblink}/recaptcha/${captcha}`,
  65.               onload: res => {
  66.                 console.log(res.responseText)
  67.                 grecaptcha.reset()
  68.                 setup()
  69.               },
  70.               onerror: console.error
  71.             })
  72.           }
  73.         })
  74.         grecaptcha.execute()
  75.       }
  76.       unsafeWindow.setup = setup
  77.       const script = document.createElement('script')
  78.       script.setAttribute('type', 'text/javascript')
  79.       script.setAttribute('src', 'https://www.google.com/recaptcha/api.js?onload=setup&render=explicit')
  80.       document.getElementsByTagName('head').item(0).appendChild(script)
  81.     }
  82.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement