pishangujeniya / instagram-helper

Instagram Scripts for Bulk Unsending Direct Messages
https://pishangujeniya.github.io/instagram-helper/
MIT License
218 stars 51 forks source link

Downloading each message bubble twice #27

Closed Deleora closed 3 years ago

Deleora commented 3 years ago

Describe the bug I followed exact steps mentioned in README.md (tried 3-4 times before raising this issue) but the message JSON file downloaded is containing 2 copies of each message bubble text.

To Reproduce Steps to reproduce the behavior:

  1. Follow instructions given in README.md
  2. Load JSON file using the HTML view provided
  3. See error

Expected behavior Each bubble to have only one text entry in JSON file downloaded

Screenshots image

Desktop (please complete the following information):

Additional context I haven't tried but what all types of DMs can this script download (e.g. media files, posts, reels, etc.)?

pishangujeniya commented 3 years ago

@Deleora Thanks for reporting bug, I am looking into it.

pishangujeniya commented 3 years ago

@Deleora I rechecked the code and tried to regenerate, but it seems that message is either scrapped twice from Instagram or may be it has been sent twice, but this issue is not regenerating in my case.

The Viewer views the data as per it is stored in JSON file, if you can confirm that the data is stored ni JSON is multiple times same data, then issue might be in the code of scrapping data, else issue might be in the viewer code.

pishangujeniya commented 3 years ago

I haven't tried but what all types of DMs can this script download (e.g. media files, posts, reels, etc.)?

This script extracts every type of message from Instagram from a chat thread, but the viewer displays only following types of data:


        [
            "text",
            "link",
            "media_share",
            "clip",
            "media"
        ];
Deleora commented 3 years ago

it seems that message is either scrapped twice from Instagram

Could this happen if I paste the contents of InstagramHelper.js twice on my console?

if you can confirm that the data is stored ni JSON is multiple times same data

Yes, I checked my JSON file too before requesting help here. It had 2 copies of each text. Here is my JSON file 👇🏻

{
    "myUserId": "223XXXXXXX",
    "allMessagesItemsArray": [
    {
        "item_id": "2982503795488224850047994216XXXXXXX",
        "user_id": 203XXXXXXX,
        "timestamp": 1616818547257298,
        "item_type": "link",
        "link":
        {
            "text": "Thanks for getting in touch.. . \n\n[SHARED LINK]\n\nFor support Call 98xxxxxxxx",
            "link_context":
            {
                "link_url": "[SHARED LINK]",
                "link_title": "[LINK TITLE]",
                "link_summary": "[SUMMARY TEXT]",
                "link_image_url": "https://external.xx.fbcdn.net/safe_image.php?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            },
            "client_context": "678142848894XXXXXXX",
            "mutation_token": "678142848894XXXXXXX"
        },
        "client_context": "678142848894XXXXXXX",
        "show_forward_attribution": false,
        "is_shh_mode": false
    },
    {
        "item_id": "2982483146496706343089072552XXXXXXX",
        "user_id": 223XXXXXXX,
        "timestamp": 1616807353416566,
        "item_type": "text",
        "text": "Wanna xxxxx xxxx xxxxx?",
        "client_context": "678138154703XXXXXXX",
        "show_forward_attribution": false,
        "is_shh_mode": false
    },
    {
        "item_id": "2982503795488224850047994216XXXXXXX",
        "user_id": 203XXXXXXX,
        "timestamp": 1616818547257298,
        "item_type": "link",
        "link":
        {
            "text": "Thanks for getting in touch.. . \n\n[SHARED LINK]\n\nFor support Call 98xxxxxxxx",
            "link_context":
            {
                "link_url": "[SHARED LINK]",
                "link_title": "[LINK TITLE]",
                "link_summary": "[SUMMARY TEXT]",
                "link_image_url": "https://external.xx.fbcdn.net/safe_image.php?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            },
            "client_context": "678142848894XXXXXXX",
            "mutation_token": "678142848894XXXXXXX"
        },
        "client_context": "678142848894XXXXXXX",
        "show_forward_attribution": false,
        "is_shh_mode": false
    },
    {
        "item_id": "2982483146496706343089072552XXXXXXX",
        "user_id": 223XXXXXXX,
        "timestamp": 1616807353416566,
        "item_type": "text",
        "text": "Wanna xxxxx xxxx xxxxx?",
        "client_context": "678138154703XXXXXXX",
        "show_forward_attribution": false,
        "is_shh_mode": false
    }],
    "usersChatParticipants": [
    {
        "pk": 2232XXXXXX,
        "profile_pic_url": "[PROFILE PIC URL]",
        "full_name": "[MY NAME]",
        "username": "[MY USERNAME]"
    },
    {
        "pk": 2039XXXXX,
        "profile_pic_url": "[PROFILE PIC URL]",
        "full_name": "[PARTICIPANT'S NAME]",
        "username": "[PARTICIPANT'S USERNAME]"
    }]
}

One observation regarding viewer, after choosing JSON file if I keep clicking Load button, it appends the JSON data below the already loaded data (i.e. it doesn't overwrite the viewer's contents). So, if I have to load a different JSON file first I need to reload the tab and then choose the new JSON file click on Load.

Off-topic: I just realized that the "text" node inside "link" node is not displayed in viewer. Could you maybe please look into that too?

Deleora commented 3 years ago

I haven't tried but what all types of DMs can this script download (e.g. media files, posts, reels, etc.)?

This script extracts every type of message from Instagram from a chat thread, but the viewer displays only following types of data:

        [
            "text",
            "link",
            "media_share",
            "clip",
            "media"
        ];

Okay, got it.

One thing btw, when I tried to download a DM which had a shared photo, I got a pop-up to "allow download of multiple files" (and I gave the permission) but there was only JSON file in my Downloads folder. So if the browser didn't download the photo I had shared in DM, why did I get that pop-up? Or the photo was downloaded to some other temp folder? I'm confused, you have any idea what happened there?

pishangujeniya commented 3 years ago

"allow download of multiple files"

@Deleora Ignore this, it is correct behaviour, browser shows that popup, because it the file is generated using a code, and is programmatically hit download action so browser asks for permission.

The script will download only 1 .json file.

NOTE: Privately Shared Media files, are not scrapped or able to download as a part of DM. I will think of this feature also, if possible.

pishangujeniya commented 3 years ago

@Deleora Try with latest release 1.9