Untitled
unknown
javascript
2 years ago
1.2 kB
7
Indexable
// const express = require('express') import express from 'express'; import cors from 'cors'; import bodyParser from 'body-parser'; import fetch from 'node-fetch'; import HttpsProxyAgent from 'https-proxy-agent'; const app = express() app.use(cors()) app.use(bodyParser.json()) async function fetchData() { const postData = { "target_user_id": 248527063, "page_size": 12, "include_feed_video": true }; const requestOptions = { method: 'POST', headers: { 'Content-Type': 'application/json', "User-Agent": 'Instagram 239.2.0.17.109 (iPhone12,1; iOS 15_5; en_US; en-US; scale=2.00; 828x1792; 376668393) AppleWebKit/420+' }, body: JSON.stringify(postData), agent: new HttpsProxyAgent('http://socialstats:Au1ax40CLjbaekj0cP@gate.smartproxy.com:7000') }; const response = await fetch('https://www.instagram.com/api/v1/clips/user/',requestOptions); return await response.json(); } app.get('/scrape', async (req, res) => { try{ const data = await fetchData(); res.json(data); }catch(e){ throw e } }) const PORT = process.env.PORT || 8000 app.listen(PORT, () => { console.log(`Server running on port ${PORT}`) })
Editor is loading...