使用Google专利API [英] Using Google patent api
问题描述
我只想使用Python和Google专利搜索API找出专利的所有者。
import urllib2
import json
$ b $ url url =('https://ajax.googleapis.com/ajax/services/search/patent?'+
'v = 1.0& q = barack %20bama')
request = urllib2.Request(url,None,{})
response = urllib2.urlopen(request)
#处理JSON字符串。
print json.load(response)
#现在对结果有一些乐趣...
这个结果并没有告诉受让人。 Google专利API已被弃用( google.com/patent-search/rel =nofollow>截至2011年5月26日,Google专利搜索API已正式废弃。)。我不认为您获得的数据是可靠的。
我不确定Google的服务条款是否允许违反个别Google专利页面,但一种策略可能会要使用搜索来获得结果列表,然后使用诸如美丽的汤来解析每个结果结果。
$ b 示例:
import urllib2
import json
from bs4 import BeautifulSoup
url =('https://ajax.googleapis.com/ajax/services/search/patent?'+
'v = 1.0& amp ; q = barack%20obama')
request = urllib2.Request(url,None,{})
response = urllib2.urlopen(request)
jsonResponse = json.load(response)
responseData = jsonResponse ['responseData']
results = responseData [results]
print这不起作用,没有受让人数据...
结果:
printpatent no .:,result [patentNumber]
printassig nee:,result [assignee]
print
print...但是这似乎是。
为结果的结果:
URL =https://www.google.com/patents/\"+result[\"patentNumber]
req = urllib2.Request(网址,标题= {'User-Agent':python})
_file = urllib2.urlopen(req)
patent_html = _file.read()
汤= BeautifulSoup(patent_html,'html.parser' )
patentNumber = soup.find(span,{class:patent-number})。text
assigneeMetaTag = soup.find(meta,{scheme:assignee })
patentAssignee = assigneeMetaTag.attrs [content]
printpatent no .:,patentNumber
printassignee:,patentAssignee
print
对于我来说,这会打印出来:
这不起作用,没有受让人数据...
专利号:US20110022394
受让人:
专利号:US20140089323
受让人:
专利号:US8117227
受让人:
专利号:CA2702937C
受让人:
。 ..但这似乎。
专利号:US 20110022394 A1
受让人:Thomas Wide
专利号:US 20140089323 A1
受让人:Appinions Inc.
专利号:US 8117227 B2
受让人:Scuola Normale Superiore Di Pisa
专利号:CA 2702937 C
受让人:Neil S. Roseman
请注意一点,我相信在专利发布之日您才会获得受让人;而不是当前的受让人,如果它已被转让。
I simply want to find out the owner of a patent using Python and the Google patent search API.
import urllib2
import json
url = ('https://ajax.googleapis.com/ajax/services/search/patent?' +
'v=1.0&q=barack%20obama')
request = urllib2.Request(url, None, {})
response = urllib2.urlopen(request)
# Process the JSON string.
print json.load(response)
# now have some fun with the results...
This result does not tell about assignee. How can I get it?
The Google patents API is deprecated ("The Google Patent Search API has been officially deprecated as of May 26, 2011."). I don't think the data you get is reliable.
I'm not sure whether the Google terms of service allows going against individual Google patent pages, but one strategy might be to use search to get a list of results, then use something like Beautiful Soup to parse each result.
Example:
import urllib2
import json
from bs4 import BeautifulSoup
url = ('https://ajax.googleapis.com/ajax/services/search/patent?' +
'v=1.0&q=barack%20obama')
request = urllib2.Request(url, None, {})
response = urllib2.urlopen(request)
jsonResponse = json.load(response)
responseData=jsonResponse['responseData']
results = responseData["results"]
print "This doesn't work, no assignee data..."
for result in results:
print "patent no.: ", result["patentNumber"]
print "assignee: ", result["assignee"]
print " "
print "...but this seems to."
for result in results:
URL = "https://www.google.com/patents/"+result["patentNumber"]
req = urllib2.Request(URL, headers={'User-Agent' : "python"})
_file = urllib2.urlopen(req)
patent_html = _file.read()
soup = BeautifulSoup(patent_html, 'html.parser')
patentNumber = soup.find("span", { "class" : "patent-number" }).text
assigneeMetaTag = soup.find("meta", { "scheme" : "assignee"})
patentAssignee = assigneeMetaTag.attrs["content"]
print "patent no.: ", patentNumber
print "assignee: ", patentAssignee
print " "
For me this prints out:
This doesn't work, no assignee data...
patent no.: US20110022394
assignee:
patent no.: US20140089323
assignee:
patent no.: US8117227
assignee:
patent no.: CA2702937C
assignee:
...but this seems to.
patent no.: US 20110022394 A1
assignee: Thomas Wide
patent no.: US 20140089323 A1
assignee: Appinions Inc.
patent no.: US 8117227 B2
assignee: Scuola Normale Superiore Di Pisa
patent no.: CA 2702937 C
assignee: Neil S. Roseman
One note of caution, I believe you're only going to get the assignee as of the date the patent was issued; not the current assignee, in cases where it has been transferred.
这篇关于使用Google专利API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!