{"action":"created","comment":{"url":"https://api.github.com/repos/tchayen/web-crawler/pulls/comments/235828195","pull_request_review_id":177785851,"id":235828195,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTgyODE5NQ==","diff_hunk":"@@ -0,0 +1,98 @@\n+package pl.edu.agh.lab.webcrawler.urls;\n+\n+import java.net.MalformedURLException;\n+import java.net.URL;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\n+\n+public class HTMLLink {\n+\n+    private final HTMLLink parentUrl;\n+    private final int redirectionDepth;\n+    private final URL url;\n+\n+    private static Pattern protocolPattern = Pattern.compile(\".*://.*\");\n+    private static Pattern httpOrHttpsPattern = Pattern.compile(\"^https?://.*\");\n+\n+\n+    public static boolean canBeParsed(String stringURL){\n+        try {\n+            parseUrl(stringURL);\n+            return true;\n+        } catch (MalformedURLException | NotHTMLLinkException ex){\n+            return false;\n+        }\n+    }\n+\n+    private static URL parseUrl(String stringURL) throws MalformedURLException, NotHTMLLinkException {\n+        if(protocolSpecificated(stringURL)){\n+            return prepareURLHavingProtocolSpecificated(stringURL);\n+        } else {\n+            String[] stringURLSplitted =  stringURL.split(\"/\");","path":"src/main/java/pl/edu/agh/lab/webcrawler/urls/HTMLLink.java","position":31,"original_position":31,"commit_id":"9dca3e8b4c48639fbb1f2fbfb5cbe0782beffec8","original_commit_id":"9dca3e8b4c48639fbb1f2fbfb5cbe0782beffec8","user":{"login":"wgslr","id":6932414,"node_id":"MDQ6VXNlcjY5MzI0MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/6932414?v=4","gravatar_id":"","url":"https://api.github.com/users/wgslr","html_url":"https://github.com/wgslr","followers_url":"https://api.github.com/users/wgslr/followers","following_url":"https://api.github.com/users/wgslr/following{/other_user}","gists_url":"https://api.github.com/users/wgslr/gists{/gist_id}","starred_url":"https://api.github.com/users/wgslr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wgslr/subscriptions","organizations_url":"https://api.github.com/users/wgslr/orgs","repos_url":"https://api.github.com/users/wgslr/repos","events_url":"https://api.github.com/users/wgslr/events{/privacy}","received_events_url":"https://api.github.com/users/wgslr/received_events","type":"User","site_admin":false},"body":"Nie wystarczył konstruktor `URL(String)`? Dlaczego musimy sami parsować?","created_at":"2018-11-22T23:14:33Z","updated_at":"2018-11-22T23:46:12Z","html_url":"https://github.com/tchayen/web-crawler/pull/2#discussion_r235828195","pull_request_url":"https://api.github.com/repos/tchayen/web-crawler/pulls/2","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/comments/235828195"},"html":{"href":"https://github.com/tchayen/web-crawler/pull/2#discussion_r235828195"},"pull_request":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/tchayen/web-crawler/pulls/2","id":233081403,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMDgxNDAz","html_url":"https://github.com/tchayen/web-crawler/pull/2","diff_url":"https://github.com/tchayen/web-crawler/pull/2.diff","patch_url":"https://github.com/tchayen/web-crawler/pull/2.patch","issue_url":"https://api.github.com/repos/tchayen/web-crawler/issues/2","number":2,"state":"open","locked":false,"title":"Abstraction over rules that decides whether given link should be craw…","user":{"login":"PawelPeczek","id":32637359,"node_id":"MDQ6VXNlcjMyNjM3MzU5","avatar_url":"https://avatars1.githubusercontent.com/u/32637359?v=4","gravatar_id":"","url":"https://api.github.com/users/PawelPeczek","html_url":"https://github.com/PawelPeczek","followers_url":"https://api.github.com/users/PawelPeczek/followers","following_url":"https://api.github.com/users/PawelPeczek/following{/other_user}","gists_url":"https://api.github.com/users/PawelPeczek/gists{/gist_id}","starred_url":"https://api.github.com/users/PawelPeczek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PawelPeczek/subscriptions","organizations_url":"https://api.github.com/users/PawelPeczek/orgs","repos_url":"https://api.github.com/users/PawelPeczek/repos","events_url":"https://api.github.com/users/PawelPeczek/events{/privacy}","received_events_url":"https://api.github.com/users/PawelPeczek/received_events","type":"User","site_admin":false},"body":"…led.\r\n\r\nDONE:\r\n* implementation\r\n* tests\r\n\r\nTODO:\r\n* input parsing (possibly from command line but better from GUI)","created_at":"2018-11-22T22:40:17Z","updated_at":"2018-11-22T23:46:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbdbbb7a08e9b5943c3b92dd548dbc49223c486c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tchayen/web-crawler/pulls/2/commits","review_comments_url":"https://api.github.com/repos/tchayen/web-crawler/pulls/2/comments","review_comment_url":"https://api.github.com/repos/tchayen/web-crawler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tchayen/web-crawler/issues/2/comments","statuses_url":"https://api.github.com/repos/tchayen/web-crawler/statuses/9dca3e8b4c48639fbb1f2fbfb5cbe0782beffec8","head":{"label":"tchayen:domain-rules-wrapper","ref":"domain-rules-wrapper","sha":"9dca3e8b4c48639fbb1f2fbfb5cbe0782beffec8","user":{"login":"tchayen","id":5769281,"node_id":"MDQ6VXNlcjU3NjkyODE=","avatar_url":"https://avatars1.githubusercontent.com/u/5769281?v=4","gravatar_id":"","url":"https://api.github.com/users/tchayen","html_url":"https://github.com/tchayen","followers_url":"https://api.github.com/users/tchayen/followers","following_url":"https://api.github.com/users/tchayen/following{/other_user}","gists_url":"https://api.github.com/users/tchayen/gists{/gist_id}","starred_url":"https://api.github.com/users/tchayen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchayen/subscriptions","organizations_url":"https://api.github.com/users/tchayen/orgs","repos_url":"https://api.github.com/users/tchayen/repos","events_url":"https://api.github.com/users/tchayen/events{/privacy}","received_events_url":"https://api.github.com/users/tchayen/received_events","type":"User","site_admin":false},"repo":{"id":157571860,"node_id":"MDEwOlJlcG9zaXRvcnkxNTc1NzE4NjA=","name":"web-crawler","full_name":"tchayen/web-crawler","private":false,"owner":{"login":"tchayen","id":5769281,"node_id":"MDQ6VXNlcjU3NjkyODE=","avatar_url":"https://avatars1.githubusercontent.com/u/5769281?v=4","gravatar_id":"","url":"https://api.github.com/users/tchayen","html_url":"https://github.com/tchayen","followers_url":"https://api.github.com/users/tchayen/followers","following_url":"https://api.github.com/users/tchayen/following{/other_user}","gists_url":"https://api.github.com/users/tchayen/gists{/gist_id}","starred_url":"https://api.github.com/users/tchayen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchayen/subscriptions","organizations_url":"https://api.github.com/users/tchayen/orgs","repos_url":"https://api.github.com/users/tchayen/repos","events_url":"https://api.github.com/users/tchayen/events{/privacy}","received_events_url":"https://api.github.com/users/tchayen/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tchayen/web-crawler","description":null,"fork":false,"url":"https://api.github.com/repos/tchayen/web-crawler","forks_url":"https://api.github.com/repos/tchayen/web-crawler/forks","keys_url":"https://api.github.com/repos/tchayen/web-crawler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tchayen/web-crawler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tchayen/web-crawler/teams","hooks_url":"https://api.github.com/repos/tchayen/web-crawler/hooks","issue_events_url":"https://api.github.com/repos/tchayen/web-crawler/issues/events{/number}","events_url":"https://api.github.com/repos/tchayen/web-crawler/events","assignees_url":"https://api.github.com/repos/tchayen/web-crawler/assignees{/user}","branches_url":"https://api.github.com/repos/tchayen/web-crawler/branches{/branch}","tags_url":"https://api.github.com/repos/tchayen/web-crawler/tags","blobs_url":"https://api.github.com/repos/tchayen/web-crawler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tchayen/web-crawler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tchayen/web-crawler/git/refs{/sha}","trees_url":"https://api.github.com/repos/tchayen/web-crawler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tchayen/web-crawler/statuses/{sha}","languages_url":"https://api.github.com/repos/tchayen/web-crawler/languages","stargazers_url":"https://api.github.com/repos/tchayen/web-crawler/stargazers","contributors_url":"https://api.github.com/repos/tchayen/web-crawler/contributors","subscribers_url":"https://api.github.com/repos/tchayen/web-crawler/subscribers","subscription_url":"https://api.github.com/repos/tchayen/web-crawler/subscription","commits_url":"https://api.github.com/repos/tchayen/web-crawler/commits{/sha}","git_commits_url":"https://api.github.com/repos/tchayen/web-crawler/git/commits{/sha}","comments_url":"https://api.github.com/repos/tchayen/web-crawler/comments{/number}","issue_comment_url":"https://api.github.com/repos/tchayen/web-crawler/issues/comments{/number}","contents_url":"https://api.github.com/repos/tchayen/web-crawler/contents/{+path}","compare_url":"https://api.github.com/repos/tchayen/web-crawler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tchayen/web-crawler/merges","archive_url":"https://api.github.com/repos/tchayen/web-crawler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tchayen/web-crawler/downloads","issues_url":"https://api.github.com/repos/tchayen/web-crawler/issues{/number}","pulls_url":"https://api.github.com/repos/tchayen/web-crawler/pulls{/number}","milestones_url":"https://api.github.com/repos/tchayen/web-crawler/milestones{/number}","notifications_url":"https://api.github.com/repos/tchayen/web-crawler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tchayen/web-crawler/labels{/name}","releases_url":"https://api.github.com/repos/tchayen/web-crawler/releases{/id}","deployments_url":"https://api.github.com/repos/tchayen/web-crawler/deployments","created_at":"2018-11-14T15:44:50Z","updated_at":"2018-11-21T16:48:16Z","pushed_at":"2018-11-22T22:40:18Z","git_url":"git://github.com/tchayen/web-crawler.git","ssh_url":"git@github.com:tchayen/web-crawler.git","clone_url":"https://github.com/tchayen/web-crawler.git","svn_url":"https://github.com/tchayen/web-crawler","homepage":"","size":80,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"tchayen:develop","ref":"develop","sha":"8eda45b3b3c08980425366be39b23d98e3a5168c","user":{"login":"tchayen","id":5769281,"node_id":"MDQ6VXNlcjU3NjkyODE=","avatar_url":"https://avatars1.githubusercontent.com/u/5769281?v=4","gravatar_id":"","url":"https://api.github.com/users/tchayen","html_url":"https://github.com/tchayen","followers_url":"https://api.github.com/users/tchayen/followers","following_url":"https://api.github.com/users/tchayen/following{/other_user}","gists_url":"https://api.github.com/users/tchayen/gists{/gist_id}","starred_url":"https://api.github.com/users/tchayen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchayen/subscriptions","organizations_url":"https://api.github.com/users/tchayen/orgs","repos_url":"https://api.github.com/users/tchayen/repos","events_url":"https://api.github.com/users/tchayen/events{/privacy}","received_events_url":"https://api.github.com/users/tchayen/received_events","type":"User","site_admin":false},"repo":{"id":157571860,"node_id":"MDEwOlJlcG9zaXRvcnkxNTc1NzE4NjA=","name":"web-crawler","full_name":"tchayen/web-crawler","private":false,"owner":{"login":"tchayen","id":5769281,"node_id":"MDQ6VXNlcjU3NjkyODE=","avatar_url":"https://avatars1.githubusercontent.com/u/5769281?v=4","gravatar_id":"","url":"https://api.github.com/users/tchayen","html_url":"https://github.com/tchayen","followers_url":"https://api.github.com/users/tchayen/followers","following_url":"https://api.github.com/users/tchayen/following{/other_user}","gists_url":"https://api.github.com/users/tchayen/gists{/gist_id}","starred_url":"https://api.github.com/users/tchayen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchayen/subscriptions","organizations_url":"https://api.github.com/users/tchayen/orgs","repos_url":"https://api.github.com/users/tchayen/repos","events_url":"https://api.github.com/users/tchayen/events{/privacy}","received_events_url":"https://api.github.com/users/tchayen/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tchayen/web-crawler","description":null,"fork":false,"url":"https://api.github.com/repos/tchayen/web-crawler","forks_url":"https://api.github.com/repos/tchayen/web-crawler/forks","keys_url":"https://api.github.com/repos/tchayen/web-crawler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tchayen/web-crawler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tchayen/web-crawler/teams","hooks_url":"https://api.github.com/repos/tchayen/web-crawler/hooks","issue_events_url":"https://api.github.com/repos/tchayen/web-crawler/issues/events{/number}","events_url":"https://api.github.com/repos/tchayen/web-crawler/events","assignees_url":"https://api.github.com/repos/tchayen/web-crawler/assignees{/user}","branches_url":"https://api.github.com/repos/tchayen/web-crawler/branches{/branch}","tags_url":"https://api.github.com/repos/tchayen/web-crawler/tags","blobs_url":"https://api.github.com/repos/tchayen/web-crawler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tchayen/web-crawler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tchayen/web-crawler/git/refs{/sha}","trees_url":"https://api.github.com/repos/tchayen/web-crawler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tchayen/web-crawler/statuses/{sha}","languages_url":"https://api.github.com/repos/tchayen/web-crawler/languages","stargazers_url":"https://api.github.com/repos/tchayen/web-crawler/stargazers","contributors_url":"https://api.github.com/repos/tchayen/web-crawler/contributors","subscribers_url":"https://api.github.com/repos/tchayen/web-crawler/subscribers","subscription_url":"https://api.github.com/repos/tchayen/web-crawler/subscription","commits_url":"https://api.github.com/repos/tchayen/web-crawler/commits{/sha}","git_commits_url":"https://api.github.com/repos/tchayen/web-crawler/git/commits{/sha}","comments_url":"https://api.github.com/repos/tchayen/web-crawler/comments{/number}","issue_comment_url":"https://api.github.com/repos/tchayen/web-crawler/issues/comments{/number}","contents_url":"https://api.github.com/repos/tchayen/web-crawler/contents/{+path}","compare_url":"https://api.github.com/repos/tchayen/web-crawler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tchayen/web-crawler/merges","archive_url":"https://api.github.com/repos/tchayen/web-crawler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tchayen/web-crawler/downloads","issues_url":"https://api.github.com/repos/tchayen/web-crawler/issues{/number}","pulls_url":"https://api.github.com/repos/tchayen/web-crawler/pulls{/number}","milestones_url":"https://api.github.com/repos/tchayen/web-crawler/milestones{/number}","notifications_url":"https://api.github.com/repos/tchayen/web-crawler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tchayen/web-crawler/labels{/name}","releases_url":"https://api.github.com/repos/tchayen/web-crawler/releases{/id}","deployments_url":"https://api.github.com/repos/tchayen/web-crawler/deployments","created_at":"2018-11-14T15:44:50Z","updated_at":"2018-11-21T16:48:16Z","pushed_at":"2018-11-22T22:40:18Z","git_url":"git://github.com/tchayen/web-crawler.git","ssh_url":"git@github.com:tchayen/web-crawler.git","clone_url":"https://github.com/tchayen/web-crawler.git","svn_url":"https://github.com/tchayen/web-crawler","homepage":"","size":80,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/2"},"html":{"href":"https://github.com/tchayen/web-crawler/pull/2"},"issue":{"href":"https://api.github.com/repos/tchayen/web-crawler/issues/2"},"comments":{"href":"https://api.github.com/repos/tchayen/web-crawler/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tchayen/web-crawler/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/tchayen/web-crawler/statuses/9dca3e8b4c48639fbb1f2fbfb5cbe0782beffec8"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"wgslr"}}