LinkedIn r_liteprofile 没有提供 public url 和头像

LinkedIn r_liteprofile doesn't give the public url and profile picture

LinkedIn 对其 V2 API 进行了一些更改以接收用户数据。

我将范围设置为 r_liteprofile 并使用 /v2/me 端点。

我添加的是:me?projection=(id,firstName,lastName)。 这让我获得了给定的基本个人资料详细信息。

但我还想要的是:

这可以通过 r_basicprofile 完成,但我不知道如何申请此“基础”个人资料信息。

有什么帮助吗?

或者我可以根据 ID r_liteprofile returns 获取 Linkedin Public URL 和个人资料照片吗?

个人资料照片URL

这个很简单。只需在投影中使用 profilePicture.displayImage 参数,如下所示。它将提供有关图片的完整信息:

https://api.linkedin.com/v2/me?projection=(profilePicture(displayImage~:playableStreams))

输出类似于此 - 这是我的用户的输出:

{
   "profilePicture":{
      "displayImage":"urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg",
      "displayImage~":{
         "paging":{
            "count":10,
            "start":0,
            "links":[
               
            ]
         },
         "elements":[
            {
               "artifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_100_100)",
               "authorizationMethod":"PUBLIC",
               "data":{
                  "com.linkedin.digitalmedia.mediaartifact.StillImage":{
                     "mediaType":"image/jpeg",
                     "rawCodecSpec":{
                        "name":"jpeg",
                        "type":"image"
                     },
                     "displaySize":{
                        "width":100.0,
                        "uom":"PX",
                        "height":100.0
                     },
                     "storageSize":{
                        "width":100,
                        "height":100
                     },
                     "storageAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     },
                     "displayAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     }
                  }
               },
               "identifiers":[
                  {
                     "identifier":"https://media-exp1.licdn.com/dms/image/C4E03AQELiWnd6svKQg/profile-displayphoto-shrink_100_100/0/1612809737178?e=1622678400&v=beta&t=NCZOUXQokOyX5GN98uI2b4P90hg8h0QPgWQkq3qGLM",
                     "index":0,
                     "mediaType":"image/jpeg",
                     "file":"urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_100_100,0)",
                     "identifierType":"EXTERNAL_URL",
                     "identifierExpiresInSeconds":1622678400
                  }
               ]
            },
            {
               "artifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_200_200)",
               "authorizationMethod":"PUBLIC",
               "data":{
                  "com.linkedin.digitalmedia.mediaartifact.StillImage":{
                     "mediaType":"image/jpeg",
                     "rawCodecSpec":{
                        "name":"jpeg",
                        "type":"image"
                     },
                     "displaySize":{
                        "width":200.0,
                        "uom":"PX",
                        "height":200.0
                     },
                     "storageSize":{
                        "width":200,
                        "height":200
                     },
                     "storageAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     },
                     "displayAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     }
                  }
               },
               "identifiers":[
                  {
                     "identifier":"https://media-exp1.licdn.com/dms/image/C4E03AQELiWnd6svKQg/profile-displayphoto-shrink_200_200/0/1612809737178?e=1622678400&v=beta&t=EQsuIgcg7fE7eyjNbKdTQN5Iq29WogIii_B_ABusiDw",
                     "index":0,
                     "mediaType":"image/jpeg",
                     "file":"urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_200_200,0)",
                     "identifierType":"EXTERNAL_URL",
                     "identifierExpiresInSeconds":1622678400
                  }
               ]
            },
            {
               "artifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_400_400)",
               "authorizationMethod":"PUBLIC",
               "data":{
                  "com.linkedin.digitalmedia.mediaartifact.StillImage":{
                     "mediaType":"image/jpeg",
                     "rawCodecSpec":{
                        "name":"jpeg",
                        "type":"image"
                     },
                     "displaySize":{
                        "width":400.0,
                        "uom":"PX",
                        "height":400.0
                     },
                     "storageSize":{
                        "width":400,
                        "height":400
                     },
                     "storageAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     },
                     "displayAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     }
                  }
               },
               "identifiers":[
                  {
                     "identifier":"https://media-exp1.licdn.com/dms/image/C4E03AQELiWnd6svKQg/profile-displayphoto-shrink_400_400/0/1612809737178?e=1622678400&v=beta&t=9O2L6z2RprkxuHbcwvZk6Y9oy4tb0qerQ538BD6-VR4",
                     "index":0,
                     "mediaType":"image/jpeg",
                     "file":"urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_400_400,0)",
                     "identifierType":"EXTERNAL_URL",
                     "identifierExpiresInSeconds":1622678400
                  }
               ]
            },
            {
               "artifact":"urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_800_800)",
               "authorizationMethod":"PUBLIC",
               "data":{
                  "com.linkedin.digitalmedia.mediaartifact.StillImage":{
                     "mediaType":"image/jpeg",
                     "rawCodecSpec":{
                        "name":"jpeg",
                        "type":"image"
                     },
                     "displaySize":{
                        "width":800.0,
                        "uom":"PX",
                        "height":800.0
                     },
                     "storageSize":{
                        "width":800,
                        "height":800
                     },
                     "storageAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     },
                     "displayAspectRatio":{
                        "widthAspect":1.0,
                        "heightAspect":1.0,
                        "formatted":"1.00:1.00"
                     }
                  }
               },
               "identifiers":[
                  {
                     "identifier":"https://media-exp1.licdn.com/dms/image/C4E03AQELiWnd6svKQg/profile-displayphoto-shrink_800_800/0/1612809737178?e=1622678400&v=beta&t=4QtK4xiiTWkui0HtL1YDF22sXurosKWdXTUOzw0TxiY",
                     "index":0,
                     "mediaType":"image/jpeg",
                     "file":"urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:C4E03AQELiWnd6svKQg,urn:li:digitalmediaMediaArtifactClass:profile-displayphoto-shrink_800_800,0)",
                     "identifierType":"EXTERNAL_URL",
                     "identifierExpiresInSeconds":1622678400
                  }
               ]
            }
         ]
      }
   }
}

个人资料照片 url 可以在每个 identifier 元素旁边找到。

例如,这是 url 之一:

"identifier":"https://media-exp1.licdn.com/dms/image/C4E03AQELiWnd6svKQg/profile-displayphoto-shrink_800_800/0/1612809737178?e=1622678400&v=beta&t=4QtK4xiiTWkui0HtL1YDF22sXurosKWdXTUOzw0TxiY"

LinkedIn Public URL

这基本上是文档中所写的 vanityName 属性 here:

vanityName The vanity name of the member. Vanity name is represented as a string is used for the public profile URL: www.linkedin.com/in/{vanityName}.

但是,如documentation所述,r_liteprofile

只能检索到有限数量的信息

By default, only the Lite Profile Fields are returned for a profile request.

有关精简版配置文件字段的列表,请检查此 page。但是,如果您检查它,您会发现 vanityName 或配置文件 url 不包含在那里。要获得额外的权限,您必须按照文档中的说明请求它们:

To request more or less fields, you must have additional permissions that are only granted to select partners.

因此,您必须成为 select 合作伙伴 才能获得它。