{"id":19167196,"url":"https://github.com/dyweb/scala-renren","last_synced_at":"2025-08-03T23:07:02.930Z","repository":{"id":33497813,"uuid":"37143692","full_name":"dyweb/scala-renren","owner":"dyweb","description":"人人好友关系网络","archived":false,"fork":false,"pushed_at":"2016-02-01T03:47:40.000Z","size":29159,"stargazers_count":35,"open_issues_count":0,"forks_count":9,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-07T13:47:53.222Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dyweb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-09T16:20:27.000Z","updated_at":"2024-10-25T16:08:58.000Z","dependencies_parsed_at":"2022-08-07T21:17:16.829Z","dependency_job_id":null,"html_url":"https://github.com/dyweb/scala-renren","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dyweb/scala-renren","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyweb%2Fscala-renren","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyweb%2Fscala-renren/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyweb%2Fscala-renren/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyweb%2Fscala-renren/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dyweb","download_url":"https://codeload.github.com/dyweb/scala-renren/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyweb%2Fscala-renren/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268625009,"owners_count":24280188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T09:36:16.560Z","updated_at":"2025-08-03T23:07:02.893Z","avatar_url":"https://github.com/dyweb.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scarenren\n\nscarenren是一个基于scala的人人分析工具\n\n## 构建\n\n项目使用sbt构建，构建环境为`jdk1.7 scala2.11 sbt 0.13.8`\n\n## 输出\n\n### 好友学校统计\n\n在生成的`Output-Data.txt`中\n\n### 好友关系图\n\n以JFrame的形式展示，并生成在`headless_simple.png`和`headless_simple.svg`中\n\n### 文本格式的好友关系\n\n在`network.txt`中，是语言无关的，可以基于该文本做很多事情。其格式为\n\n\t-Friend(uid, location, name, url)  // 1\n\t--Friend(uid, location, name, url) // 2\n\t--Friend(uid, location, name, url) // 3\n\t...\n\t-Friend(uid, location, name, url)  // 2\n\t--Friend(uid, location, name, url) // 5\n\n其中-代表是节点，--代表由之前-节点指向该--节点的边。比如在此例中，行1为一个节点，行2代表一个由行1节点指向行2节点的一条边。\n\nPS：存储方式略显拙计。\n\n## 使用\n\n首先，新建`userinfo.ini`文件，内容与`userinfo.ini.example`内类似，用于爬取。\n\n然后，编译并运行需要指令`sbt run`，代码只在os x环境下使用过，不知道其他系统会不会有问题，第一次编译可能需要时间比较长，需要下载各种库，之后会快很多。\n\nPS: gephi在导出的时候，会有报错，形如\n\t\n\tjava.lang.InterruptedException: sleep interrupted\n\t\tat java.lang.Thread.sleep(Native Method)\n\t\tat org.gephi.data.attributes.event.AttributeEventManager.run(AttributeEventManager.java:87)\n\t\tat java.lang.Thread.run(Thread.java:745)\n\tjava.lang.InterruptedException\n\t\tat java.lang.Object.wait(Native Method)\n\t\tat java.lang.Object.wait(Object.java:503)\n\t\tat org.gephi.graph.dhns.core.GraphStructure$ViewDestructorThread.run(GraphStructure.java:240)\n\n但是对结果没有影响，run的结果还会是success。这些异常似乎catch不住，有待解决。\n\n## 代码阅读指南（程序执行指南）\n\n程序最主要的类是在renren.scala中，首先程序会读取在`userinfo.ini`中的用户名密码，然后取得用户的好友列表，最后根据好友列表，生成好友关系图。样例如下，原本是带有名字标签在图上的，但为了保护隐私，已和谐。\n\n\u003cfigure\u003e\n\t\u003cimg src=\"http://gaocegege.com/scala-renren/example.png\" height=\"450\"\u003e\n\u003c/figure\u003e\n\n另外在画图的时候使用了gephi-toolkit，现行的情况是，根据[Modularity](https://en.wikipedia.org/wiki/Modularity_\\(networks\\))来决定节点的颜色，节点度来决定节点的大小。\n\n## 未完成\n\n* 优化friendnetwork.scala中的marshal，不需要读入文件时都存入内存，边读入边遍历，可使用解释器模式\n* grapher.scala优化画图风格\n* actor使用到了外部mutable的变量，会有未定义的行为，以后改善。。。\n\n### PS\n\nCode Style在现在看来极其差劲。。。大家将就着看看吧。。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyweb%2Fscala-renren","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdyweb%2Fscala-renren","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyweb%2Fscala-renren/lists"}