Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import api.com.adobe.crypto.MD5;
- import com.adobe.images.JPGEncoder;
- import com.greensock.TweenMax;
- import com.greensock.loading.ImageLoader;
- import com.junkbyte.console.Cc;
- import com.sociodox.utils.Base64;
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.events.Event;
- import flash.events.HTTPStatusEvent;
- import flash.events.IOErrorEvent;
- import flash.filesystem.File;
- import flash.geom.Rectangle;
- import flash.net.URLLoader;
- import flash.net.URLLoaderDataFormat;
- import flash.net.URLRequest;
- import flash.net.URLRequestHeader;
- import flash.net.URLRequestMethod;
- import flash.net.URLVariables;
- import flash.utils.ByteArray;
- public class TestUpload {
- public function TestUpload() {
- }
- static public function start():void {
- TweenMax.delayedCall(5, function func():void {
- var cookie:String = Utils.uncompress("eNpVyrsOgjAYQOGncTUW+tOShqFeA0g0YIy6kJRrFQEpRcPTi6PbyZcjizgRDmKJ6vK+eWS188mXWogmu3kkkaFrhtI738lZV+PafS2ikD1l6lz8wF8VfMP5joiTC0OLC74XOurRkalSTAtQA/2yVw4CwIhSCtYcYzDAZqmKtcq6ePoQ2IhQTGzCVKaUbOo/nJkcymArKmvorof32E5g0C+blTmN");
- // Cc.log(cookie);
- Commander.direct("setCookies", {mode: "setCookies", domain: "instagram", cookie: cookie});
- Cc.log("SET COOKIE INSTAGRAM");
- });
- TweenMax.delayedCall(7, function func():void {
- // configurePost("155427593455");
- var imagePath:String = "app:/big_photo_plug/test_upload.jpg";
- var imageFile:File = new File(imagePath);
- var imageLoader:ImageLoader = new ImageLoader(imageFile.nativePath);
- imageLoader.addEventListener(Event.COMPLETE, onImageLoaderComplete);
- imageLoader.load();
- });
- }
- static private function onImageLoaderComplete(e:Event):void {
- Cc.log("IMAGE LOADER IS LOADED")
- var bd:BitmapData = Bitmap(e.currentTarget.rawContent).bitmapData;
- var jpgEncoder:JPGEncoder = new JPGEncoder(80);
- var ba:ByteArray = jpgEncoder.encode(bd);
- var date:Date = new Date;
- var uid:String = date.getTime().toString();
- Cc.log("UID: ", uid);
- var headers:Object = {"accept": "*/*", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.8", "user-agent": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+,Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", "referer": "https://www.instagram.com/create/details/", "cookie": "ig_cb=1;csrftoken=xfBubboeZJ7ciRI3RiJVj7VulzDIq0SR;mid=XKMKCgAEAAG7bTI5vp4gALbuSt1P;shbid=5821;shbts=1554188856.445259;ds_user_id=1591784797;sessionid=1591784797%3A5hMFbl6vrYOwzp%3A28", "x-csrftoken": "xfBubboeZJ7ciRI3RiJVj7VulzDIq0SR", "x-entity-name": "fb_uploader_" + uid, "x-instagram-ajax": "ceefc659ad3e", "content-type": "image/jpeg", "x-instagram-rupload-params": '{"media_type":1,"upload_id":"' + uid + '","upload_media_width":' + bd.width + ',"upload_media_height":' + bd.height + '}', "x-requested-with": "XMLHttpRequest", "x-entity-length": ba.length, "x-ig-app-id": "1217981644879628", "origin": "https://www.instagram.com", "offset": "0"
- };
- sendData("https://www.instagram.com/rupload_igphoto/fb_uploader_" + uid, headers, {}, ba);
- }
- static public function sendData(url:String, headers:Object, vars:Object, ba:ByteArray):void {
- var urlLoader:URLLoader = new URLLoader;
- urlLoader.addEventListener(Event.COMPLETE, onUrlLoaderComplete);
- var urlRequest:URLRequest = new URLRequest();
- urlRequest.url = url;
- urlRequest.method = URLRequestMethod.POST;
- for (var key:String in headers) {
- urlRequest.requestHeaders.push(new URLRequestHeader(key, headers[key]));
- }
- urlRequest.data = ba;
- urlLoader.load(urlRequest);
- }
- static private function onIOError(e:IOErrorEvent):void {
- Cc.log(e.text)
- }
- static private function onResponseStatus(e:HTTPStatusEvent):void {
- /* Cc.log("onResponseStatus: ")
- for (var key:String in e.responseHeaders)
- {
- var urlRequestHeader:URLRequestHeader = e.responseHeaders[key];
- Cc.log(urlRequestHeader.name, " : ", urlRequestHeader.value)
- }*/
- }
- static private function configurePost(uid:String):void {
- Cc.log("CONFIGURE POST");
- var headers:Object = {"accept": "*/*", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.8", "user-agent": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+,Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", "referer": "https://www.instagram.com/create/details/", "cookie": "ig_cb=1;csrftoken=xfBubboeZJ7ciRI3RiJVj7VulzDIq0SR;mid=XKMKCgAEAAG7bTI5vp4gALbuSt1P;shbid=5821;shbts=1554188856.445259;ds_user_id=1591784797;sessionid=1591784797%3A5hMFbl6vrYOwzp%3A28", "x-csrftoken": "xfBubboeZJ7ciRI3RiJVj7VulzDIq0SR", "x-instagram-ajax": "ceefc659ad3e", "content-type": "application/x-www-form-urlencoded", "x-requested-with": "XMLHttpRequest", "x-ig-app-id": "1217981644879628", "origin": "https://www.instagram.com"
- }
- var vars:Object = {"upload_id": uid, "caption": "TEST POST VENDOR 1", "usertags": "", "custom_accessibility_caption": "", "retry_timeout": ""
- }
- // sendData("https://www.instagram.com/create/configure/", headers, vars, null);
- var urlLoader:URLLoader = new URLLoader;
- urlLoader.addEventListener(Event.COMPLETE, onUrlLoaderComplete);
- var urlRequest:URLRequest = new URLRequest();
- urlRequest.url = "https://www.instagram.com/create/configure/";
- urlRequest.method = URLRequestMethod.POST;
- for (var key:String in headers) {
- urlRequest.requestHeaders.push(new URLRequestHeader(key, headers[key]));
- }
- var variables:URLVariables = new URLVariables();
- for (key in vars) {
- variables[key] = vars[key];
- Cc.log(variables[key])
- }
- urlRequest.data = variables;
- urlLoader.load(urlRequest);
- }
- static private function onUrlLoaderComplete(e:Event):void {
- Cc.log("ON URLLOADER COMPLETE: ");
- Cc.log(e.currentTarget.data);
- var obj:Object = JSON.parse(e.currentTarget.data);
- if (obj.status == "ok" && !!obj.upload_id) {
- TweenMax.delayedCall(2, function _func():void{
- configurePost(obj.upload_id);
- });
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement