WILDAN_IZZUDIN

[JS] TIKMATE SCRAPER

Oct 26th, 2021
888
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let fetch = require('node-fetch')
  2. let config = {
  3.     headers: {
  4.         'Accept': '*',
  5.         'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  6.     }
  7. }
  8.  
  9. function numbFormat(int) {
  10.     return Number(parseInt(int)).toLocaleString().replace(',', '.')
  11. }
  12.  
  13. function analyze(url) {
  14.     return new Promise(async(resolve, reject) => {
  15.         let form = new URLSearchParams()
  16.         form.append('url', url)
  17.         let json = await (await fetch('https://api.tikmate.app/api/lookup', { method: 'POST', body: form, ...config })).json()
  18.         if (!json.success) return resolve({ creator: '@neoxrs – Wildan Izzudin', status: false })
  19.         let postInfo = {
  20.             author: json.author_name + ' (@' + json.author_id + ')',
  21.             publish: json.create_time,
  22.             likes: numbFormat(json.like_count),
  23.             comments: numbFormat(json.comment_count),
  24.             shares: numbFormat(json.share_count),
  25.         }
  26.         let urlList = {
  27.             videoSD: 'https://tikmate.app/download/' + json.token + '/' + json.id + '.mp4',
  28.             videoHD: 'https://tikmate.app/download/' + json.token + '/' + json.id + '.mp4?hd=1'
  29.         }; resolve({ creator: '@neoxrs – Wildan Izzudin', status: true, ...postInfo, data: urlList })
  30.     })
  31. }
  32.  
  33. analyze('https://vt.tiktok.com/ZSe2F5rTC/').then(res => console.log(res))
RAW Paste Data