Is it possible to manipulate the likes of a facebook image? - javascript

We are creating a website based on images. Those images are uploaded on a facebook page too. I managed to get the albums, the images inside them and the likes that they have through Facebook Graph API. I'm using javascript to fetch all these urls and json to parse all the responses.
We could not found a way to get a like button or create one of our own that could manipulate the likes of each image and change them on facebook too.
I dig through Graph docs, i tried use the social plugin with urls like that https://graph.facebook.com/ but the results from json that fb graph gives ( witch are the true ones checked with the images ) are different from those in social plug in.
I'm not posting any code because i do not thing it is needed. But if someone need more details or code please feel free to ask.
I can use only Javascript for this task server side scripting not allowed.
Sorry for my enlgish, thanks in advance.

Well, if you have a look at the docs at https://developers.facebook.com/docs/plugins/like-button/ you could see that the URLs need to be some "public" URL, i.e. the "link" field of a photo object (as of https://developers.facebook.com/docs/graph-api/reference/photo).

Related

How do I allow users to create new pages and save them serverside?

I am currently building a personal wiki and I'm having difficulty in creating new article pages without coding them or pasting a blank template.
I've tried DOMImplementation but it's not quite what I'm after, I just want to be able to press a button and a new page is created serverside which I can write in and save, I've looked around on the internet a lot but I keep going in circles.
If anyone can point me in the right direction or show me how that would be awesome.
I also have another problem of including a link to the new file on the index but I could try to sort that out on my own.
Any help is greatly appreciated, thanks.
What you are looking for is probably dynamic pages.The general idea is:
You provide an interface on the frontend for the user to type in the content of the page.
When the content is submitted to the backend, it is saved to a database and it's id is returned for someone to visit the page later on.
On the backend, you create a new endpoint that expects an id, with said id, you query the database and get the contents saved previously.
This fetched content is used to populate a html template and this html is returned as the response to the frontend

How to import data from website and use it in my web page using JS?

I want to use particular data of some website and show it my webpage.
I wanted to make an web article about the best Youtube Channels. Surely I have to write information about these channel.
For example, There is a youTube channel called "Example" and this channel has url like:
https://www.youtube.com/user/justforexample
I need amount of subscribers of it. In page source, it is inside tag:
<yt-formatted-string id="subscriber-count" class="style-scope ytd-c4-tabbed-header-renderer">4.5M subscribers</yt-formatted-string>
(actually i dont know if there is tag like that but tag maybe not only , it maybe <span> or <div>)
What I want is numbers. It should be in real time.
For instance, in 2020 this channel has 4.5M subscribers, after few years it turn out to be 5.8M.
Above was just example, it may not be only Youtube page, any website.
I know JS and jQuery and hope you help me :)
Thank you
Try sending an HTTP GET request to that url
Read about jQuery ajax function for more information: https://api.jquery.com/jquery.ajax/
Note that additional headers might be needed, try and analyze the response

How do I show a standard card on Alexa Echo show using Lambda?

I'm a student so I'm quite new to this :p
I have created a code to create a conversation between a client and Alexa. However I want to show pictures during a conversation.
E.g
User says "I want to a map from the zoo." .
Alexa confirms it by saying "Do you want a map from the zoo?".
User says "yes".
Alexa then shows a map of the zoo.
My problem is that I am unable to make the standard card to show the image of the zoo. I am using Amazon S3 to make the image address and I have already made it public.
Is there a code or any way to allow my code to show the standard card with the map on it? I am using Lambda to make my code.
Any help would be appreciated!
You can utilize Alexa Body Templates to display images as well.
These templates have designs to include you place images in various styles.
Templates Reference:
https://developer.amazon.com/docs/custom-skills/display-template-reference.html
After logging into developer.aamazon.com, you can view the below link which has more references
https://developer.amazon.com/alexa/console/ask/displays
Hope this helps !!

Accessing the number of likes in shares of an image from a Facebook page

