linkedin v2 api:如何使用“装饰”获取所有公司图片的网址?

时间:2019-07-17 01:37:39

标签: linkedin linkedin-api

通过阅读LinkedIn doc,我可以看到端点如何获取所有公司的图像URL,但是,当我执行请求时,我的响应为空。

我试图做这样的事情,作为文档:

https://api.linkedin.com/v2/organizations/{organization_id}?projection=(elements(*(logoV2(original~:playableStreams))))

我的回复状态等于200,但正文为空。

我尝试了另一个请求,如下所示:

https://api.linkedin.com/v2/organizations/{organization_id}?projection=(logoV2(original~:playableStreams(elements*(*))))

对于此请求,我得到了完整的答复,但有很多过时的键(针对我的具体情况),请参见下文:

    {
        "logoV2": {
            "original": "urn:li:digitalmediaAsset:{XXXXX}",
            "original~": {
                "elements": [
                    {
                        "artifact": "artifact",
                        "authorizationMethod": "PUBLIC",
                        "data": {
                            "com.linkedin.digitalmedia.mediaartifact.StillImage": {
                                "storageSize": {
                                    "width": 200,
                                    "height": 200
                                },
                                "storageAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                },
                                "mediaType": "image/jpeg",
                                "rawCodecSpec": {
                                    "name": "jpeg",
                                    "type": "image"
                                },
                                "displaySize": {
                                    "uom": "PX",
                                    "width": 200,
                                    "height": 200
                                },
                                "displayAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                }
                            }
                        },
                        "identifiers": [
                            {
                                "identifier": "https://media.licdn.com/dms/image/XXXXX/company-logo_200_200/0?e=1571270400&v=beta&t=eVjuwPVexlRBe0NPUTHEO8hryrgqp6052Y8zQ1_kT0I",
                                "file": "urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:XXXXX,urn:li:digitalmediaMediaArtifactClass:company-logo_200_200,0)",
                                "index": 0,
                                "mediaType": "image/jpeg",
                                "identifierType": "EXTERNAL_URL",
                                "identifierExpiresInSeconds": 1571270400
                            }
                        ]
                    },
                    {
                        "artifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:{XXXXX},urn:li:digitalmediaMediaArtifactClass:company-logo_100_100)",
                        "authorizationMethod": "PUBLIC",
                        "data": {
                            "com.linkedin.digitalmedia.mediaartifact.StillImage": {
                                "storageSize": {
                                    "width": 100,
                                    "height": 100
                                },
                                "storageAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                },
                                "mediaType": "image/jpeg",
                                "rawCodecSpec": {
                                    "name": "jpeg",
                                    "type": "image"
                                },
                                "displaySize": {
                                    "uom": "PX",
                                    "width": 100,
                                    "height": 100
                                },
                                "displayAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                }
                            }
                        },
                        "identifiers": [
                            {
                                "identifier": "https://media.licdn.com/dms/image/XXXXX/company-logo_100_100/0?e=1571270400&v=beta&t=gboBNTGxwMSDjV7tltXLHjVUdWCusT_ZpnUTj7qirOo",
                                "file": "urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:XXXXX,urn:li:digitalmediaMediaArtifactClass:company-logo_100_100,0)",
                                "index": 0,
                                "mediaType": "image/jpeg",
                                "identifierType": "EXTERNAL_URL",
                                "identifierExpiresInSeconds": 1571270400
                            }
                        ]
                    },
                    {
                        "artifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:XXXXX,urn:li:digitalmediaMediaArtifactClass:company-logo_400_400)",
                        "authorizationMethod": "PUBLIC",
                        "data": {
                            "com.linkedin.digitalmedia.mediaartifact.StillImage": {
                                "storageSize": {
                                    "width": 400,
                                    "height": 400
                                },
                                "storageAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                },
                                "mediaType": "image/jpeg",
                                "rawCodecSpec": {
                                    "name": "jpeg",
                                    "type": "image"
                                },
                                "displaySize": {
                                    "uom": "PX",
                                    "width": 400,
                                    "height": 400
                                },
                                "displayAspectRatio": {
                                    "widthAspect": 1,
                                    "heightAspect": 1,
                                    "formatted": "1.00:1.00"
                                }
                            }
                        },
                        "identifiers": [
                            {
                                "identifier": "https://media.licdn.com/dms/image/XXXXX/company-logo_400_400/0?e=1571270400&v=beta&t=2N6F95evYzuftbvsW36PGaGl1z1Bmf-U7AZ5XiuPvlY",
                                "file": "urn:li:digitalmediaFile:(urn:li:digitalmediaAsset:XXXXX,urn:li:digitalmediaMediaArtifactClass:company-logo_400_400,0)",
                                "index": 0,
                                "mediaType": "image/jpeg",
                                "identifierType": "EXTERNAL_URL",
                                "identifierExpiresInSeconds": 1571270400
                            }
                        ]
                    }
                ]
            }
        }
    }

有什么办法可以通过修饰来过滤我的回复,以获取唯一的图片网址?

0 个答案:

没有答案