How can I get everything I like for all the URLs in my domain?

I have a website with tons of product pages, and each page has a button. Is there a way to get a list of all my favorite domain URLs from Facebook?

Currently, I need to make a loop that requests a page from the .facebook.com chart and checks the number of likes. It ends with upp with several thousand requests and is really bad. You can add multiple URLs to the same facebook request, but it still changes little.

+3
source share
1 answer

Turn your list of urls into an array and run api as a batch job

docs http://developers.facebook.com/docs/reference/api/batch/

curl \
    –F 'access_token=…' \
    -F 'batch=[ \
            {"method": "GET", "relative_url": "?id=URL1"}, \
            {"method": "GET", "relative_url": "?id=URL2"}, \
            {"method": "GET", "relative_url": "?id=URL3"}, \
            {"method": "GET", "relative_url": "?id=URL4"}, \
            {"method": "GET", "relative_url": "?id=URL5"} \
        ]'\
    https://graph.facebook.com

fql link_stat

curl \
     -F 'access_token=…' \
     -F 'batch=[ \
{ "method": "POST", "relative_url": "method/fql.query?query=select+like_count+from+link_stat+where+url+in("url1","url2","url3","url5","url6")", }, \
{ "method": "POST", "relative_url": "method/fql.query?query=select+like_count+from+link_stat+where+url+in("url7","url8","url9","url10","url11")", } \
]'\
https://graph.facebook.com
+1

Source: https://habr.com/ru/post/1785434/


All Articles