Search code examples
pythonurldecodedecoding

Getting Facebook original image url


I want to get the the original picture out of this Facebook link:

https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCPdu0qFIMkMPGN&w=470&h=246&url=https%3A%2F%2Fscontent-lax3-1.xx.fbcdn.net%2Fhphotos-xfp1%2Fv%2Ft1.0-9%2F12705743_10153625263299678_1238692121976712825_n.jpg%3Foh%3D0f330b83cd6f52cba12b06ea141af571%26oe%3D5723078F&cfs=1&upscale=1&sx=1&sy=0&sw=558&sh=292&ext=png2jpg

What I usually do is get the value of url parameter and decode it to get the S3 link. The result of applying this to this link is

https://scontent-lax3-1.xx.fbcdn.net/hphotos-xfp1/v/t1.0-9/12705743_10153625263299678_1238692121976712825_n.jpg

But it gives me 403 response. How should I obtain the link of the original photo?


Solution

  • It works for me. I copied the url value of your first link and everything to the right into this online decoder:

    http://meyerweb.com/eric/tools/dencoder/

    And obtained:

    https://scontent-lax3-1.xx.fbcdn.net/hphotos-xfp1/v/t1.0-9/12705743_10153625263299678_1238692121976712825_n.jpg?oh=0f330b83cd6f52cba12b06ea141af571&oe=5723078F&cfs=1&upscale=1&sx=1&sy=0&sw=558&sh=292&ext=png2jpg

    Which works fine.

    Apparently the oh and oe parameter are essential. Here the minimal working link:

    https://scontent-lax3-1.xx.fbcdn.net/hphotos-xfp1/v/t1.0-9/12705743_10153625263299678_1238692121976712825_n.jpg?oh=0f330b83cd6f52cba12b06ea141af571&oe=5723078F