我想使用图表获取大型facebook视频缩略图。下面的代码获取小缩略图
https://graph.facebook.com/VIDEO_ID/picture
此代码将返回Ex:
https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632393_10151574602254838_10151574598089838_34404_282_t.jpg
如果我用“n”替换“t”,我将得到大图像
https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632393_10151574602254838_10151574598089838_34404_282_n.jpg
但是如何使用facebook图表获取它或使用php
将“t”替换为“n”提前致谢。
答案 0 :(得分:2)
你可以使用这个PHP代码,它适用于我。
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject35
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestSuccessParse()
{
HttpResponseCode parsedHttpCode = HttpResponseCode.Unknown;
parsedHttpCode.TryParse(200, out parsedHttpCode);
Assert.AreEqual(parsedHttpCode, HttpResponseCode.Success);
}
[TestMethod]
public void TestServerErrorParse()
{
HttpResponseCode parsedHttpCode = HttpResponseCode.Unknown;
parsedHttpCode.TryParse(500, out parsedHttpCode);
Assert.AreEqual(parsedHttpCode, HttpResponseCode.AllServerErrors);
}
}
public enum HttpResponseCode
{
Unknown = 0,
Success = 200,
MissingParameter = 400,
//etc...
AllServerErrors = -1,
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
//etc..
}
public static class EnumExtensions
{
public static void TryParse(this HttpResponseCode theEnum, int code, out HttpResponseCode result)
{
if (code >= 500 && code <= 599)
{
result = HttpResponseCode.AllServerErrors;
}
else
{
result = (HttpResponseCode)Enum.Parse(typeof(HttpResponseCode), code.ToString());
}
}
}
}