New _uploadPhoto method (development help wanted)

See original GitHub issue

Summary

Endpoint for _uploadPhoto was changed, but I’m not able to fix it by myself.

šŸ”„ HELP WANTED! šŸ”„

New method development

According to new photo upload requests code should look like this:

  async _uploadPhoto({ photo }) {
    const uploadId = new Date().getTime();
    return this.request.post(`/rupload_igphoto/fb_uploader_${uploadId}`, {
      headers: {
        'x-instagram-rupload-params': JSON.stringify({
          'media_type':1,
          'upload_id': uploadId.toString(),
          'upload_media_height': 1800,
          'upload_media_width': 1800
        }),
        'x-entity-name': `fb_uploader_${uploadId}`,
        'x-ig-app-id': 1217981644879628,
        'x-entity-length': fs.statSync(photo).size,
        'content-type': 'image/jpeg',
        'referer': 'https://www.instagram.com/create/details/',
        'offset': '0',
        'x-instagram-ajax': 'f4c28142cf13'
      },
      // body: fs.readFileSync(photo).toString('utf8')
      body: fs.createReadStream(photo)
    })
  }

Uploading images from web was removed by me.

This method is returning two types of errors.

Type one:

{ debug_info: 
   { retriable: true,
     type: 'PartialRequestError',
     message: 'Partial request (did not match length of file)' } }

Error appearing with: body: fs.createReadStream(photo)

Type two: Using body: fs.readFileSync(photo).toString('utf8') upload is succesful:

{ upload_id: '1558814131153', xsharing_nonces: {}, status: 'ok' }

But, requesting /create/configure/ failing:

{ message: 'media_needs_reupload',
  media: 
   { upload_id: '1558814131153',
     device_timestamp: '1558814131153' },
  error_title: 'bad image input extra:{}',
  status: 'ok' }

Network request from browser

If you want to view Instagram web request, switch your DevTools to mobile simulation, and try to upload image.

Real request headers:

:authority: www.instagram.com
:method: POST
:path: /rupload_igphoto/fb_uploader_1558812010088
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US;q=0.8,en;q=0.7,pt;q=0.6
cache-control: no-cache
content-length: 120754
content-type: image/jpeg
cookie: <cookies here>
offset: 0
origin: https://www.instagram.com
pragma: no-cache
referer: https://www.instagram.com/create/details/
user-agent: <ua>
x-csrftoken: <token>
x-entity-length: 120754
x-entity-name: fb_uploader_1558812010088
x-ig-app-id: 1217981644879628
x-instagram-ajax: f4c28142cf13
x-instagram-rupload-params: {"media_type":1,"upload_id":"1558812010088","upload_media_height":1080,"upload_media_width":1080}
x-requested-with: XMLHttpRequest

Payload contains image only (checked by me, by converting payload to base64): image

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
vishal2947commented, Jul 23, 2019

Hello

I am also working on this and have found some success. Can you mail me so that we can collaborate: vishal2547@gmail.com

3reactions
rad-zcommented, Jul 25, 2019

Why not post it here for all to see?

Hello

I am also working on this and have found some success. Can you mail me so that we can collaborate: vishal2547@gmail.com

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hplc Method Development Jobs, Employment | Indeed.com
1872 Hplc Method Development jobs available on Indeed.com. Apply to Scientist, Analytical Chemist, Research Scientist and more!
Read more >
$30-$55/hr Method Development Jobs (NOW HIRING)
Browse 538747 Method Development jobs ($30-$55/hour) from companies with openings that are hiring now. Find job postings near you and 1-click apply!
Read more >
20 Best scientist - hplc method development jobs (Hiring Now!)
1283 scientist - hplc method development jobs available. See salaries, compare reviews, easily apply, and get hired. New scientist - hplc method development...
Read more >
Face shape analysis upload photo online - CasaClima
(didn't want to post the results as my face is in the background and looks ... out a new makeup technique can be...
Read more >
upload photo | SAP Community - SAP Answers
A number range must be created for SAP Archive Link. Transaction code: OANR. For this process, additional authorisation is required for S_NUMBER =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found