从facebook图表中提取数据的麻烦c#

时间:2014-01-15 21:44:58

标签: c# facebook facebook-graph-api

我正在开发一个导出所有用户公共数据的程序,但图表出现问题,我制作了一个应用程序并获得了所有权限(扩展的配置文件属性权限和扩展权限)来生成访问令牌我用它来提取数据,令我感到困惑的是,有些配置文件会提取其他一些不存在的孔数据,即使它出现在该部分中。

例如:

试图导出我/出口所有数据我有体育教育之乡等。
试图导出朋友/出口的公共数据+体育和没有教育,即使他在关于部分接受教育,它似乎公众或朋友
试图提取我/订阅者显示12个订户是正确的 尝试提取朋友/订阅者显示20个中的12个甚至订户在订户部分中显示为20 我使用以下命令:

 var res = JsonConvert.DeserializeObject<FacebookLikes>(fb.Get(txtUserName.Text + "/likes").ToString());

我希望你理解这个想法,谢谢你的帮助

好的,这里有一个实时测试的问题: 我在你说的工具上尝试了以下内容:

blazzzin/?access_token

结果是:

{
  "id": "100001748944712",
  "name": "Ethan 'blaze' Parker",
  "first_name": "Ethan",
  "middle_name": "'blaze'",
  "last_name": "Parker",
  "link": "https://www.facebook.com/blazzzin",
  "birthday": "02/20",
  "hometown": {
    "id": "102161913158207",
    "name": "Delhi, India"
  },
  "quotes": "You're what you eat. Really? I am an Apple then.",
  "sports": [
    {
      "id": "102173226491776",
      "name": "Soccer"
    },
    {
      "id": "112285278784684",
      "name": "Badminton"
    }
  ],
  "favorite_teams": [
    {
      "id": "138570342846531",
      "name": "WWE Nexus"
    },
    {
      "id": "136759993012177",
      "name": "Delhi Daredevils"
    },
    {
      "id": "42884080673",
      "name": "Uruguay"
    },
    {
      "id": "365383271987",
      "name": "Chelsea FC"
    },
    {
      "id": "151170071595882",
      "name": "Best of wwe"
    },
    {
      "id": "166496596733768",
      "name": "WWE World"
    },
    {
      "id": "19221964237",
      "name": "ECW"
    },
    {
      "id": "31695961025",
      "name": "Impact Wrestling"
    },
    {
      "id": "5985827589",
      "name": "Fnatic"
    },
    {
      "id": "61630257716",
      "name": "University of Cincinnati Bearcats"
    },
    {
      "id": "44027083759",
      "name": "Cincinnati Reds"
    },
    {
      "id": "323348924370835",
      "name": "Wrestling Memes"
    },
    {
      "id": "127573517418762",
      "name": "Veer Marathi"
    },
    {
      "id": "208056762558521",
      "name": "Team Razer"
    },
    {
      "id": "228215007216138",
      "name": "The awkward moment when you go to grab someone sexy and headbutt the mirror"
    },
    {
      "id": "200933243299323",
      "name": "If she's never seen Arsenal win a trophy, she's too young for you Bro"
    },
    {
      "id": "189411184456673",
      "name": "Sanfransisco Giants"
    },
    {
      "id": "210487655659656",
      "name": "Team Bring It vs Team Cenation"
    },
    {
      "id": "146995142049876",
      "name": "Like IF the First THNG You Do WheN You WAKE UP is ROll OVR &CHeCK UR Phone"
    },
    {
      "id": "111507918902981",
      "name": "• WWE Universe | Tunisian Page •"
    }
  ],
  "favorite_athletes": [
    {
      "id": "104023396299513",
      "name": "Andrew Flintoff"
    },
    {
      "id": "545498258812287",
      "name": "Luke Wright"
    },
    {
      "id": "111832475503333",
      "name": "Michael Schumaker"
    },
    {
      "id": "110393655686342",
      "name": "Eddie Alvarez MMA"
    },
    {
      "id": "112941715451427",
      "name": "Maryse"
    },
    {
      "id": "344128252278047",
      "name": "Sachin Tendulkar"
    },
    {
      "id": "179559748752616",
      "name": "Maryse"
    },
    {
      "id": "52911737290",
      "name": "Doraemon"
    },
    {
      "id": "14320933255",
      "name": "Andrew Flintoff"
    },
    {
      "id": "81221197163",
      "name": "Cristiano Ronaldo"
    },
    {
      "id": "136644946409767",
      "name": "Mahmoud's charity run from Melbourne to Sydney"
    },
    {
      "id": "42888741032",
      "name": "R-Truth - WWE Universe"
    },
    {
      "id": "203402113048458",
      "name": "Abby Marie Johnson WBFF Bikini 2014 Competitor"
    },
    {
      "id": "270759951686",
      "name": "JASON DAVID FRANK - Official Fan Page"
    },
    {
      "id": "110336188978264",
      "name": "AJStyles.Org"
    },
    {
      "id": "8707340185",
      "name": "Edge - WWE Universe"
    },
    {
      "id": "298344150293189",
      "name": "Fandango - WWE"
    },
    {
      "id": "195569370462754",
      "name": "William Regal: A Tribute To An Underrated Legend"
    },
    {
      "id": "173741199368967",
      "name": "Steve Moriarty"
    },
    {
      "id": "12714756642",
      "name": "Fedor Emelianenko"
    },
    {
      "id": "212481352152206",
      "name": "Arkan Taha Fitness"
    },
    {
      "id": "160505357316902",
      "name": "Lexi Thompson"
    },
    {
      "id": "10035000964",
      "name": "The Great Khali - WWE Universe"
    },
    {
      "id": "176063032413299",
      "name": "Leo Messi"
    },
    {
      "id": "65920772679",
      "name": "Maria Sharapova"
    },
    {
      "id": "226790007363705",
      "name": "Divas - WWE UNiVERSE"
    },
    {
      "id": "175535596516",
      "name": "Sabine Lisicki"
    },
    {
      "id": "415063578542561",
      "name": "Eddie Guerrero"
    },
    {
      "id": "157829220895967",
      "name": "Kaitlyn - WWE Universe"
    },
    {
      "id": "122046337858201",
      "name": "WWE Maryse Ouellet"
    },
    {
      "id": "185950250927",
      "name": "Brock Lesnar"
    },
    {
      "id": "8164128018",
      "name": "Layla - WWE Universe"
    },
    {
      "id": "110108465743414",
      "name": "PUSH EVAN BOURNE"
    },
    {
      "id": "115647961808394",
      "name": "We love Evan Bourne"
    },
    {
      "id": "105683519512165",
      "name": "Sin Cara - WWE"
    },
    {
      "id": "125557244171559",
      "name": "Rikishi"
    },
    {
      "id": "8457822873",
      "name": "CM Punk - WWE Universe"
    }
  ],
  "inspirational_people": [
    {
      "id": "17774451468",
      "name": "Mr. Bean"
    },
    {
      "id": "9972312428",
      "name": "The Miz - WWE Universe"
    },
    {
      "id": "103107176396108",
      "name": "CM Punk"
    },
    {
      "id": "10392229299",
      "name": "Gurbaksh Chahal"
    }
  ],
  "education": [
    {
      "school": {
        "id": "424030284317485",
        "name": "HarvardX"
      },
      "year": {
        "id": "120960561375312",
        "name": "2013"
      },
      "concentration": [
        {
          "id": "108146682539885",
          "name": "Justice"
        }
      ],
      "type": "College"
    },
    {
      "school": {
        "id": "102052863223529",
        "name": "TGC Animation and Multimedia"
      },
      "year": {
        "id": "120960561375312",
        "name": "2013"
      },
      "concentration": [
        {
          "id": "199849176695930",
          "name": "Web Design & Development"
        },
        {
          "id": "109803049037749",
          "name": "Graphic Design"
        }
      ],
      "type": "College"
    }
  ],
  "gender": "male",
  "relationship_status": "In a relationship",
  "significant_other": {
    "name": "Hailey Hayden",
    "id": "100006853479540"
  },
  "website": "http://www.varunpuri.me

",
  "locale": "en_US",
  "languages": [
    {
      "id": "106059522759137",
      "name": "English"
    },
    {
      "id": "113301478683221",
      "name": "American English"
    },
    {
      "id": "112969428713061",
      "name": "Hindi"
    },
    {
      "id": "110343528993409",
      "name": "Spanish"
    },
    {
      "id": "105606752807048",
      "name": "Punjabi"
    },
    {
      "id": "107672419256005",
      "name": "Dutch"
    }
  ],
  "updated_time": "2014-01-05T16:49:55+0000",
  "username": "blazzzin"
}

我在另一个朋友那里尝试过,而且朋友有所有数据公开示例工作和教育(我可以在约一节中看到它们)

khalil.bsaibes/?access_token

结果是:

{
  "id": "806750229",
  "name": "Khalil G. Bsaibes",
  "first_name": "Khalil",
  "middle_name": "G.",
  "last_name": "Bsaibes",
  "link": "https://www.facebook.com/khalil.bsaibes",
  "location": {
    "id": "106188806084417",
    "name": "Beirut, Lebanon"
  },
  "gender": "male",
  "locale": "en_US",
  "updated_time": "2014-01-12T09:39:29+0000",
  "username": "khalil.bsaibes"
}

那么你能解释一下我发生了什么以及如何解决它吗?

1 个答案:

答案 0 :(得分:0)

如果您尝试访问其信息的用户未将某些信息公开,该怎么办?

您可以使用以下工具进行调试,方法是放入访问令牌和查询,并查看返回的json是什么。如果它只返回12个订阅者,那么你应该检查权限,如果它返回20,那么重新检查你的代码和解析方法..

https://developers.facebook.com/tools/explorer/