WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.97k stars 1.35k forks source link

[BUG] media download 403 error #1108

Open starksemihyarar opened 1 week ago

starksemihyarar commented 1 week ago

Describe the bug I am testing with sending about 13-20 image to baileys client, ı got receive 403 for some media downloads

To Reproduce Steps to reproduce the behavior:

  1. sending 13 images to baileys client whatsapp number
  2. console.log for download media interface

Expected behavior download and access all media

` conn.ev.on("messages.upsert", async msg => { try { if (msg.type === "notify") {

            for (const m of msg.messages) {
                var full_file_name = null
                const messageType = Object.keys (m.message)[0]

                if (messageType !== 'conversation') {

                    // download the message
                    try {
                        const buffer = await downloadMediaMessage(
                            m,
                            'buffer',
                            { },
                            {
                                _0x1dc0c3,
                                // pass this so that baileys can request a reupload of media
                                // that has been deleted
                                reuploadRequest:  conn.updateMediaMessage
                            }
                        )

                    }catch (e) {
                        console.log(e.message)
                    }

                    const filename = "wpclientdownload_pn_" + m.key.remoteJid + "_" + m.key.id +"_"+ generateRandomString(10)
                    const extension = m.message[messageType].mimetype.split("/")
                    full_file_name = filename+'.'+extension[1].split(";")[0]
                    await writeFile('./public/metocrm/'+full_file_name, buffer)
                }
                //#END - MEDIA

            }
        }

    } catch (e) { //console.log("ERROR",e)
         }
});

`

output ` Request failed with status code 403 Request failed with status code 403 Request failed with status code 403

`

nekuro201 commented 1 day ago

Same here

starksemihyarar commented 16 hours ago

@PurpShell could u help ?