0

我正在寻找一种基于产品的 GTIN 代码获取产品的谷歌购物页面的方法。

例如,如果我有 GTIN 03661238046573,我希望能够访问以下页面: https ://www.google.com/shopping/product/1778678479788252976/online

有没有办法得到这个代码(这里是 1778678479788252976)?

4

1 回答 1

2

要获取产品 ID,您可以查询下一个链接: https ://www.google.com/search?q=iphone+12&oq=iphone+12&uule={google_encrypted_location}&hl=en&gl=us&tbm=shop&sourceid=chrome&ie=UTF-8

google_encrypted_location:例如w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM(奥斯汀,德克萨斯州,美国)

有关如何获取特定位置的 uule 的更多信息:https ://blog.linkody.com/seo-local/uule-2

通过期望页面源,您可以找到产品 ID:

在此处输入图像描述

拿到身份证后,可以用它来查询你贴的链接: https: //www.google.com/shopping/product/ID/online

或者,您可以使用第三方解决方案,例如 SerpApi。这是一个免费试用的付费 API。

用于获取产品及其 ID 的示例 python 代码(也可在其他库中获得):

from serpapi import GoogleSearch

params = {
  "api_key": "secret_apy_key",
  "engine": "google",
  "q": "iphone 12",
  "location": "Austin, Texas, United States",
  "google_domain": "google.com",
  "gl": "us",
  "hl": "en",
  "tbm": "shop"
}

search = GoogleSearch(params)
results = search.get_dict()

示例 JSON 输出:

"shopping_results": [
  {
    "position": 1,
    "title": "Apple iPhone 12 - 64 GB - Purple - T-Mobile4.59,222iOS · 6.1″ · SmartphoneMore options",
    "link": "https://www.google.com/aclk?sa=L&ai=DChcSEwjTnqmUlaTxAhWEbW8EHbOPAg4YABAcGgJqZg&sig=AOD64_3MRJNbZbW1KCaDg9Xv7CBUOeNFdw&ctype=5&q=&ved=0ahUKEwjV26SUlaTxAhVsmK0KHeIkC8wQg-UECJwM&adurl=",
    "product_link": "https://google.com/shopping/product/8041628774029799278",
    "product_id": "8041628774029799278",
    "serpapi_product_api": "https://serpapi.com/search.json?device=desktop&engine=google_product&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&product_id=8041628774029799278",
    "source": "Apple",
    "price": "$33.29 now+$33.29 for 24 months",
    "extracted_price": 33.29,
    "rating": 4.5,
    "reviews": 9222,
    "snippet": "iOS · 6.1″ · Smartphone",
    "thumbnail": "https://serpapi.com/searches/60ce21c066d81f59e4c93542/images/904d7c7647ebcf00411f4d3821563c68ee2ef124a8f8e45b0649e7f3761e7a99.jpeg"
  },
  ...
]

然后用获得的另一个请求product_id

from serpapi import GoogleSearch

params = {
  "api_key": "secret_apy_key",
  "engine": "google_product",
  "google_domain": "google.com",
  "product_id": "8041628774029799278",
  "gl": "us",
  "hl": "en"
}

search = GoogleSearch(params)
results = search.get_dict()

示例 JSON 输出:

{
  "product_results": {
    "product_id": 8041628774029799000,
    "title": "Apple iPhone 12 - 64 GB - Purple - T-Mobile",
    "prices": [
      "$0.00 now",
      "$33.29 now",
      "$774.98"
    ],
    "reviews": 9168,
    "rating": 4.5,
    "extensions": [
      "Apple",
      "iPhone",
      "iPhone 12",
      "iOS",
      "6.1″",
      "Facial Recognition",
      "12 MP front camera",
      "12 MP rear camera",
      "Smartphone",
      "With Wireless Charging"
    ],
    "description": "5G speed. A14 Bionic, the fastest chip in a smartphone. The iPhone 12 features Super Retina XDR display with a 6.1-inch edge-to-edge OLED display, MagSafe wireless charging, Ceramic Shield with four times better drop performance and Night mode on every camera as well as Ultra Wide and Wide cameras.",
    "media": [
      {
        "type": "image",
        "link": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcR8jzxwzQxF8r0lgESYeXBWPvFTT25NzaBhTOH9AzsMJMK_fBxNMZA3EUgrM8TMs9U4OM5vU2k8Pjs8wVcE-_dcSuW8XJ8ydQ&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcT449Q9VOuuPUX2Pr4onJZrx6BCVPA05IFLPh-HmaeonE6L-e62_GzhJ2yjf6MEnjxMLAZ6Pm06vWWnARtcOlWYvFeTx0Kypg&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSZLI-STMQ_VwHx09dRCbfuxyH78Wt4BvBI66CvBeCwFtmlHJLPQzjGVmLTgfTW6TUNHZO7ORhNlx0LrA1N6OVt2ynON4hE&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTyZg9tNjuGwS-7rLim6tjN-BGcEDD7gmM-JF5jxZ5qKZ6ags94d6tITQqHUxLrygarqam7ZqbtBPrdCM-aJyQigvt5slyNoA&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQ6-7_3ti37pgOhhV57VDEDlRlnJ7wcdJYiXwCoqtmdKodZuvOEHgAXx1H5aS7z9fA6bokH2OzF4bbGAnud0YVIP9DMf5LFd2RnDhElUBNXa1ZxYK5bJa0jDA&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcR8jzxwzQxF8r0lgESYeXBWPvFTT25NzaBhTOH9AzsMJMK_fBxNMZA3EUgrM8TMs9U4OM5vU2k8Pjs8wVcE-_dcSuW8XJ8ydQ&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcT449Q9VOuuPUX2Pr4onJZrx6BCVPA05IFLPh-HmaeonE6L-e62_GzhJ2yjf6MEnjxMLAZ6Pm06vWWnARtcOlWYvFeTx0Kypg&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSZLI-STMQ_VwHx09dRCbfuxyH78Wt4BvBI66CvBeCwFtmlHJLPQzjGVmLTgfTW6TUNHZO7ORhNlx0LrA1N6OVt2ynON4hE&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTyZg9tNjuGwS-7rLim6tjN-BGcEDD7gmM-JF5jxZ5qKZ6ags94d6tITQqHUxLrygarqam7ZqbtBPrdCM-aJyQigvt5slyNoA&usqp=CAY"
      },
      {
        "type": "image",
        "link": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSfzvkikYaqD-E43KtyGorrOiF8-HLWpdsK3qFl80en42E0K7kQ7t-TbBHAmDO6EVJq-9vAmgtAAIucr-ZRZgTLWzLERUqH_A&usqp=CAY"
      }
    ]
  },
  "sellers_results": {
    "online_sellers": [
      {
        "position": 1,
        "name": "T-Mobile",
        "rating": "85%",
        "link": "https://www.google.com/aclk?sa=L&ai=DChcSEwiQl8GjlaTxAhUC5cgKHWGsCrgYABADGgJxdQ&sig=AOD64_3ZW7_j60anY3J3wgNSuRbRhYW9qA&ctype=5&q=&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0Q2ikIZw&adurl=",
        "base_price": "$0.00 now+$34.58 for 24 mo",
        "additional_price": {
          "shipping": "$0.00",
          "tax": "$68.47"
        },
        "total_price": "$898.39"
      },
      {
        "position": 2,
        "name": "Apple",
        "rating": "93%",
        "link": "https://www.google.com/aclk?sa=L&ai=DChcSEwiQl8GjlaTxAhUC5cgKHWGsCrgYABAFGgJxdQ&sig=AOD64_0i1JU_jGYSzfYnoruYIKObbDOX1A&ctype=5&q=&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0Q2ikIbw&adurl=",
        "base_price": "$33.29 now+$33.29 for 24 mo",
        "additional_price": {
          "shipping": "$0.00",
          "tax": "$68.66"
        },
        "total_price": "$900.91"
      },
      {
        "position": 3,
        "name": "eBay",
        "link": "https://www.google.com/aclk?sa=L&ai=DChcSEwiQl8GjlaTxAhUC5cgKHWGsCrgYABAEGgJxdQ&sig=AOD64_10eOWYkiN4SU_EON3HPPsxZh3CRA&ctype=5&q=&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0Q2ikIdg&adurl=",
        "base_price": "$774.98",
        "additional_price": {
          "shipping": "$7.70",
          "tax": "$63.94"
        },
        "total_price": "$846.62"
      }
    ]
  },
  "related_products": {
    "same_brand": [
      {
        "title": "Apple iPhone 12 mini - 64 GB ...",
        "link": "https://www.google.com/shopping/product/1827850213405143548?prds=epd:13818390672394569200,oid:13818390672394569200&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIhAE",
        "price": "$0.00 now+$30.42 for 24 mo",
        "extensions": [
          "Fewer SIM Slots",
          "Smaller Screen"
        ]
      },
      {
        "title": "Apple iPhone 12 5G A2404 Dual ...",
        "link": "https://www.google.com/shopping/product/8159458194295397419?prds=epd:18096946936983280689,oid:18096946936983280689&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIigE",
        "price": "$942.91",
        "extensions": [
          "Black",
          "With Fast Charging"
        ]
      },
      {
        "title": "Apple iPhone 12 64GB GSM/CDMA ...",
        "link": "https://www.google.com/shopping/product/2982523623000122494?prds=epd:6261584931910260031,oid:6261584931910260031&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIjgE",
        "price": "$999.98",
        "extensions": [
          "Unlocked",
          "Fewer SIM Slots",
          "With Fast Charging"
        ]
      },
      {
        "title": "Refurbished Apple iPhone 12 ...",
        "link": "https://www.google.com/shopping/product/13605342782445592952?prds=epd:12591979164402442142,oid:12591979164402442142&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIkgE",
        "price": "$730.00",
        "extensions": [
          "Fewer SIM Slots",
          "Blue"
        ]
      },
      {
        "title": "Apple iPhone 12 Mini - 64GB ...",
        "link": "https://www.google.com/shopping/product/5513812097751262112?prds=epd:5665517820920372408,oid:5665517820920372408&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIlgE",
        "price": "$0.00 now+$13.88 for 36 mo",
        "extensions": [
          "Carrier Specific",
          "Fewer SIM Slots",
          "2340 x 1080",
          "Quad-band",
          "With Fast Charging"
        ]
      },
      {
        "title": "Apple iPhone 12 mini - 64 GB ...",
        "link": "https://www.google.com/shopping/product/16404988970900222274?prds=epd:6755902865744664082,oid:6755902865744664082&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIInAE",
        "price": "$0.00 now+$30.42 for 24 mo",
        "extensions": [
          "Fewer SIM Slots",
          "Black",
          "Smaller Screen"
        ]
      },
      {
        "title": "Apple iPhone 12 mini - 256 GB ...",
        "link": "https://www.google.com/shopping/product/6203789700754104413?prds=epd:17364254673431302966,oid:17364254673431302966&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIogE",
        "price": "$879.99",
        "extensions": [
          "More Storage",
          "Carrier Specific",
          "Fewer SIM Slots",
          "Blue",
          "Smaller Screen"
        ]
      },
      {
        "title": "Apple iPhone 12 Mini 64GB Fully ...",
        "link": "https://www.google.com/shopping/product/10683706000081372688?prds=epd:2705284140349771079,oid:2705284140349771079&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIpgE",
        "price": "$899.99",
        "extensions": [
          "Unlocked",
          "Fewer SIM Slots",
          "Black",
          "With Fast Charging"
        ]
      },
      {
        "title": "Apple iPhone 12 Mini 64GB ...",
        "link": "https://www.google.com/shopping/product/14191484938030529841?prds=epd:67650207475666210,oid:67650207475666210&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIqgE",
        "price": "$806.46",
        "extensions": [
          "Lighter Phone",
          "Unlocked",
          "Fewer SIM Slots",
          "2340 x 1080",
          "色"
        ]
      },
      {
        "title": "Total Wireless Apple iPhone 12 ...",
        "link": "https://www.google.com/shopping/product/6181725895318027401?prds=epd:11659537624385733460,oid:11659537624385733460&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIrgE",
        "price": "$829.99",
        "extensions": [
          "Carrier Specific",
          "Fewer SIM Slots",
          "Quad-band",
          "Blue",
          "Fingerprint Scanner"
        ]
      }
    ],
    "different_brand": [
      {
        "title": "Samsung Galaxy S10e 128GB (T ...",
        "link": "https://www.google.com/shopping/product/2296142008659856015?prds=epd:12504649304959404856,oid:12504649304959404856&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIswE",
        "price": "$365.79",
        "extensions": [
          "Fewer SIM Slots",
          "Flamingo Pink",
          "Much Older"
        ]
      },
      {
        "title": "Samsung Galaxy S8 64GB (T ...",
        "link": "https://www.google.com/shopping/product/8003998021311117051?prds=epd:8297906013487274359,oid:8297906013487274359&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIItwE",
        "price": "$329.99",
        "extensions": [
          "Fewer SIM Slots",
          "Older Broadband Generation",
          "Android",
          "2960 x 1440",
          "Quad-band"
        ]
      },
      {
        "title": "LG X410ULML Spectrum: Black LG ...",
        "link": "https://www.google.com/shopping/product/17498538100781235726?prds=epd:632645544812764352,oid:632645544812764352&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIuwE",
        "price": "$49.95",
        "extensions": [
          "Fewer SIM Slots",
          "Smaller Screen",
          "Much Older"
        ]
      },
      {
        "title": "Galaxy S20 Fe 5G 128GB (T ...",
        "link": "https://www.google.com/shopping/product/5325573393233651104?prds=epd:4947513030992380473,oid:4947513030992380473&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIvwE",
        "price": "$503.99",
        "extensions": [
          "Fewer SIM Slots",
          "More Lenses",
          "Cloud Navy"
        ]
      },
      {
        "title": "Samsung Galaxy A11 in Black (T ...",
        "link": "https://www.google.com/shopping/product/9408978010418031830?prds=epd:5457268678915084839,oid:5457268678915084839&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIwwE",
        "price": "$200.00",
        "extensions": [
          "Fewer SIM Slots",
          "More Lenses",
          "Older Broadband Generation",
          "Android",
          "Headphone Jack"
        ]
      },
      {
        "title": "Samsung Galaxy A21 in Black (T ...",
        "link": "https://www.google.com/shopping/product/12798187705482858069?prds=epd:5690394580217236318,oid:5690394580217236318&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIxwE",
        "price": "$160.00",
        "extensions": [
          "Lighter Phone",
          "Fewer SIM Slots",
          "More Lenses",
          "Android",
          "With Expandable Storage"
        ]
      },
      {
        "title": "OnePlus Nord N100 - Midnight ...",
        "link": "https://www.google.com/shopping/product/17315272582590587790?prds=epd:3430672040480159552,oid:3430672040480159552&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhIIywE",
        "price": "$0.00 now+$7.50 for 24 mo",
        "extensions": [
          "Fewer SIM Slots",
          "More Lenses",
          "Older Broadband Generation",
          "With Expandable Storage",
          "Larger Screen"
        ]
      },
      {
        "title": "OnePlus 8 5G - Interstellar ...",
        "link": "https://www.google.com/shopping/product/14768649517492255170?prds=epd:1283021360351939752,oid:1283021360351939752&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhII0QE",
        "price": "$0.00 now+$25.00 for 24 mo",
        "extensions": [
          "Larger Screen",
          "Fewer SIM Slots",
          "More Lenses",
          "Android",
          "Interstellar Glow"
        ]
      },
      {
        "title": "LG Velvet 5G 128GB LMG900TM GSM ...",
        "link": "https://www.google.com/shopping/product/4643479383919090060?prds=epd:17626296817785244848,oid:17626296817785244848&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhII1wE",
        "price": "$343.90",
        "extensions": [
          "Larger Screen",
          "Higher Rear Camera Resolution",
          "Unlocked",
          "Fewer SIM Slots",
          "More Lenses"
        ]
      },
      {
        "title": "OnePlus 7T Pro 5G - 256 GB ...",
        "link": "https://www.google.com/shopping/product/4364518664337152017?prds=epd:512927785462820563,oid:512927785462820563&sa=X&ved=0ahUKEwitvL6jlaTxAhV1MlkFHUZkDT0QrhII2wE",
        "price": "$529.99",
        "extensions": [
          "Heavier Phone",
          "More Storage",
          "Higher Rear Camera Resolution",
          "Fewer SIM Slots",
          "More Lenses"
        ]
      }
    ]
  },
  "specs_results": {
    "general": {
      "product_type": "Smartphone",
      "manufacturer_model_number": "A2172",
      "form_factor": "Touch",
      "protection": "Dustproof, splashproof, waterproof"
    }
  },
  "reviews_results": {
    "ratings": [
      {
        "stars": 1,
        "amount": 471
      },
      {
        "stars": 2,
        "amount": 228
      },
      {
        "stars": 3,
        "amount": 353
      },
      {
        "stars": 4,
        "amount": 1126
      },
      {
        "stars": 5,
        "amount": 6990
      }
    ],
    "reviews": [
      {
        "position": 1,
        "title": "Beyond happy with phone/disappointed lack of charging equipment",
        "date": "January 6, 2021",
        "rating": 4,
        "source": "Christy Lehner · Review provided by Google",
        "content": "I upgraded to the iPhone 12 Pro strictly for the camera and video cameras. I’ve normally been very content having an older model iPhone, but after putting together our family digital photo albums for the last 5 years as a Christmas present, I realized that I had gotten away from carrying my nice Nikon camera and video cameras, instead relying strictly on my phone to capture our families memories.  After looking at the quality of the photos I took from those phones, I was very upset to document our family’s memories (our children’s early childhood) with so many grainy photos.  The iPhone 12 pro is not equivalent to a professional camera, but the picture quality is so much better than what I was taking before, so I am very pleased.  The battery life is very good and other features work very well as well.  \n\nThe only reason I gave the iPhone 12 pro 4 stars instead of 5, was because apple stopped including the necessary charging equipment with its phones.  (I would actually rate this as a 1 if I could rate it on its own.)  When you purchase any type of product whether it be a battery operated sweeper, etc, it is useless if you can’t charge it.  If you purchase any product that is $300+, you should be able to charge it without an additional purchase, especially when they changed the USB size to one that is not easily obtained from your local stores.  How sad and greedy that they can’t afford to include a charging port (that probably costs them pennies to make) with their $1000+ phones.  The reasoning that they’re saving the environment with smaller packaging is beyond ridiculous! Having to purchase a completely other package with a charging port is causing way more of a negative impact on the environment compared to making a tiny space in the current packaging.  Not to mention all of the phones that will go into the landfill sooner than necessary because they are being charged with inferior chargers instead of the ones intended for them (why would most people purchase an apple one when you can purchase one for much less).  Which is also good if not shady business on their part to make more money in the future. "
      }
    ]
  }
}

查看Google Shopping APIGoogle Product API文档了解更多详细信息。

免责声明:我在 SerpApi 工作。

于 2021-06-19T17:23:05.113 回答