在 Reddit 上,脚本如何获得评论的赞成票和反对票数? [英] On Reddit, how do scripts get the number of upvotes and downvotes for a comment?

查看:23
本文介绍了在 Reddit 上,脚本如何获得评论的赞成票和反对票数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Reddit 上,人们可以发表评论以获得赞成票和反对票.这些信息在页面本身并不容易访问,因此似乎使用了 API 之类的东西来收集这些信息.

On Reddit, people can post comments that get upvotes and downvotes. This information is not readily accessible on the page itself, so it seems that something like an API is used to gather this information.

我找到了执行此操作的脚本,但我无法确定它在脚本中的哪个位置从中提取此信息.有人可以指出我从脚本获取数据的相关行吗?

I found this script that does this, but am unable to determine where in the script it pulls this information from. Could someone point me to the relevant line where the script gets the data from?

推荐答案

每条评论都有 data 属性:

Each comment has data attributes:

<div class="thing id-t1_c4upmtm odd comment " onclick="click_thing(this)" data-fullname="t1_c4upmtm" data-ups="646" data-downs="83">

Reddit 的 HTML 结构真的很难理解,所以想办法从评论 ID 到包含这些内容的元素.

Reddit's HTML structure is really hard to follow so figure out a way to get from the comment ID to the element which contains this stuff.

这篇关于在 Reddit 上,脚本如何获得评论的赞成票和反对票数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