Socket
Socket
Sign inDemoInstall

instagram-apis

Package Overview
Dependencies
78
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

3

package.json
{
"name": "instagram-apis",
"version": "1.0.3",
"version": "1.0.4",
"description": "Insatgram library filled with useful Instagram API's",

@@ -17,2 +17,3 @@ "main": "index.js",

"axios": "^0.27.2",
"get-video-duration": "^4.1.0",
"randomstring": "^1.2.2",

@@ -19,0 +20,0 @@ "readline-sync": "^1.4.10",

@@ -336,3 +336,3 @@ const data = require("./_constants.js");

this.cookie.split("csrftoken=")[1].split(";")[0]
}&video_result=&device_id=android-8cd32a1ba6669cbe&mutation_token=${context}&_uuid=${v4()}&upload_id=${
}&video_result=&device_id=android-d502d92d2de2995c&mutation_token=${context}&_uuid=${v4()}&upload_id=${
this.time

@@ -339,0 +339,0 @@ }&offline_threading_id=${context}`;

const axios = require("axios");
const newInboxAPIs = require("./newInboxAPIs.js");
const {generate} = require("randomstring");
const { v4 } = require("uuid");
const { getVideoDurationInSeconds } = require('get-video-duration');
module.exports = class mediaAPIs extends newInboxAPIs {

@@ -69,2 +73,55 @@ initialize(headers) {

}
async uploadVideoToStory(url) {
let name = new uploadVideoToStory(this.headers);
await name.send(url);
}
}
class uploadVideoToStory {
constructor(headers) {
this.upload_id = `1881${generate({charset: "numeric", length: 9})}`
this.cookie = headers["Cookie"];
this.uuid = v4()
this.path = `${generate({length: 32}).toLowerCase()}-0-4146567-lessO-${Date.now()}000`
console.log(this.path)
this.mainHeaders = {
"Segment-Start-Offset": "0",
"X-Instagram-Rupload-Params": "",
"Segment-Type": "3",
"Offset": "0",
"User-Agent": "Instagram 177.0.0.30.119 Android",
"Accept-Language": "en-US",
"Host": "i.instagram.com",
"X-FB-HTTP-Engine": "Liger",
"Cookie": this.cookie,
}
}
async getVideoDuration(url) {
let duration = await getVideoDurationInSeconds(url);
return parseInt(duration * 1000)
}
async getStream(url) {
return new Promise((resolve, reject) => {
request.get(
{
uri: url,
encoding: null,
gzip: true,
},
(err, resp, body) => {
if (err) reject(err);
else resolve(body);
}
);
});
}
async send(url) {
this.mainHeaders["X-Instagram-Rupload-Params"] = `{"upload_media_height":"1280","extract_cover_frame":"1","xsharing_user_ids":"[]","upload_media_width":"720","upload_media_duration_ms":"${(await this.getVideoDuration(url))}","content_tags":"use_default_cover","upload_id":"${this.upload_id}","for_album":"1","retry_context":"{\"num_step_auto_retry\":0,\"num_reupload\":0,\"num_step_manual_retry\":0}","media_type":"2"}`
await this.upload()
}
async upload() {
let headers = {...this.mainHeaders};
headers["X_fb_video_waterfall_id"] = `1966${generate({charset: "numeric", length: 8})}_${generate({length: 12}).toUpperCase()}_Mixed_0`
// console.log(headers)
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc