从与代码相同的页面获取 +1 数据
有没有什么编码方法可以从当前网站获取+1数据?例如,我知道 Google 的 +1 还没有 API,但是有没有办法搜索在与 php 相同的页面上发布数据的字符串?
搜索aggregateCount 并转到下一个>x<
并在它们之间拉取并将其设置为变量?
我已经看到该按钮以几种不同的方式发布:
<span id="aggregateCount" class="a-Ec-e-fl-Ut-wf">37.6k</span>
<div id="aggregateCount" class="YJ">2</div>
Google 的 javascript 发布 +1 的数量,但它是在代码运行之后,所以我不知道 PHP 是否可以在进程后期获取它。还有其他办法吗?
Is there any coding method to grab +1 data off of the current website? Example, I know there is no API yet for Google's +1 but is there a way to search for the string posting the data on the same page as the php?
Search for aggregateCount and go to next >x<
and pull between those and set it as a variable?
I've seen the button posted in a few different ways:
<span id="aggregateCount" class="a-Ec-e-fl-Ut-wf">37.6k</span>
<div id="aggregateCount" class="YJ">2</div>
Google's javascript posts the number of +1's but it's after code runs so I don't know if PHP can grab it that late in processes. Any other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,确实没有 API,但您可以请求
https://plusone.google.com/u/0/_/+1/fastbutton?url=yoururlencodedpage
,然后查找window.__SSR = {'c': 1.0 ,'is': 0};
字符串。c
值是计数(由于某种原因作为浮点数......)。如果谷歌决定稍微改变一下,就很容易彻底崩溃。如果您个人喜欢该页面(并且由于某种奇怪的原因通过您的代码登录),则window.__SSR
中会有更多数据。There's indeed no API I know of, but you can request
https://plusone.google.com/u/0/_/+1/fastbutton?url=yoururlencodedpage
, and look for thewindow.__SSR = {'c': 1.0 ,'is': 0};
string. Thec
value is the count (as a float for some reason...). Prone to absolute breakage if Google decides to change it in the slightest. If you personnaly liked the page (and are logged in by your code for some weird reason) there's more data inwindow.__SSR
.