{"action":"created","comment":{"url":"https://api.github.com/repos/vk26/spiral/pulls/comments/32532575","id":32532575,"diff_hunk":"@@ -0,0 +1,67 @@\n+require 'open-uri'\n+\n+class Parser\n+  HEADLESS_RUN = true\n+  DELAY_VAL    = 3\n+  AVITO_SOURCE = \"https://www.avito.ru/irkutsk/kvartiry/sdam/na_dlitelnyy_srok\".freeze\n+\n+  def self.get_avito(count = 2)\n+    if HEADLESS_RUN\n+      headless = Headless.new\n+      headless.start\n+    end\n+    \n+    doc = Nokogiri::HTML(open(AVITO_SOURCE));\n+    \n+    doc.css('h3.title a').each_with_index do |ad, index|\n+      break if ++index == count\n+      delay if index != 0\n+      browser = browser_init\n+      item = {}\n+      link = ad['href']\n+      item_doc = Nokogiri::HTML(open(item_link_avito(link)));\n+      item[:renter] = item_doc.css('#seller strong').text.gsub(/\\w|\\s/,'')\n+      item[:description] = item_doc.css('div#desc_text').text\n+      item[:price] = item_doc.css('.p_i_price').text.gsub(/\\D/,'')\n+      item[:city] = item_doc.css('div#map').text\n+      item[:address] = item_doc.css('span#toggle_map').text\n+      item[:id_ad] = item_doc.css('span#toggle_map').text","path":"app/services/parser.rb","position":28,"original_position":28,"commit_id":"6eea412646dcddbcfa8a729a8d6bd1601a39f017","original_commit_id":"6eea412646dcddbcfa8a729a8d6bd1601a39f017","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2015-06-16T15:24:40Z","updated_at":"2015-06-16T15:24:40Z","html_url":"https://github.com/vk26/spiral/pull/3#discussion_r32532575","pull_request_url":"https://api.github.com/repos/vk26/spiral/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/vk26/spiral/pulls/comments/32532575"},"html":{"href":"https://github.com/vk26/spiral/pull/3#discussion_r32532575"},"pull_request":{"href":"https://api.github.com/repos/vk26/spiral/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/vk26/spiral/pulls/3","id":37640951,"html_url":"https://github.com/vk26/spiral/pull/3","diff_url":"https://github.com/vk26/spiral/pull/3.diff","patch_url":"https://github.com/vk26/spiral/pull/3.patch","issue_url":"https://api.github.com/repos/vk26/spiral/issues/3","number":3,"state":"open","locked":false,"title":"Parser","user":{"login":"vk26","id":6065669,"avatar_url":"https://avatars.githubusercontent.com/u/6065669?v=3","gravatar_id":"","url":"https://api.github.com/users/vk26","html_url":"https://github.com/vk26","followers_url":"https://api.github.com/users/vk26/followers","following_url":"https://api.github.com/users/vk26/following{/other_user}","gists_url":"https://api.github.com/users/vk26/gists{/gist_id}","starred_url":"https://api.github.com/users/vk26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vk26/subscriptions","organizations_url":"https://api.github.com/users/vk26/orgs","repos_url":"https://api.github.com/users/vk26/repos","events_url":"https://api.github.com/users/vk26/events{/privacy}","received_events_url":"https://api.github.com/users/vk26/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-14T12:47:28Z","updated_at":"2015-06-16T15:24:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9be387477fbd4bc779fc4819a6d71d8f9474a6e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vk26/spiral/pulls/3/commits","review_comments_url":"https://api.github.com/repos/vk26/spiral/pulls/3/comments","review_comment_url":"https://api.github.com/repos/vk26/spiral/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vk26/spiral/issues/3/comments","statuses_url":"https://api.github.com/repos/vk26/spiral/statuses/6eea412646dcddbcfa8a729a8d6bd1601a39f017","head":{"label":"vk26:parser","ref":"parser","sha":"6eea412646dcddbcfa8a729a8d6bd1601a39f017","user":{"login":"vk26","id":6065669,"avatar_url":"https://avatars.githubusercontent.com/u/6065669?v=3","gravatar_id":"","url":"https://api.github.com/users/vk26","html_url":"https://github.com/vk26","followers_url":"https://api.github.com/users/vk26/followers","following_url":"https://api.github.com/users/vk26/following{/other_user}","gists_url":"https://api.github.com/users/vk26/gists{/gist_id}","starred_url":"https://api.github.com/users/vk26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vk26/subscriptions","organizations_url":"https://api.github.com/users/vk26/orgs","repos_url":"https://api.github.com/users/vk26/repos","events_url":"https://api.github.com/users/vk26/events{/privacy}","received_events_url":"https://api.github.com/users/vk26/received_events","type":"User","site_admin":false},"repo":{"id":36668046,"name":"spiral","full_name":"vk26/spiral","owner":{"login":"vk26","id":6065669,"avatar_url":"https://avatars.githubusercontent.com/u/6065669?v=3","gravatar_id":"","url":"https://api.github.com/users/vk26","html_url":"https://github.com/vk26","followers_url":"https://api.github.com/users/vk26/followers","following_url":"https://api.github.com/users/vk26/following{/other_user}","gists_url":"https://api.github.com/users/vk26/gists{/gist_id}","starred_url":"https://api.github.com/users/vk26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vk26/subscriptions","organizations_url":"https://api.github.com/users/vk26/orgs","repos_url":"https://api.github.com/users/vk26/repos","events_url":"https://api.github.com/users/vk26/events{/privacy}","received_events_url":"https://api.github.com/users/vk26/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vk26/spiral","description":"","fork":false,"url":"https://api.github.com/repos/vk26/spiral","forks_url":"https://api.github.com/repos/vk26/spiral/forks","keys_url":"https://api.github.com/repos/vk26/spiral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vk26/spiral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vk26/spiral/teams","hooks_url":"https://api.github.com/repos/vk26/spiral/hooks","issue_events_url":"https://api.github.com/repos/vk26/spiral/issues/events{/number}","events_url":"https://api.github.com/repos/vk26/spiral/events","assignees_url":"https://api.github.com/repos/vk26/spiral/assignees{/user}","branches_url":"https://api.github.com/repos/vk26/spiral/branches{/branch}","tags_url":"https://api.github.com/repos/vk26/spiral/tags","blobs_url":"https://api.github.com/repos/vk26/spiral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vk26/spiral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vk26/spiral/git/refs{/sha}","trees_url":"https://api.github.com/repos/vk26/spiral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vk26/spiral/statuses/{sha}","languages_url":"https://api.github.com/repos/vk26/spiral/languages","stargazers_url":"https://api.github.com/repos/vk26/spiral/stargazers","contributors_url":"https://api.github.com/repos/vk26/spiral/contributors","subscribers_url":"https://api.github.com/repos/vk26/spiral/subscribers","subscription_url":"https://api.github.com/repos/vk26/spiral/subscription","commits_url":"https://api.github.com/repos/vk26/spiral/commits{/sha}","git_commits_url":"https://api.github.com/repos/vk26/spiral/git/commits{/sha}","comments_url":"https://api.github.com/repos/vk26/spiral/comments{/number}","issue_comment_url":"https://api.github.com/repos/vk26/spiral/issues/comments{/number}","contents_url":"https://api.github.com/repos/vk26/spiral/contents/{+path}","compare_url":"https://api.github.com/repos/vk26/spiral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vk26/spiral/merges","archive_url":"https://api.github.com/repos/vk26/spiral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vk26/spiral/downloads","issues_url":"https://api.github.com/repos/vk26/spiral/issues{/number}","pulls_url":"https://api.github.com/repos/vk26/spiral/pulls{/number}","milestones_url":"https://api.github.com/repos/vk26/spiral/milestones{/number}","notifications_url":"https://api.github.com/repos/vk26/spiral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vk26/spiral/labels{/name}","releases_url":"https://api.github.com/repos/vk26/spiral/releases{/id}","created_at":"2015-06-01T14:58:48Z","updated_at":"2015-06-08T14:48:36Z","pushed_at":"2015-06-16T15:24:30Z","git_url":"git://github.com/vk26/spiral.git","ssh_url":"git@github.com:vk26/spiral.git","clone_url":"https://github.com/vk26/spiral.git","svn_url":"https://github.com/vk26/spiral","homepage":null,"size":236,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"vk26:master","ref":"master","sha":"5dec5d31fdabda6d781a6e577838b4300caae0e6","user":{"login":"vk26","id":6065669,"avatar_url":"https://avatars.githubusercontent.com/u/6065669?v=3","gravatar_id":"","url":"https://api.github.com/users/vk26","html_url":"https://github.com/vk26","followers_url":"https://api.github.com/users/vk26/followers","following_url":"https://api.github.com/users/vk26/following{/other_user}","gists_url":"https://api.github.com/users/vk26/gists{/gist_id}","starred_url":"https://api.github.com/users/vk26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vk26/subscriptions","organizations_url":"https://api.github.com/users/vk26/orgs","repos_url":"https://api.github.com/users/vk26/repos","events_url":"https://api.github.com/users/vk26/events{/privacy}","received_events_url":"https://api.github.com/users/vk26/received_events","type":"User","site_admin":false},"repo":{"id":36668046,"name":"spiral","full_name":"vk26/spiral","owner":{"login":"vk26","id":6065669,"avatar_url":"https://avatars.githubusercontent.com/u/6065669?v=3","gravatar_id":"","url":"https://api.github.com/users/vk26","html_url":"https://github.com/vk26","followers_url":"https://api.github.com/users/vk26/followers","following_url":"https://api.github.com/users/vk26/following{/other_user}","gists_url":"https://api.github.com/users/vk26/gists{/gist_id}","starred_url":"https://api.github.com/users/vk26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vk26/subscriptions","organizations_url":"https://api.github.com/users/vk26/orgs","repos_url":"https://api.github.com/users/vk26/repos","events_url":"https://api.github.com/users/vk26/events{/privacy}","received_events_url":"https://api.github.com/users/vk26/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vk26/spiral","description":"","fork":false,"url":"https://api.github.com/repos/vk26/spiral","forks_url":"https://api.github.com/repos/vk26/spiral/forks","keys_url":"https://api.github.com/repos/vk26/spiral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vk26/spiral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vk26/spiral/teams","hooks_url":"https://api.github.com/repos/vk26/spiral/hooks","issue_events_url":"https://api.github.com/repos/vk26/spiral/issues/events{/number}","events_url":"https://api.github.com/repos/vk26/spiral/events","assignees_url":"https://api.github.com/repos/vk26/spiral/assignees{/user}","branches_url":"https://api.github.com/repos/vk26/spiral/branches{/branch}","tags_url":"https://api.github.com/repos/vk26/spiral/tags","blobs_url":"https://api.github.com/repos/vk26/spiral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vk26/spiral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vk26/spiral/git/refs{/sha}","trees_url":"https://api.github.com/repos/vk26/spiral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vk26/spiral/statuses/{sha}","languages_url":"https://api.github.com/repos/vk26/spiral/languages","stargazers_url":"https://api.github.com/repos/vk26/spiral/stargazers","contributors_url":"https://api.github.com/repos/vk26/spiral/contributors","subscribers_url":"https://api.github.com/repos/vk26/spiral/subscribers","subscription_url":"https://api.github.com/repos/vk26/spiral/subscription","commits_url":"https://api.github.com/repos/vk26/spiral/commits{/sha}","git_commits_url":"https://api.github.com/repos/vk26/spiral/git/commits{/sha}","comments_url":"https://api.github.com/repos/vk26/spiral/comments{/number}","issue_comment_url":"https://api.github.com/repos/vk26/spiral/issues/comments{/number}","contents_url":"https://api.github.com/repos/vk26/spiral/contents/{+path}","compare_url":"https://api.github.com/repos/vk26/spiral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vk26/spiral/merges","archive_url":"https://api.github.com/repos/vk26/spiral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vk26/spiral/downloads","issues_url":"https://api.github.com/repos/vk26/spiral/issues{/number}","pulls_url":"https://api.github.com/repos/vk26/spiral/pulls{/number}","milestones_url":"https://api.github.com/repos/vk26/spiral/milestones{/number}","notifications_url":"https://api.github.com/repos/vk26/spiral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vk26/spiral/labels{/name}","releases_url":"https://api.github.com/repos/vk26/spiral/releases{/id}","created_at":"2015-06-01T14:58:48Z","updated_at":"2015-06-08T14:48:36Z","pushed_at":"2015-06-16T15:24:30Z","git_url":"git://github.com/vk26/spiral.git","ssh_url":"git@github.com:vk26/spiral.git","clone_url":"https://github.com/vk26/spiral.git","svn_url":"https://github.com/vk26/spiral","homepage":null,"size":236,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vk26/spiral/pulls/3"},"html":{"href":"https://github.com/vk26/spiral/pull/3"},"issue":{"href":"https://api.github.com/repos/vk26/spiral/issues/3"},"comments":{"href":"https://api.github.com/repos/vk26/spiral/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/vk26/spiral/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/vk26/spiral/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vk26/spiral/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/vk26/spiral/statuses/6eea412646dcddbcfa8a729a8d6bd1601a39f017"}}}}