FBCDN image is not allowed in stream …..

             Smart Techie

                We had a requirement to share Facebook image hosted in Facebook CDN back to Facebook by using Facebook streaming API. For example the image which is there in Facebook cdn, if you try to share the same image to Facebook again we may land up seeing an error message “FBCDN image is not allowed in stream”.

What this indicates for us is Facebook won’t allow to share the images hosted in Facebook CDN

Finally we came with a work around to get rid of this problem, i.e to store the Facebook images locally and upload it back.

You can use this code to download the images from image urls and put the image url which this code is returning as part of stream API.

In this code i have used grizzly light weight server with REST API.

To work with this, launch the Main.java and pass the command line arguments as host name/ip address,port and path where the downloaded images need to store .

For example root@local$java Main localhost 9190 /opt/images

Keep in mind the mentioned jars should be in class path. asm-3.3.1.jar, grizzly-framework-2.2.16.jar, grizzly-http-2.2.16.jar, grizzly-http-server-2.2.16.jar, jackson-core-asl-1.8.5.jar, jackson-mapper-asl-1.8.5.jar, jersey-core-1.17.jar, jersey-grizzly2-1.17.jar, jersey-server-1.17.jar, jsr311-api-1.1.1.jar

Now the send request by using the below url <http>://<host name>:9190/image?imageUrl= will be the link to the image.

When the request has processed, you will able to see image under the path you have specified, and you will get the image url back from the server.Like <http>://<host name>:9190/images/13131414.jpg

You can use this url as part of your stream API.

The source code is available at https://github.com/2013techsmarts/Image-Downloader

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

Tagged with: , ,
Posted in Facebook

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

DZone

DZone MVB

Java Code Geeks
Java Code Geeks
%d bloggers like this: