facebook rss - how to increase thumbs image size?

拟墨画扇 提交于 2020-01-02 04:12:10

问题


I'm accessing a facebook-rss through

http://www.facebook.com/feeds/page.php?format=rss20&id=...

Update: Actual URL:

http://www.facebook.com/feeds/page.php?format=rss20&id=170589069647190

However, the thumbs for the images are way to small. Is it possible to change the size of the tumbs with rss-arg or FB-page setting?

(or should I get the FB-posts in another way)

regards,


回答1:


You should use the Facebook Graph API for this, it's far more robust, versatile, and better maintained.

  1. Start at the /PAGE_ID/feed endpoint, so in your example /170589069647190/feed. (Play around in the explorer to test it) Great, now you have the same list of posts as that RSS feed. Note that each post with a photo has an object_id field.
  2. For each object_id, go to the endpoint /OBJECT_ID?fields=images,height,width,source. If you're doing multiple of them, it's best to batch them together for efficiency

Those 2 simple steps will give you this data for each photo status update. The outside height,width and source are the orginial upload dimensions and source. But the images array provides you with a bunch of resized images. Choose the one most appropriate for your needs.

{
  "images": [
    {
      "height": 2048, 
      "width": 1365, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s2048x2048/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 960, 
      "width": 640, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 720, 
      "width": 480, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s720x720/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 600, 
      "width": 400, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s600x600/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 480, 
      "width": 320, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s480x480/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 320, 
      "width": 213, 
      "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s320x320/599910_508618522510908_1608434210_n.jpg"
    }, 
    {
      "height": 270, 
      "width": 180, 
      "source": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/599910_508618522510908_1608434210_a.jpg"
    }, 
    {
      "height": 130, 
      "width": 86, 
      "source": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/599910_508618522510908_1608434210_s.jpg"
    }, 
    {
      "height": 130, 
      "width": 86, 
      "source": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/s75x225/599910_508618522510908_1608434210_s.jpg"
    }
  ], 
  "height": 720, 
  "width": 480, 
  "source": "https://sphotos-b.xx.fbcdn.net/hphotos-snc7/s720x720/599910_508618522510908_1608434210_n.jpg", 
  "id": "508618522510908", 
  "created_time": "2013-03-04T11:05:09+0000"
}

NOTE: In order to do this on the fly, you'll need to a App Access Token.




回答2:


Disclaimer: This is not a good method as Facebook may change the image path anytime.

That been said, for every image with this file name format: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_s.jpg

You can change the letter "s" just before the ".jpg" to "n" and get a bigger version like so: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_n.jpg

Changing it to "q" will give you an image with a width of no more then 180 pixels XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_q.jpg



来源:https://stackoverflow.com/questions/14934385/facebook-rss-how-to-increase-thumbs-image-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!