Skip to content

Profile picture download from Instagram #5702

Description

@tobiasff3200

Describe the bug

The download of profile pictures from Instagram is not working for my setup.
While testing the code locally, I discovered that the Instagram page does not fit to the code and has probably changed. But the link to the profile picture is still present on the page.
The easiest way to get it is the regex: /"profile_pic_url":\s?"(.*)",/U
With that I was able to extract the URL and get the image.

Steps to reproduce

Download page

$url = "https://www.instagram.com/{username}/\?__a\=1";
$options = array('http' => array('user_agent' => 'Googlebot / 2.1'));
$context = stream_context_create($options);
$result = file_get_contents($url,false, $context);

extract URL with preg_match
Check URL in browser

Expected behavior

The profile picture gets extracted.

Actual behavior

The profile picture is not extracted.

Contact version

8.8.0 / main branch

Operating system

Ubuntu Server

PHP engine version

PHP 8.3

Web server

Nginx

Database

MySQL

Additional info

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions