Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User script download same media despite it shouldn't #54

Open
sn-o-w opened this issue Nov 29, 2023 · 2 comments
Open

User script download same media despite it shouldn't #54

sn-o-w opened this issue Nov 29, 2023 · 2 comments

Comments

@sn-o-w
Copy link
Contributor

sn-o-w commented Nov 29, 2023

@y252328 @Patty-OFurniture

Something is wrong with one of your recent commits. Have a look: https://youtu.be/YVPzZcLqOL0

Steps to reproduce:

  1. Copy the URL of any post and paste it into a new tab.
  2. Once the page has loaded in the new tab, go to the author's profile page.
  3. Choose any picture and download it.
  4. From that post page, choose any other account.
  5. Download another photo.
  6. You simply downloaded the same image you downloaded before, but with the filename slightly updated to include the other account name.

This didn't happen on v1.17.10.

@sn-o-w
Copy link
Contributor Author

sn-o-w commented Nov 30, 2023

Looks like the issue is caused by method 2 which was introduced in this commit: 7b114cc

I commented out the lines of method 2, and the issue seems to be gone.

@sn-o-w
Copy link
Contributor Author

sn-o-w commented Nov 30, 2023

@y252328 According to the commit message of 7b114cc, that method is supposed to run for some stories. Therefore, the second method shouldn't be something like this?!

let scriptJson = document.querySelectorAll('script[type="application/json"]');
for (let i = 0; i < scriptJson.length; i++) {
    if (window.location.href.match(/www.instagram.com\/stories\/[^\/]+\/(\d+)/)) {
        let match = scriptJson[i].text.match(/"pk":"(\d+)","id":"[\d_]+"/);
        if (match) return match[1];
    }
}

I tested this, and it looks like it doesn't trigger my reported issue. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant