Algorithm 反向工程谷歌“;写一篇评论;链接URL
在Google local listings中,有一个URL可以直接将一个人带到显示企业评论的弹出窗口。以下是一个例子: 每个业务位置的URL中都有一个数字ID(在本例中为12682026813239828050)以及Algorithm 反向工程谷歌“;写一篇评论;链接URL,algorithm,google-maps,hex,Algorithm,Google Maps,Hex,在Google local listings中,有一个URL可以直接将一个人带到显示企业评论的弹出窗口。以下是一个例子: 每个业务位置的URL中都有一个数字ID(在本例中为12682026813239828050)以及#lrd参数中该数字的十六进制表示形式 我有所有的数字ID,需要通过确定十六进制段是如何形成的来生成这些URL。对于ID可以用16个十六进制字符表示的位置,这很容易。URL段仅为0x0:0x[hexstring],例如: 4134566830992571874 => 0x0
#lrd
参数中该数字的十六进制表示形式
我有所有的数字ID,需要通过确定十六进制段是如何形成的来生成这些URL。对于ID可以用16个十六进制字符表示的位置,这很容易。URL段仅为0x0:0x[hexstring],例如:
4134566830992571874 => 0x0:0x3960eea07d6cbe00
但是当数字太长时,它会被分成两个十六进制字符串,我无法确定第一个字符串的来源。我举了两个例子:
14384749138104818286 => 0x872b0445e4ee5e9b:0xc7a0e5209fd81a6e
15716027411522919173 => 0x872b00074aa36265:0xda1a8ba9e8201b05
c7a0e5209fd81a6e => 14384749138104818 (missing the last 3 digits)
da1a8ba9e8201b05 => 15716027411522918 (missing the last 3 digits and off by 1000)
第二个十六进制字符串转换为接近的数字。在示例中:
14384749138104818286 => 0x872b0445e4ee5e9b:0xc7a0e5209fd81a6e
15716027411522919173 => 0x872b00074aa36265:0xda1a8ba9e8201b05
c7a0e5209fd81a6e => 14384749138104818 (missing the last 3 digits)
da1a8ba9e8201b05 => 15716027411522918 (missing the last 3 digits and off by 1000)
以下是一个正在成功转换它们的站点:
有人能帮我确定生成这些数据的方法吗?如果有另一个堆栈网站,这将是更好的,请直接我那里以及。谢谢大家! 最后,我在这里使用了“将长整数转换为十六进制”函数使其工作:
如果您使用
0x0:0x[该函数的结果]
而不是使用由谷歌生成的由两部分组成的URL,那么URL也可以工作。当然还有另外一个URL可以使用,但我有一个可以使用。谢谢。回答这个问题。以下是谷歌lrd的当前分类,留下一个五星评论:
#lrd=0x6b12ae37b47f5b37:0x8eaddfcd1b32ca52,3,5
以下是据我所知的详细情况:
lrd =
[ 0x6b12ae37b47f5b37 ] = Unknown. What does this number represent?
:
[ 0x8eaddfcd1b32ca52 ] = google cid converted to hex
[ ,3 ] = The review type. 1 for reviews, 2 for write review, 3 also write review
[ ,5 ] = The review rating to pre-fill on the modal
如果你正在寻找一个解决方案来创建一个评论链接,这可能会有所帮助。解决这个问题的方法是使用GooglePlacesAPI。这将允许您从api查询business place_id,并将其与google允许您用作公共评论链接的评论链接一起使用,如下面的示例所示:
https://search.google.com/local/writereview?placeid= [place_id]
有关此链接的详细信息:
这仍然不允许您获取google在google search上创建的实际链接,或者在review模式中添加评论评级,如下面的示例所示:
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=google+syndey&*&lrd=0x6b12ae37b47f5b37:0x8eaddfcd1b32ca52,3,5
这个问题的解决方案可以通过一个curl请求来解决,该请求使用我们使用place_id创建的第一个链接,并从响应头获取返回位置
/* this is a php example curl */
$id = "ChIJN1t_tDeuEmsRUsoyG83frY4";
/* this will return the review url for a
google place account.
@param (string) $id = the google place_id
@return (string|false) the google review url
or false on error */
function getReviewUrl($id)
{
$url = "https://search.google.com/local/writereview?placeid=" . $id;
/* we need to setup headers to show a user agent
to stop google from redirecting to a 404 because
the request is coming from a curl */
$header = array(
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url);
$out = curl_exec($ch);
$location = false;
preg_match('/^(?:Location:(.*))$/mi', $out, $matches);
if(isset($matches[1]))
{
$location = $matches[1]; // this is the full review url
}
curl_close($ch);
return $location;
}
echo getReviewUrl($id);
这将返回完整的谷歌评论url,你可以很容易地在其上添加“、5”结尾,以预先填充5颗星的评级 在谷歌搜索的右侧卡片中,简单搜索该位置,找到write review按钮,单击它,然后复制上面的url。@2020 谷歌最终简化了审查URL,这样我们就不必再将&lrd参数转换为十六进制了。糟糕的黑客行为 现在,您只需要位置和这些URL的place_id参数:
- 这是一个友好的URL,只显示该位置的当前评论,但距离登录只差一步。 {place_id}
- 这是直接写评论,但需要用户登录。 {place_id}