使用谷歌搜索引擎apis寻找名人linkedIn帐户

时间:2016-06-30 05:27:49

标签: python google-api google-search google-search-api

使用google apis寻找名人LinkedIn帐户 - 当我访问下面的链接时,我得到Json看到下面。我使用某种谷歌排名系统获得用户相关但不是我正在寻找的真正的名人。

如何只获取名称为Stevie Wonder的人?确切地说,items.hcard.fn == Stevie Wonder所指的波纹链接没有提供。

https://www.googleapis.com/customsearch/v1?key="YOUR_KEY"&cx="ENGINE_API"&q="search_term&exactTerms="search_term"&siteSearch=linkedin.com&alt=json



{'context': {'title': 'linkdin-search-projecr'},
 'items': [
           {'displayLink': 'www.linkedin.com',
            'formattedUrl': 'https://www.linkedin.com/in/ron-taylor-169a0b72',
            'htmlFormattedUrl': 'https://www.linkedin.com/in/ron-taylor-169a0b72',
            'htmlSnippet': 'During this time I worked exclusively for <b>STEVIE WONDER</b>. His special <br>\nrequirements far exceeds the duties of any other Personal Assistant. I am <br>\npresently his&nbsp;...',
            'htmlTitle': 'RON TAYLOR | LinkedIn',
            'kind': 'customsearch#result',
            'link': 'https://www.linkedin.com/in/ron-taylor-169a0b72',
            'pagemap': {'cse_image': [{'src': 'https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/06b/2ae/35b8ebe.jpg'}],
                        'cse_thumbnail': [{'height': '160',
                                           'src': 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRuIo1ZVj9Z6-CozzsMELKt9zBSfvLIprbzV3FA0owQqpxyTcIlIGL0HJy8',
                                           'width': '160'}],
                        'hcard': [{'fn': 'RON TAYLOR',
                                   'photo': 'https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/06b/2ae/35b8ebe.jpg',
                                   'title': 'EXECUTIVE PERSONAL ASSISTANT, CHIEF OF SECURITY & LOGISTICS to STEVIE WONDER'}],
                        'metatags': [{'application-name': 'LinkedIn',
                                      'appname': 'chrome',
                                      'detectadblock': '//platform.linkedin.com/js/px.js',
                                      'globaltrackingappid': 'webTracking',
                                      'globaltrackingappname': 'chrome',
                                      'globaltrackingurl': '//www.linkedin.com/mob/tracking',
                                      'lnkd-track-json-lib': 'https://static.licdn.com/scds/concat/common/js?h=2jds9coeh4w78ed9wblscv68v-ebbt2vixcc5qz0otts5io08xv',
                                      'msapplication-tilecolor': '#0077B5',
                                      'msapplication-tileimage': 'https://static.licdn.com/scds/common/u/images/logos/linkedin/logo-in-win8-tile-144_v1.png',
                                      'og:description': u"View RON TAYLOR\u2019S professional profile on LinkedIn. LinkedIn is the world's largest business network, helping professionals like RON TAYLOR discover inside connections to recommended job candidates, industry experts, and business partners.",
                                      'og:image': 'https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/06b/2ae/35b8ebe.jpg',
                                      'og:title': 'RON TAYLOR | LinkedIn',
                                      'pageimpressionid': '-d3-a9',
                                      'pagekey': 'public_profile_v3_desktop',
                                      'referrer': 'origin',
                                      'remotenavjscontentbaseurl': 'https://static.licdn.com/scds/concat/common/js?v=build-2000_8_56815-prod',
                                      'treeid': 'wrAWT+5EWxRA29Bh1SoAAA=='}],
                        'person': [{'location': 'United States',
                                    'org': 'STEVLAND MORRIS PRODUCTIONS & WONDERLAND STUDIO',
                                    'role': 'EXECUTIVE PERSONAL ASSISTANT, CHIEF OF SECURITY & LOGISTICS to STEVIE WONDER'}]},
            'snippet': u'During this time I worked exclusively for STEVIE WONDER. His special \nrequirements far exceeds the duties of any other Personal Assistant. I am \npresently his\xa0...',
            'title': 'RON TAYLOR | LinkedIn'}
            ],
 'kind': 'customsearch#search',
 'queries': {'nextPage': [{'count': 10,
                           'cx': '',
                           'exactTerms': 'Stevie Wonder',
                           'inputEncoding': 'utf8',
                           'outputEncoding': 'utf8',
                           'safe': 'off',
                           'searchTerms': 'Stevie Wonder',
                           'siteSearch': 'linkedin.com',
                           'startIndex': 11,
                           'title': 'Google Custom Search - Stevie Wonder',
                           'totalResults': '1590'}],
             'request': [{'count': 10,
                          'cx': '',
                          'exactTerms': 'Stevie Wonder',
                          'inputEncoding': 'utf8',
                          'outputEncoding': 'utf8',
                          'safe': 'off',
                          'searchTerms': 'Stevie Wonder',
                          'siteSearch': 'linkedin.com',
                          'startIndex': 1,
                          'title': 'Google Custom Search - Stevie Wonder',
                          'totalResults': '1590'}]},
 'searchInformation': {'formattedSearchTime': '0.31',
                       'formattedTotalResults': '1,590',
                       'searchTime': 0.313269,
                       'totalResults': '1590'},
 'url': {'template': 'https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json',
         'type': 'application/json'}}

目前我正在获取结果并检查每个fn对象以查看该名称是否与搜索匹配,问题是每次点击google search engine API时它都会花费我$。我想将结果排除在小集之外。对于某些情况,我必须访问大约20页以检查响应中是否存在该名称。我想知道是否有办法只在fn对象中获得具有确切名称的100%正面用户

1 个答案:

答案 0 :(得分:0)

如果响应是响应字典,我想你正在寻找类似下面的内容。当然首先你必须将json转换成dict。

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;