Your question is, how to extract a page from another profile and paste it into yours?
I don't believe I understand:
Let's try to sort this.
#1 Someone comes to your server (from Google or a link or entering a webpage address directly) and give you his Instagram handle (in a form?)
#2 Your server opens the profile, extracts the link and redirects the user there.
Why would you want to do this? This is the users own link? Surely he could click on it??? Or do you just want to analyze his page?
Or do you mean this:
#1 Someone clicks a link in an instagram profile that links to your server (multiple bios with unique URLs, but on one domain)
#2 You extract the unique part of the URL and redirect the user there.
Effect: You can use one prelander for hundreds of profiles, don't need to set up hundreds of pages and redirects
This would make sense, but has nothing to do with any html in Instagram: your server gets a request with the full URL and can easily redirect, but wouldn't (need to) know the users' Instagram account handle.
Or is it yet something else?
Its quite easy, get the instagram user page html using php, python, etc and then use regex to extract the link.
I don't have lots of experience with regular expressions but the following pattern seems to work: <a class="_ng0lj" ([^>]+)>(.+?)<\/a>
@mnunes532 I'm getting it all wrong, fine. So please enlighten me. Really, I've invested some time thinking into what the hell he'd like to achieve.
I'd very much appreciate someone telling me in straight terms what this is for. Because your code isn't any revelation either. It just extracts a link from a bio. But WHAT FOR????
What type of programing language are you using? let me know and I can help
you build a regular expression for that language.
Code:What is Regex: https://www.regular-expressions.info/ https://www.regexmagic.com/ https://www.regexbuddy.com/
@Start Earning you are getting it all wrong...
@manpreet if you have hosting with php, you can use php code. https://pastebin.com/MzG9EqRh
That's super simple coding, I'm not doing any checks (if user has link in bio, if request fails, etc)
i agree, I want to know what he wants to be able to help him. the story he told us is totally confusing and therefore we cannot help him.
I don't think he has a regex problem (which you solved for him), because he could have simply said "what's the right regex to extract the target url from. ... in Python/JS/PHP".
So I believe he will not get a meaningful answer until he defines his problem clearly
Of course I'm curious, but I can also be helpful if I'm asked straight out.
Here's a working php code: https://pastebin.com/NdrsAws3
$default_redirect_link is where they will be redirected to in case some error occurs or the instagram user doesn't have a link in bio. You could do something else, its up to you.
Right now it works this way: you upload it to your server and then call the file like this: domain.com/filename.php?profile=usernamehere and it will redirect the visitor to the proper page. If you want to use javascript instead to take care of redirect, you can replace header("Location......" with
echo $external_url;
and
echo $default_redirect_link;
and then take care of stuff in javascript side.
Thanks again bro. I've used the pastebin coding there must be an issue or something it only redirects me to instagram and not url from bio. Perhaps it's how I'm doing it. Anyway I'll try building on it. Thanks again
works for me when I try katyperry username. Replace the line
$profile = $_GET['profile'];
with
$profile = "katyperry";
and try again
Gotcha,
replace
$external_url = $json_data->entry_data->ProfilePage[0]->graphql->user->external_url;
with
$external_url = $json_data->entry_data->ProfilePage[0]->graphql->user->external_url_linkshimmed;