对不起这个问题,我是新手。
我有一个项目,我需要抓取谷歌地图找到一个地区的所有公司,我刚刚听说我们决定项目的时候,我做了一些研究,并发现大多数刮刮服务需要某个公司领域开始搜索,但我需要该领域的所有公司,有人可以解释我应该如何开始吗?
我在这个帖子中看到了:Is it ok to scrape data from Google results?
他们谈论IP我知道ISP会为某些地区分配公共IP地址,但我该如何使用它来刮掉?
另外,我发现一篇文章说我必须在他们的网站上使用Google API: https://developers.google.com/maps/web-services/ 我应该使用哪种API?
我正在使用Ubuntu系统,如果我需要安装任何东西,我应该使用Windows操作系统吗?
感谢和亲切的问候
更新:
我从http://py-googlemaps.sourceforge.net/发现我可以使用这个python代码:
local = gmaps.local_search('咖啡馆附近' +目的地) 打印本地[' responseData'] ['结果'] [0] [' titleNoFormatting'] Vie De France Bakery&咖啡馆
如果我用'#34;公司"或者我认为我会得到我正在寻找的信息的任何名称?另外我想知道是否有人可以告诉我如何进入配置界面?
答案 0 :(得分:11)
上面的语言应该是#34;法律上不允许"刮而不是"不能"。无论是否合法,你都可以刮掉另一件事。
答案 1 :(得分:2)
披露:我在SerpApi工作。
您可以使用google-search-results
包从Google Maps获取数据。 Check a demo at Repl.it。
from serpapi.google_search_results import GoogleSearchResults
params = {
"engine": "google_maps",
"q": "coffee",
"google_domain": "google.com",
"type": "search",
"ll": "@40.7455096,-74.0083012,14z",
}
client = GoogleSearchResults(params)
data = client.get_dict()
print("Local results")
for result in data['local_results']:
print(f"""Title: {result['title']}
Address: {result['address']}
Rating: {result['rating']}
Reviews: {result['reviews']}
""")
print("Ads")
for result in data['ads']:
print(f"""Title: {result['title']}
Address: {result['address']}
""")
响应
{
"ads": [
{
"position": 1,
"title": "Dunkin'",
"data_id": "0x89c259b2fc5f55e1:0x64bc920e65d8e925",
"gps_coordinates": {
"latitude": 40.750499,
"longitude": -73.9934318
},
"price": "$",
"type": "Coffee shop",
"address": "4 Pennsylvania Plaza, New York, NY 10001",
"phone": "(917) 886-3110",
"website": "https://www.dunkindonuts.com/?utm_source=google&utm_medium=local&utm_campaign=localmaps&utm_content=355204",
"description": "Chain known for donuts & coffee. Long-running chain serving signature donuts, breakfast sandwiches & a variety of coffee drinks.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipP-75QJzyjz5FijvE9JV_Iuy0AI80oJIzZgQ4eL=w360-h202-k-no"
},
{
"position": 2,
"title": "Gotham Coffee Roasters",
"data_id": "0x89c25a88a0eff20b:0xca91d8e20a7ebe14",
"gps_coordinates": {
"latitude": 40.739861999999995,
"longitude": -73.992693
},
"rating": 4.5,
"reviews": 102,
"price": "$$",
"type": "Coffee shop",
"address": "23 W 19th St, New York, NY 10011",
"phone": "(212) 255-2972",
"website": "http://www.gothamroasters.com/",
"editorial_reviews": {
"summary": "Union Square: Top 10 Date Night Picks",
"link": "https://idktonight.com/guide/idk-tonight-ten-picks-union-square"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOrxU6m4_QKaoASASy4o_OKHT7QSGO1UX8VzP_6=w360-h479-k-no"
}
],
"local_results": [
{
"position": 1,
"title": "Birch Coffee",
"data_id": "0x89c258ef40975c2b:0x4fa24ff965c3f3e",
"gps_coordinates": {
"latitude": 40.7638094,
"longitude": -73.9666075
},
"rating": 4.5,
"reviews": 477,
"price": "$$",
"type": "Coffee shop",
"address": "134 1/2 E 62nd St, New York, NY 10065",
"hours": "Open until 7:00 PM",
"phone": "(212) 686-1444",
"website": "http://www.birchcoffee.com/",
"description": "Hip spot offering house-roasted brews. Local coffeehouse chain serving thoughtfully-sourced, house-roasted brews in a hip, bustling space.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPy035-T0IVHuC3CffD8UEf0n70HkkZXvkb7gSJ=w122-h92-k-no"
},
{
"position": 2,
"title": "Think Coffee",
"data_id": "0x89c259ca0a28731f:0xd3d13e0daf7fae6c",
"gps_coordinates": {
"latitude": 40.7522222,
"longitude": -74.0016667
},
"rating": 3.9,
"reviews": 467,
"price": "$$",
"type": "Coffee shop",
"address": "500 W 30th St, New York, NY 10001",
"website": "http://www.thinkcoffee.com/",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipMIVRZJMr-bnGKw28VTrctmhVYQOnIKBRj0NmnN=w122-h92-k-no"
},
{
"position": 3,
"title": "Gimme! Coffee",
"data_id": "0x89c2598f54688429:0xa9caecde0c8abd9c",
"gps_coordinates": {
"latitude": 40.722346,
"longitude": -73.995001
},
"rating": 4.4,
"reviews": 220,
"price": "$",
"type": "Coffee shop",
"address": "228 Mott St, New York, NY 10012",
"hours": "Open until 6:00 PM",
"phone": "(212) 226-4011",
"website": "http://www.gimmecoffee.com/",
"description": "Petite espresso bar. Espresso, drip brews & small-batch roasted coffee beans are the draws at this small cafe.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPaaPzY65h2JWJXyy-pstIiaLdqXmep9ClPwRBM=w122-h92-k-no"
},
{
"position": 4,
"title": "Birch Coffee",
"data_id": "0x89c25858fa153d87:0xde230873a4d847fb",
"gps_coordinates": {
"latitude": 40.768152,
"longitude": -73.9852908
},
"rating": 4.6,
"reviews": 187,
"price": "$$",
"type": "Coffee shop",
"address": "884 9th Ave, New York, NY 10019",
"hours": "Open until 6:00 PM",
"phone": "(212) 686-1444",
"website": "http://birchcoffee.com/",
"description": "Hip spot offering house-roasted brews. Local coffeehouse chain serving thoughtfully-sourced, house-roasted brews in a hip, bustling space.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOZuG2_zwCk3EVFUZLr6c9wBZ-1w4CN37zx6bgK=w80-h106-k-no"
},
{
"position": 5,
"title": "Think Coffee",
"data_id": "0x89c259851852abd5:0xd439f8da9b71229b",
"gps_coordinates": {
"latitude": 40.728338,
"longitude": -73.995286
},
"rating": 4.2,
"reviews": 836,
"price": "$",
"type": "Coffee shop",
"address": "248 Mercer St, New York, NY 10012",
"website": "http://www.thinkcoffee.com/",
"description": "Popular Fair Trade coffeehouse. Fair Trade organic coffee, sandwiches & baked goods served in a laid-back East Village setting.",
"editorial_reviews": {
"summary": "Where To Go On A Coffee Date In NYC",
"link": "https://www.theinfatuation.com/new-york/guides/where-to-go-on-a-coffee-date"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipMm0BebvGJsVEZOfAwrkYaEXKGppv7f5rqcVZns=w80-h100-k-no"
},
{
"position": 6,
"title": "Birch Coffee @Flatiron",
"data_id": "0x89c259a65b82f7f7:0xd74db93f308e43ab",
"gps_coordinates": {
"latitude": 40.7436315,
"longitude": -73.98643799999999
},
"rating": 4.4,
"reviews": 940,
"price": "$$",
"type": "Coffee shop",
"address": "21 E 27th St, New York, NY 10016",
"hours": "Open until 8:00 PM",
"phone": "(212) 686-1444",
"website": "http://www.birchcoffee.com/",
"description": "Hip spot offering house-roasted brews. Local coffeehouse chain serving thoughtfully-sourced, house-roasted brews in a hip, bustling space.",
"editorial_reviews": {
"summary": "The best coffee shops in NYC",
"link": "https://www.timeout.com/newyork/restaurants/best-coffee-shops-in-new-york"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPmUJFcwFbslCIRwltcd1Icjwcbc4KGHesS31Tl=w122-h92-k-no"
},
{
"position": 7,
"title": "Think Coffee",
"data_id": "0x89c259900d24e84b:0xd186a287933b4e4d",
"gps_coordinates": {
"latitude": 40.7395095,
"longitude": -74.0030029
},
"rating": 4.2,
"reviews": 741,
"price": "$",
"type": "Coffee shop",
"address": "73 8th Ave, New York, NY 10014",
"website": "http://www.thinkcoffee.com/",
"description": "Popular Fair Trade coffeehouse. Fair Trade organic coffee, sandwiches & baked goods served in a laid-back East Village setting.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOXX9uTvG24F0Wmz8Fq5kegRxD50B4li-2xclVt=w80-h106-k-no"
},
{
"position": 8,
"title": "Birch Coffee",
"data_id": "0x89c259085ff6dad7:0x5e9d363c75b8d4bb",
"gps_coordinates": {
"latitude": 40.7434012,
"longitude": -73.9800788
},
"rating": 4.4,
"reviews": 217,
"price": "$$",
"type": "Coffee shop",
"address": "432 3rd Ave, New York, NY 10016",
"hours": "Open until 7:00 PM",
"phone": "(212) 686-1444",
"website": "http://birchcoffee.com/menu",
"description": "Hip spot offering house-roasted brews. Local coffeehouse chain serving thoughtfully-sourced, house-roasted brews in a hip, bustling space.",
"editorial_reviews": {
"summary": "15 Classy & Instagrammable Coffee Shops in New York City",
"link": "https://www.flyingcarpetgo.com/classy-coffee-shops-in-new-york-city/"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNipp75t68aXuym-8ALEHcZYFnSCqoKWyZzilbp=w91-h92-k-no"
},
{
"position": 9,
"title": "Think Coffee",
"data_id": "0x89c259993bf96a5d:0x2fc85f3c1b03bace",
"gps_coordinates": {
"latitude": 40.733008999999996,
"longitude": -73.989712
},
"rating": 4.2,
"reviews": 593,
"price": "$$",
"type": "Coffee shop",
"address": "123 4th Ave, New York, NY 10003",
"website": "http://www.thinkcoffee.com/",
"description": "Popular fair-trade coffeehouse. Fair-trade organic coffee, sandwiches & baked goods served in a laid-back East Village setting.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipMqXrujO-XiB9ujAXmLFKXhj-9SvHZLmZI22UwC=w80-h119-k-no"
},
{
"position": 10,
"title": "Birch Coffee",
"data_id": "0x89c259bde5571fdb:0x2aa3b26b649b00c6",
"gps_coordinates": {
"latitude": 40.7383928,
"longitude": -74.0000558
},
"rating": 4.4,
"reviews": 275,
"price": "$$",
"type": "Coffee shop",
"address": "56 7th Ave, New York, NY 10011",
"hours": "Open until 8:00 PM",
"phone": "(212) 686-1444",
"website": "http://www.birchcoffee.com/",
"description": "Hip spot offering house-roasted brews. Local coffeehouse chain serving thoughtfully-sourced, house-roasted brews in a hip, bustling space.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipN9ixCamZ9Pc5II9F5Cfs54x8Nbe0zVZ45JmeTZ=w122-h92-k-no"
},
{
"position": 11,
"title": "Blue Bottle Coffee",
"data_id": "0x89c25999add201db:0x6c7a37c57f1cd482",
"gps_coordinates": {
"latitude": 40.7340106,
"longitude": -73.992526
},
"rating": 4.4,
"reviews": 150,
"price": "$$",
"type": "Coffee shop",
"address": "101 University Pl, New York, NY 10003",
"hours": "Open until 7:00 PM",
"phone": "(510) 653-3394",
"website": "https://bluebottlecoffee.com/cafes/university-place",
"description": "Hip cafe for gourmet coffee & pastries. Trendy cafe chain offering upscale coffee drinks & pastries, plus beans & brewing equipment.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOQGwccVAmU7RC5GRLzPmbap9v87xPKEKJWbdDR=w80-h106-k-no"
},
{
"position": 12,
"title": "About Coffee",
"data_id": "0x89c2598c8bd0a477:0x67a88948fbbe16c9",
"gps_coordinates": {
"latitude": 40.7244068,
"longitude": -74.0037985
},
"rating": 4.6,
"reviews": 109,
"type": "Coffee shop",
"address": "71 Sullivan St, New York, NY 10012",
"hours": "Open until 7:00 PM",
"phone": "(212) 219-1408",
"website": "http://www.aboutcoffee.nyc/",
"description": "Snug spot for coffee drinks & pastries. Snug, relaxed cafe serving pastries & coffee drinks made with locally roasted beans.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNGlia-_S0EdZJKnDGYm5TTc-fj4t_T_-bbcEPW=w92-h92-k-no"
},
{
"position": 13,
"title": "Think Coffee",
"data_id": "0x89c25985202ef3e9:0x69c533933d889312",
"gps_coordinates": {
"latitude": 40.7254162,
"longitude": -73.9924344
},
"rating": 4.1,
"reviews": 387,
"price": "$",
"type": "Coffee shop",
"address": "1 Bleecker St, New York, NY 10003",
"website": "http://www.thinkcoffee.com/",
"description": "Coffeehouse known for fair-trade beans. Fair-trade organic coffee, sandwiches & baked goods served in a laid-back setting.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPhMR-kPa4TkWkQupql2b4kTRSS34La4QDGBTO_=w122-h92-k-no"
},
{
"position": 14,
"title": "Partners Coffee",
"data_id": "0x89c25994462de15d:0xed701c2f80d71d88",
"gps_coordinates": {
"latitude": 40.7349199,
"longitude": -74.0022977
},
"rating": 4.5,
"reviews": 320,
"price": "$$",
"type": "Coffee shop",
"address": "44 Charles St, New York, NY 10014",
"phone": "(646) 590-1924",
"website": "http://www.partnerscoffee.com/",
"description": "Gourmet coffee shop & roasters. Gourmet coffee shop from Australia with pour-overs, espressos & snacks, plus roastings & classes.",
"editorial_reviews": {
"summary": "29 Outstanding Coffee Shops in NYC",
"link": "https://ny.eater.com/maps/best-cafe-coffee-shop-new-york-city-brooklyn-queens"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipOcY8QshkZY_SWRb0DnIt3DFmjCnN9jOg2kVwii=w92-h92-k-no"
},
{
"position": 15,
"title": "Stumptown Coffee Roasters",
"data_id": "0x89c259a61c75684f:0x79d31adb123348d2",
"gps_coordinates": {
"latitude": 40.7457399,
"longitude": -73.9882272
},
"rating": 4.6,
"reviews": 1251,
"price": "$$",
"type": "Coffee shop",
"address": "18 W 29th St, New York, NY 10001",
"hours": "Open until 8:00 PM",
"phone": "(855) 711-3385",
"website": "https://www.stumptowncoffee.com/locations/newyork/ace-nyc",
"description": "Coffee bar serving direct-trade java. Coffee bar chain offering house-roasted direct-trade coffee, along with brewing gear & whole beans",
"editorial_reviews": {
"summary": "Add These Coffee Stops to Your Next NYC Trip",
"link": "https://blog.drinktrade.com/2019/02/28/coffee-city-new-york/"
},
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPCPSYLktGESHtVoEyffOsnYxtzyMjR1WjTbHPV=w122-h92-k-no"
},
{
"position": 16,
"title": "La Colombe",
"data_id": "0x89c259f2d7811435:0x70e6c5f3ddc06f61",
"gps_coordinates": {
"latitude": 40.7267631,
"longitude": -74.0070001
},
"rating": 4.5,
"reviews": 403,
"price": "$$",
"type": "Coffee shop",
"address": "75 Vandam St, New York, NY 10013",
"hours": "Open until 6:30 PM",
"phone": "(212) 929-9699",
"website": "http://www.lacolombe.com/",
"description": "Hip coffee bar. Snug, hip cafe outpost of Philly-based roaster serving espresso drinks & pastries.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNfly0BQoDIiTjzXYG3c_6uARgGI1Zq_RqQGeX8=w98-h92-k-no"
},
{
"position": 17,
"title": "Merriweather Coffee + Kitchen",
"data_id": "0x89c259ed32c9f3d5:0xfb651222b629b0f5",
"gps_coordinates": {
"latitude": 40.7305602,
"longitude": -74.0065341
},
"rating": 4.6,
"reviews": 221,
"price": "$$",
"type": "Coffee shop",
"address": "428 Hudson St, New York, NY 10014",
"hours": "Open until 6:00 PM",
"phone": "(646) 678-5678",
"website": "http://merriweathernyc.com/",
"description": "Australian cafe with light bites. Aussie-style cafe serving Counter Culture coffee, toasts & pastries plus sandwiches & salads.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipM1yd5gUbhIEH77H2PEbS_YNtqPNBB4bxwaZcv1=w80-h106-k-no"
},
{
"position": 18,
"title": "Variety Coffee Roasters",
"data_id": "0x89c259a533a7d2e3:0x37d08e1c0464b202",
"gps_coordinates": {
"latitude": 40.745199,
"longitude": -73.99456169999999
},
"rating": 4.5,
"reviews": 370,
"type": "Coffee shop",
"address": "261 7th Ave, New York, NY 10001",
"hours": "Open until 9:00 PM",
"phone": "(917) 409-0106",
"website": "http://varietycoffeeroasters.com/",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNnOeOQ0hYASySR-sAHE72Z2_iQHM0I_cJOzkWs=w80-h99-k-no"
},
{
"position": 19,
"title": "Think Coffee Center",
"data_id": "0x89c259be02461731:0x92b14dd3de4f22e4",
"gps_coordinates": {
"latitude": 40.7380411,
"longitude": -74.0010832
},
"rating": 4.6,
"reviews": 39,
"type": "Coffee shop",
"address": "208 W 13th St, New York, NY 10011",
"hours": "Open until 6:00 PM",
"website": "http://www.thinkcoffee.com/",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPyZ8fd3HBtQDANzYXzKvlt5Db0h9wukVyxzFIP=w92-h92-k-no"
},
{
"position": 20,
"title": "Café Grumpy",
"data_id": "0x89c259ab6335319b:0x394cadbea63ab640",
"gps_coordinates": {
"latitude": 40.7541667,
"longitude": -73.98888889999999
},
"rating": 4.4,
"reviews": 549,
"price": "$$",
"type": "Coffee shop",
"address": "200 W 39th St, New York, NY 10018",
"hours": "Open until 8:00 PM",
"phone": "(646) 449-8747",
"website": "http://cafegrumpy.com/locations/fashion-district/",
"description": "Hip spot for house-roasted coffee. Hip local coffeehouse chain serving a range of house-roasted brews in a relaxed setting.",
"thumbnail": "https://lh5.googleusercontent.com/p/AF1QipPH4F096E1uyGADWxODOH4K0cJD6yKUUp46mMA=w92-h92-k-no"
}
]
}
输出
Local results
Title: Think Coffee
Address: 73 8th Ave, New York, NY 10014
Rating: 4.2
Reviews: 741
Title: Birch Coffee @Flatiron
Address: 21 E 27th St, New York, NY 10016
Rating: 4.4
Reviews: 940
Title: Irving Farm New York
Address: 135 E 50th St, New York, NY 10022
Rating: 4.3
Reviews: 248
Title: UT47 Manhattan
Address: 358 W 47th St, New York, NY 10036
Rating: 4.5
Reviews: 241
Title: Gimme! Coffee
Address: 228 Mott St, New York, NY 10012
Rating: 4.4
Reviews: 220
Title: Think Coffee
Address: 500 W 30th St, New York, NY 10001
Rating: 3.9
Reviews: 467
Title: Birch Coffee
Address: 432 3rd Ave, New York, NY 10016
Rating: 4.4
Reviews: 217
Title: Think Coffee
Address: 248 Mercer St, New York, NY 10012
Rating: 4.2
Reviews: 836
Title: Think Coffee
Address: 123 4th Ave, New York, NY 10003
Rating: 4.2
Reviews: 593
Title: Think Coffee
Address: 1 Bleecker St, New York, NY 10003
Rating: 4.1
Reviews: 387
Title: Birch Coffee
Address: 56 7th Ave, New York, NY 10011
Rating: 4.4
Reviews: 275
Title: Blue Bottle Coffee
Address: 101 University Pl, New York, NY 10003
Rating: 4.4
Reviews: 150
Title: Stumptown Coffee Roasters
Address: 18 W 29th St, New York, NY 10001
Rating: 4.6
Reviews: 1251
Title: Culture Espresso
Address: 247 W 36th St, New York, NY 10018
Rating: 4.5
Reviews: 355
Title: Partners Coffee
Address: 44 Charles St, New York, NY 10014
Rating: 4.5
Reviews: 320
Title: La Colombe
Address: 75 Vandam St, New York, NY 10013
Rating: 4.5
Reviews: 403
Title: Think Coffee
Address: 568 6th Ave, New York, NY 10011
Rating: 4.0
Reviews: 345
Title: Stumptown Coffee Roasters
Address: 30 W 8th St, New York, NY 10011
Rating: 4.5
Reviews: 1007
Title: Third Rail Coffee
Address: 240 Sullivan St, New York, NY 10012
Rating: 4.3
Reviews: 300
Title: Merriweather Coffee + Kitchen
Address: 428 Hudson St, New York, NY 10014
Rating: 4.6
Reviews: 221
Ads
Title: Gotham Coffee Roasters
Address: 23 W 19th St, New York, NY 10011
如果需要更多信息,请查看SerpApi documentation。