Coder Social home page Coder Social logo

获取训练样本的思路 about auto-review HOT 5 CLOSED

poblue avatar poblue commented on August 29, 2024 1
获取训练样本的思路

from auto-review.

Comments (5)

PoBlue avatar PoBlue commented on August 29, 2024 1

解密 base64

https://review-api.udacity.com/api/v1/submissions/795832/contents.json

因为好奇,认为 review 里面不可能没有代码内容的。为了找出内容,先对内容有很大概率存储地方检查一遍,先检查 content.json 里面的。就凭它的名字叫 contents 。。。

发现里面有个键值并不了解的,就是 blob。打开会看到一群乱码

然后稍微了解了上面链接的 blob 键值。查了一番文件的编码方式。试了常用的 encode 方式对乱码进行 decode。发现原来文件内容是通过 base64 的方式进行编码, 解密如下:

2017-10-18 3 49 09

有了这个,就不用 python 对项目文件解释了。直接对 Blod 用 base64 解密就行了

参考链接

  1. Binary-to-text encoding
  2. Content-Transfer-Encoding
  3. Base64
  4. Blob

from auto-review.

PoBlue avatar PoBlue commented on August 29, 2024

Review 评论数据分析

获取原始的数据

2017-10-16 4 10 14

2017-10-16 4 10 26

通过使用 Chrome 监听返回的文件,揪出了评论的 json 文件

https://review-api.udacity.com/api/v1/submissions/271387/contents.json

只要改改 id 就可以直接获取,但是发现评论的具体内容被加密了。

解密的思路:因为解密不可能是发生在服务器身上的,那么就很大概率在本地的 js 文件上了。看来要对 js 文件打断点,找出数据显示前执行的方法。然后揪出解密代码

揪出来了,原来不是加密,直接利用数据里的 id 就能获取评论了。果然方便~

只要将下面链接的 id 和上面链接返回的 json id 相对应就行了

https://review-api.udacity.com/api/v1/contents/7911600/comments.json

2017-10-16 4 28 47

获取对应位置的语句

这个就只能下载项目文件,再找文件里对应位置的语句。用 python 处理文件,这一步很容易完成。只是这样爬取样本花的时间估计会比预计的长

from auto-review.

PoBlue avatar PoBlue commented on August 29, 2024

其它的一些数据链接

下面的链接可以取出的数据:review 和用户的信息,完成时间和 assign 时间,还有项目语言,项目文件

https://review-api.udacity.com/api/v1/submissions/271687.json

from auto-review.

PoBlue avatar PoBlue commented on August 29, 2024

服务器负载的考虑

同一 ip 同一账号单位时间内对服务器请求数次过多,必然会被禁掉。单独开个账号,时间控制在 5 分钟左右请求一份 Review。这样大概一天 300 份

一天的 Review 数量 = 24 * 12 = 288 份

from auto-review.

PoBlue avatar PoBlue commented on August 29, 2024

最近改版,普通账户无法看非自己的 Review 了,错失良机了,以后有机会有想法再研究 😢

from auto-review.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.