【问题标题】:Look for celebrities linkedIn accounts using google search engine apis使用 google 搜索引擎 api 查找名人 linkedIn 帐户
【发布时间】:2016-06-30 13:47:39
【问题描述】:

使用 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% 具有确切名称的积极用户

【问题讨论】:

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


    【解决方案1】:

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

    response.get('items')[0].get('pagemap').get('hcard')[0].get('fn')
    

    【讨论】:

    • 你是对的,我现在正在这样做,问题是每次我点击谷歌搜索引擎 API 时都会花费我$$。我想将结果消除到小集。在某些情况下,我必须访问大约 20 页以检查字典中是否存在该名称。我想知道是否有一种方法可以让 100% 的积极用户在 fn 对象中使用确切的名称。
    猜你喜欢
    • 1970-01-01
    • 2015-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-25
    • 1970-01-01
    相关资源
    最近更新 更多