Okay so what I'm looking for is very specific:
I'm trying to access the number of likes, on each share, of an image that is on a facebook page.
In an attempt to draw a relationship of the data I'm trying to access:
[user]-[facebook page (admin)]-[photo]-[page fan]-[shares the photo]-[receives likes on the share]
Bold is the final number of likes I'm trying to reach, not the photo likes. Though managing to get the number of shares on the photo is half way to it.
To further highlight the exact data I'm trying to target, here's a screenshot of it in the built in Facebook page insight https://www.dropbox.com/s/q65c5qsd62qzy0z/Screenshot%202013-10-23%2021.18.57.jpg
The data is accessible if you navigate to the insights of a page you manage, click on the post and then click on the "## shares" under it.
So my question, is it even possible to access this data?
Can FB Graph Explorer provide a JSON response of it?
Any help that would even get me closer is appreciated!
What I tried so far:
First Challenge
Access the needed data
This seems like the closest thing to what I'm trying to do
Is it possible to get the share count for a Page post?
What I did is try to access the image through [pageid_postid], using the read_insight permission with an access token for the page as instructed by the Facebook documentation at https://developers.facebook.com/docs/reference/api/insights/
I've gotten a page access token by doing: using the Graph API Explorer, generate a user access token for manage_pages and read_insights, then issue /[user_id]/accounts in the Graph API prompt, which responds with a list of pages under the account with their access tokens, then click the page ID, insert the page access token in the access token field, and query for [page_id]/insights. (source: Facebook Access Token for Pages)
I still can't seem to manage to get to the number of shares, of a photo..
Some of the many GET queries I've tried..
/[page_id]_[post_id]/insights
/[page_id]_[post_id]/insights/post_stories
/[page_id]_[post_id]/insights/shares
I've also tried some old FQL methods I found around stackoverflow
More info:
I've pretty much taken this as challenge to and would like to see if it's achievable, the number of shares is expected to rise by folds in the next few days so having written a handy javascript for it would be extremely time-saving. Thank you!
Not sure how is it done in javascript but you can get the number of likes on any post using the graph.facebook.com/postid/likes and add a parameter summary with a value 1. If I understand correctly your question.

Updating facebook status with message from a Javascript variable

Is there an easy way to let users update their status on Facebook with a message I have in a JavaScript variable? I know there's a URL you can use to share a link, which looks like:
testlink
That doesn't fill in a status update when it takes them to the share page. Is there a way I can have that pre-filled, or have their status automatically updated?
Thanks!
Edit: Not quite what I'm going for. I can use PHP if necessary (although I have very little experience with it), but I don't want to have to bug users with allowing an application, or have to deal with actually writing a facebook app. I just want to give users a premade status update, so all they have to do is click the 'share' button. Thanks again!
Edit 2: So the api looks promising, but a little complicated for me. It looks like it would involve getting permission from the user to set their status, and possibly something about setting up a cross-communications channel to let my site communicate with facebooks. Assuming I can do that, how do I go about using the Facebook Javascript api? I get the code (user_setStatus looks easy enough), but how do I tell my script that I'm using Facebook's api? Thanks again...again!
Try this:
http://www.facebook.com/connect/prompt_feed.php?&message=my%20awesome%20status
[EDIT]
Link is not working please update it.
Is the facebook javascript API not what you're looking for? It seems to expose the entire REST-ful API as a javascript library.
users_setStatus(...) looks promising.
Not sure if you're using PHP but here's a link that shows you how to use the Facebook API to update the status. You could call a page with Ajax from Javascript, passing in the variable and have that posted to the Facebook status message.
http://fbcookbook.ofhas.in/2009/02/07/facebook-reveals-status-api-how-to-use-it/
Using just mcqwerty solution you'll get an annoying resize screen effect.
But, you can add a parameter in order to avoid this flickering. Display touch will avoid this.
https://www.facebook.com/connect/prompt_feed.php?display=touch&message=Hiall
Here is working example which requires application ID, but fully working and it is easy to implement:
<a href="http://www.facebook.com/dialog/feed?app_id=123050457758183&link=http://www.build.server.com&picture=http://fbrell.com/f8.jpg&
name=Some%20Encoded&Message=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=https://arapskirjecnik.web44.net/"> Share with FB</a>
see more here
here is the way which works and it doesn't requires facebook application id:
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=Title&p[summary]=summary&p[url]=www.build.server.com&p[images][0]=http://fbrell.com/f8.jpg','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">Insert text or an image here.</a>
As you can see from above code you can enter custom title, summary, link and images.
and if you want to automate, to share current link, youst replace this part of the code in upper example:
p[url]='+ document.URL +'&p[images]

Categories

Resources