{"action":"created","comment":{"url":"https://api.github.com/repos/rhysd/ezoe/pulls/comments/48815150","id":48815150,"diff_hunk":"@@ -10,12 +10,20 @@ require \"cgi\"\n #   def show_questions(user : String) : Nil\n #\n def show_questions(user)\n-  response = HTTP::Client.get \"http://ask.fm/feed/profile/#{user}.rss\"\n+  response = HTTP::Client.get \"https://ask.fm/#{user}\"\n   abort response.status_message unless response.status_code == 200\n \n-  XML.parse(response.body).content.try &.split(/\\n\\s+\\n/)[2..-1].each do |item|\n-    question,answer,time,url = item.split('\\n').map(&.strip) # &. is to_proc operator: http://crystal-lang.org/2013/09/15/to-proc.html\n-    answer = answer.gsub(/質問ではない。?|不?自由/){|m| m.colorize.green}\n+  xpath_items    = \"//div[@class='item streamItem streamItem-answer']\"\n+  xpath_url      = \"div[@class='streamItemContent streamItemContent-footer']/a/@href\"\n+  xpath_question = \"h1[@class='streamItemContent streamItemContent-question']\"\n+  xpath_answer   = \"p[@class='streamItemContent streamItemContent-answer']\"\n+\n+  XML.parse(response.body).xpath_nodes(xpath_items).each do |item|\n+    url      = \"https://ask.fm#{item.xpath_node(xpath_url).text.try &.strip}\"\n+    question = item.xpath_node(xpath_question).text.try &.strip\n+    answer   = item.xpath_node(xpath_answer).text.try &.strip.gsub(/質問ではない。?|不?自由/){|m| m.colorize.green}\n+    abort \"Parse failed.\" unless url || question || answer","path":"src/ezoe.cr","position":29,"original_position":29,"commit_id":"8e2515e3e163d3894a4e86521a5108f3cdae2a1c","original_commit_id":"8e2515e3e163d3894a4e86521a5108f3cdae2a1c","user":{"login":"rhysd","id":823277,"avatar_url":"https://avatars.githubusercontent.com/u/823277?v=3","gravatar_id":"","url":"https://api.github.com/users/rhysd","html_url":"https://github.com/rhysd","followers_url":"https://api.github.com/users/rhysd/followers","following_url":"https://api.github.com/users/rhysd/following{/other_user}","gists_url":"https://api.github.com/users/rhysd/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysd/subscriptions","organizations_url":"https://api.github.com/users/rhysd/orgs","repos_url":"https://api.github.com/users/rhysd/repos","events_url":"https://api.github.com/users/rhysd/events{/privacy}","received_events_url":"https://api.github.com/users/rhysd/received_events","type":"User","site_admin":false},"body":"ここの条件は `url && question && answer` ではないでしょうか？","created_at":"2016-01-05T06:12:07Z","updated_at":"2016-01-05T06:12:07Z","html_url":"https://github.com/rhysd/ezoe/pull/3#discussion_r48815150","pull_request_url":"https://api.github.com/repos/rhysd/ezoe/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/comments/48815150"},"html":{"href":"https://github.com/rhysd/ezoe/pull/3#discussion_r48815150"},"pull_request":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/rhysd/ezoe/pulls/3","id":54991369,"html_url":"https://github.com/rhysd/ezoe/pull/3","diff_url":"https://github.com/rhysd/ezoe/pull/3.diff","patch_url":"https://github.com/rhysd/ezoe/pull/3.patch","issue_url":"https://api.github.com/repos/rhysd/ezoe/issues/3","number":3,"state":"open","locked":false,"title":"Ask.fm spec change","user":{"login":"yantene","id":2714111,"avatar_url":"https://avatars.githubusercontent.com/u/2714111?v=3","gravatar_id":"","url":"https://api.github.com/users/yantene","html_url":"https://github.com/yantene","followers_url":"https://api.github.com/users/yantene/followers","following_url":"https://api.github.com/users/yantene/following{/other_user}","gists_url":"https://api.github.com/users/yantene/gists{/gist_id}","starred_url":"https://api.github.com/users/yantene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yantene/subscriptions","organizations_url":"https://api.github.com/users/yantene/orgs","repos_url":"https://api.github.com/users/yantene/repos","events_url":"https://api.github.com/users/yantene/events{/privacy}","received_events_url":"https://api.github.com/users/yantene/received_events","type":"User","site_admin":false},"body":"show_questions メソッドについて， Ask.fm の仕様変更への対応を行いました．","created_at":"2016-01-04T16:13:51Z","updated_at":"2016-01-05T06:12:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8bf0fd70b8e4051ba809c6495aa0d3ab96eb51a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rhysd/ezoe/pulls/3/commits","review_comments_url":"https://api.github.com/repos/rhysd/ezoe/pulls/3/comments","review_comment_url":"https://api.github.com/repos/rhysd/ezoe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rhysd/ezoe/issues/3/comments","statuses_url":"https://api.github.com/repos/rhysd/ezoe/statuses/8e2515e3e163d3894a4e86521a5108f3cdae2a1c","head":{"label":"yantene:ask_spec_change","ref":"ask_spec_change","sha":"8e2515e3e163d3894a4e86521a5108f3cdae2a1c","user":{"login":"yantene","id":2714111,"avatar_url":"https://avatars.githubusercontent.com/u/2714111?v=3","gravatar_id":"","url":"https://api.github.com/users/yantene","html_url":"https://github.com/yantene","followers_url":"https://api.github.com/users/yantene/followers","following_url":"https://api.github.com/users/yantene/following{/other_user}","gists_url":"https://api.github.com/users/yantene/gists{/gist_id}","starred_url":"https://api.github.com/users/yantene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yantene/subscriptions","organizations_url":"https://api.github.com/users/yantene/orgs","repos_url":"https://api.github.com/users/yantene/repos","events_url":"https://api.github.com/users/yantene/events{/privacy}","received_events_url":"https://api.github.com/users/yantene/received_events","type":"User","site_admin":false},"repo":{"id":48791748,"name":"ezoe","full_name":"yantene/ezoe","owner":{"login":"yantene","id":2714111,"avatar_url":"https://avatars.githubusercontent.com/u/2714111?v=3","gravatar_id":"","url":"https://api.github.com/users/yantene","html_url":"https://github.com/yantene","followers_url":"https://api.github.com/users/yantene/followers","following_url":"https://api.github.com/users/yantene/following{/other_user}","gists_url":"https://api.github.com/users/yantene/gists{/gist_id}","starred_url":"https://api.github.com/users/yantene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yantene/subscriptions","organizations_url":"https://api.github.com/users/yantene/orgs","repos_url":"https://api.github.com/users/yantene/repos","events_url":"https://api.github.com/users/yantene/events{/privacy}","received_events_url":"https://api.github.com/users/yantene/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yantene/ezoe","description":"`ezoe` command written in Crystal","fork":true,"url":"https://api.github.com/repos/yantene/ezoe","forks_url":"https://api.github.com/repos/yantene/ezoe/forks","keys_url":"https://api.github.com/repos/yantene/ezoe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yantene/ezoe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yantene/ezoe/teams","hooks_url":"https://api.github.com/repos/yantene/ezoe/hooks","issue_events_url":"https://api.github.com/repos/yantene/ezoe/issues/events{/number}","events_url":"https://api.github.com/repos/yantene/ezoe/events","assignees_url":"https://api.github.com/repos/yantene/ezoe/assignees{/user}","branches_url":"https://api.github.com/repos/yantene/ezoe/branches{/branch}","tags_url":"https://api.github.com/repos/yantene/ezoe/tags","blobs_url":"https://api.github.com/repos/yantene/ezoe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yantene/ezoe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yantene/ezoe/git/refs{/sha}","trees_url":"https://api.github.com/repos/yantene/ezoe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yantene/ezoe/statuses/{sha}","languages_url":"https://api.github.com/repos/yantene/ezoe/languages","stargazers_url":"https://api.github.com/repos/yantene/ezoe/stargazers","contributors_url":"https://api.github.com/repos/yantene/ezoe/contributors","subscribers_url":"https://api.github.com/repos/yantene/ezoe/subscribers","subscription_url":"https://api.github.com/repos/yantene/ezoe/subscription","commits_url":"https://api.github.com/repos/yantene/ezoe/commits{/sha}","git_commits_url":"https://api.github.com/repos/yantene/ezoe/git/commits{/sha}","comments_url":"https://api.github.com/repos/yantene/ezoe/comments{/number}","issue_comment_url":"https://api.github.com/repos/yantene/ezoe/issues/comments{/number}","contents_url":"https://api.github.com/repos/yantene/ezoe/contents/{+path}","compare_url":"https://api.github.com/repos/yantene/ezoe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yantene/ezoe/merges","archive_url":"https://api.github.com/repos/yantene/ezoe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yantene/ezoe/downloads","issues_url":"https://api.github.com/repos/yantene/ezoe/issues{/number}","pulls_url":"https://api.github.com/repos/yantene/ezoe/pulls{/number}","milestones_url":"https://api.github.com/repos/yantene/ezoe/milestones{/number}","notifications_url":"https://api.github.com/repos/yantene/ezoe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yantene/ezoe/labels{/name}","releases_url":"https://api.github.com/repos/yantene/ezoe/releases{/id}","created_at":"2015-12-30T08:53:07Z","updated_at":"2015-12-30T08:53:08Z","pushed_at":"2016-01-04T16:12:29Z","git_url":"git://github.com/yantene/ezoe.git","ssh_url":"git@github.com:yantene/ezoe.git","clone_url":"https://github.com/yantene/ezoe.git","svn_url":"https://github.com/yantene/ezoe","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Crystal","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rhysd:master","ref":"master","sha":"1adf753e39a4541544b00e39f33458c7562a9092","user":{"login":"rhysd","id":823277,"avatar_url":"https://avatars.githubusercontent.com/u/823277?v=3","gravatar_id":"","url":"https://api.github.com/users/rhysd","html_url":"https://github.com/rhysd","followers_url":"https://api.github.com/users/rhysd/followers","following_url":"https://api.github.com/users/rhysd/following{/other_user}","gists_url":"https://api.github.com/users/rhysd/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysd/subscriptions","organizations_url":"https://api.github.com/users/rhysd/orgs","repos_url":"https://api.github.com/users/rhysd/repos","events_url":"https://api.github.com/users/rhysd/events{/privacy}","received_events_url":"https://api.github.com/users/rhysd/received_events","type":"User","site_admin":false},"repo":{"id":37531733,"name":"ezoe","full_name":"rhysd/ezoe","owner":{"login":"rhysd","id":823277,"avatar_url":"https://avatars.githubusercontent.com/u/823277?v=3","gravatar_id":"","url":"https://api.github.com/users/rhysd","html_url":"https://github.com/rhysd","followers_url":"https://api.github.com/users/rhysd/followers","following_url":"https://api.github.com/users/rhysd/following{/other_user}","gists_url":"https://api.github.com/users/rhysd/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysd/subscriptions","organizations_url":"https://api.github.com/users/rhysd/orgs","repos_url":"https://api.github.com/users/rhysd/repos","events_url":"https://api.github.com/users/rhysd/events{/privacy}","received_events_url":"https://api.github.com/users/rhysd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhysd/ezoe","description":"`ezoe` command written in Crystal","fork":false,"url":"https://api.github.com/repos/rhysd/ezoe","forks_url":"https://api.github.com/repos/rhysd/ezoe/forks","keys_url":"https://api.github.com/repos/rhysd/ezoe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhysd/ezoe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhysd/ezoe/teams","hooks_url":"https://api.github.com/repos/rhysd/ezoe/hooks","issue_events_url":"https://api.github.com/repos/rhysd/ezoe/issues/events{/number}","events_url":"https://api.github.com/repos/rhysd/ezoe/events","assignees_url":"https://api.github.com/repos/rhysd/ezoe/assignees{/user}","branches_url":"https://api.github.com/repos/rhysd/ezoe/branches{/branch}","tags_url":"https://api.github.com/repos/rhysd/ezoe/tags","blobs_url":"https://api.github.com/repos/rhysd/ezoe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhysd/ezoe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhysd/ezoe/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhysd/ezoe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhysd/ezoe/statuses/{sha}","languages_url":"https://api.github.com/repos/rhysd/ezoe/languages","stargazers_url":"https://api.github.com/repos/rhysd/ezoe/stargazers","contributors_url":"https://api.github.com/repos/rhysd/ezoe/contributors","subscribers_url":"https://api.github.com/repos/rhysd/ezoe/subscribers","subscription_url":"https://api.github.com/repos/rhysd/ezoe/subscription","commits_url":"https://api.github.com/repos/rhysd/ezoe/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhysd/ezoe/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhysd/ezoe/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhysd/ezoe/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhysd/ezoe/contents/{+path}","compare_url":"https://api.github.com/repos/rhysd/ezoe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhysd/ezoe/merges","archive_url":"https://api.github.com/repos/rhysd/ezoe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhysd/ezoe/downloads","issues_url":"https://api.github.com/repos/rhysd/ezoe/issues{/number}","pulls_url":"https://api.github.com/repos/rhysd/ezoe/pulls{/number}","milestones_url":"https://api.github.com/repos/rhysd/ezoe/milestones{/number}","notifications_url":"https://api.github.com/repos/rhysd/ezoe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhysd/ezoe/labels{/name}","releases_url":"https://api.github.com/repos/rhysd/ezoe/releases{/id}","created_at":"2015-06-16T13:27:02Z","updated_at":"2015-06-24T10:16:59Z","pushed_at":"2016-01-04T16:13:52Z","git_url":"git://github.com/rhysd/ezoe.git","ssh_url":"git@github.com:rhysd/ezoe.git","clone_url":"https://github.com/rhysd/ezoe.git","svn_url":"https://github.com/rhysd/ezoe","homepage":null,"size":130,"stargazers_count":7,"watchers_count":7,"language":"Crystal","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/3"},"html":{"href":"https://github.com/rhysd/ezoe/pull/3"},"issue":{"href":"https://api.github.com/repos/rhysd/ezoe/issues/3"},"comments":{"href":"https://api.github.com/repos/rhysd/ezoe/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rhysd/ezoe/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/rhysd/ezoe/statuses/8e2515e3e163d3894a4e86521a5108f3cdae2a1c"}}}}