2016-06-30 5 views
0

有名人を探してリンクしているアカウントgoogle apisを使用して - 私は奴隷のリンクを訪問すると私はJsonを参照してください。私はユーザーに、Googleのランキングシステムのいくつかの並べ替えを使用して実際に私が探している有名人を取得します。有名人を探してリンクしているGoogle検索エンジンapisを使用してアカウントを

名前がStevie Wonderの人のみを取得するにはどうすればよいですか?ちょうどどこにitems.hcard.fn == Stevie Wonderの蛇口のリンクは私のプライベートではありません。私は結果を取得し、名前が検索に一致するかどうかを確認するために、すべてのfnオブジェクトをチェックしています現時点では

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'}} 

、問題はそれが私がgoogle search engine APIを打つたびに$$費用ということです。私は小さなセットに結果を排除したい。いくつかのケースでは、その名前がレスポンスに存在するかどうかを確認するために、約20ページを訪問する必要があります。私はfnオブジェクトの正確な名前で100%の正のユーザしか得られないのだろうかと疑問に思っていた。

答えて

0

私は、応答が応答dictの場合、次のようなものを探していると仮定します。もちろん、まずはjsonをdictに変換する必要があります。

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

あなたは正しいですが、私はその時点でそれをやっています。問題は、Google検索エンジンAPIを押すたびに '$$ 'がかかります。私は小さなセットに結果を排除したい。いくつかのケースについては、その名前が辞書に存在するかどうかを調べるために約20ページを訪問しなければならない。 'fn'オブジェクトの正確な名前を持つ100%の正のユーザしか得られないのかどうか疑問に思っていました。 – mongotop

関連する問題