WILDAN_IZZUDIN

[JS] GG TIKTOK SCRAPER

Oct 26th, 2021 (edited)
764
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let fetch = require('node-fetch')
  2. let cheerio = require('cheerio')
  3.  
  4. function analyze(url) {
  5.     return new Promise(async(resolve, reject) => {
  6.     try {
  7.         let form = new URLSearchParams()
  8.         form.append('link', url)
  9.         let html = await (await fetch('https://www.ggtiktok.com/results', { method: 'POST', body: form })).text()
  10.         $ = cheerio.load(html)
  11.         let urls = []
  12.         $('div.container').find('a').each(function(i, e) {
  13.             urls.push($(e).attr('href'))
  14.         })
  15.         urls.slice(0, -4)
  16.         if (urls[0].length < 100) return resolve({ creator: '@neoxrs – Wildan Izzudin', status: false })
  17.         let urlList = {
  18.             video: 'https://www.ggtiktok.com' + urls[0],
  19.             videoWM: 'https://www.ggtiktok.com' + urls[1]
  20.         }
  21.         resolve({ creator: '@neoxrs – Wildan Izzudin', status: true, data: urlList })
  22.     } catch {
  23.         return resolve({ creator: '@neoxrs – Wildan Izzudin', status: false })
  24.     }})
  25. }
  26.  
  27. analyze('https://vt.tiktok.com/ZSe22y3dA/').then(res => console.log(res))
RAW Paste Data