Home > Blockchain >  How to get username of Instagram account
How to get username of Instagram account

Time:07-14

I want to know how I can print the username of the Instagram account by the link the user will provide using python. Image attached for better understanding.

enter image description here

CodePudding user response:

As you mentioned, the Instagram link should be something like this:

link = "https://www.instagram.com/instagram"

What you can do, is split the string using / as separator, which turns it into a list, and from there get the last value of it:

username = link.split('/')[-1]

CodePudding user response:

let url = "https://instagram.com/username".split("/")
let username = url[url.length - 1]
  • Related