by_crawler 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/by_crawler.iml +22 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +411 -0
- data/.rspec +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +4 -0
- data/bin/by_crawler +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/by_crawler.gemspec +31 -0
- data/lib/by_crawler.rb +27 -0
- data/lib/by_crawler/command_line_argument_parser.rb +56 -0
- data/lib/by_crawler/spider.rb +86 -0
- data/lib/by_crawler/url_store.rb +23 -0
- data/lib/by_crawler/url_utils.rb +57 -0
- data/lib/by_crawler/version.rb +3 -0
- data/resource/urls.txt +2 -0
- metadata +124 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2454acc88653c3b9a83aab9f9826a3c221e9675768e2fdf0143d0750f0e50b08
|
|
4
|
+
data.tar.gz: fe63f2f669c700af7faff10a9cbfd3d891457c4547f8650a4d540d6289a27549
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 36514a491647caad4840f869845135b80c4e04eb4be3cf128dec5d53a3923caf2402451cd6c69a5de0e97f0c7e119976f80f19bd09aa9360cefcf5335c37e15e
|
|
7
|
+
data.tar.gz: 8d1c460b8f66d1609636d6ae6877b210e89ee2868f4cb042542f6d36741761dcda0465b240e1ea2d9f5f8e7977781460a5946e63ea73edc256105b2ceac302eb
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build by_crawler-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install by_crawler-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install by_crawler-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push by_crawler-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.3, ruby-2.6.6-p146) [gem]" level="application" />
|
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.3, ruby-2.6.6-p146) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.6.6-p146) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, ruby-2.6.6-p146) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.13.1, ruby-2.6.6-p146) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, ruby-2.6.6-p146) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, ruby-2.6.6-p146) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, ruby-2.6.6-p146) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, ruby-2.6.6-p146) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, ruby-2.6.6-p146) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, ruby-2.6.6-p146) [gem]" level="application" />
|
|
21
|
+
</component>
|
|
22
|
+
</module>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.6-p146" project-jdk-type="RUBY_SDK" />
|
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/by_crawler.iml" filepath="$PROJECT_DIR$/.idea/by_crawler.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="951dfaf1-fe62-449b-b7d2-e8b602086f46" name="Default Changelist" comment="">
|
|
5
|
+
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
|
6
|
+
<change afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" afterDir="false" />
|
|
7
|
+
<change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
|
|
8
|
+
<change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
|
|
9
|
+
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
10
|
+
<change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
|
|
11
|
+
<change afterPath="$PROJECT_DIR$/bin/by_crawler" afterDir="false" />
|
|
12
|
+
<change afterPath="$PROJECT_DIR$/bin/console" afterDir="false" />
|
|
13
|
+
<change afterPath="$PROJECT_DIR$/bin/setup" afterDir="false" />
|
|
14
|
+
<change afterPath="$PROJECT_DIR$/by_crawler.gemspec" afterDir="false" />
|
|
15
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler.rb" afterDir="false" />
|
|
16
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler/command_line_argument_parser.rb" afterDir="false" />
|
|
17
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler/spider.rb" afterDir="false" />
|
|
18
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler/url_store.rb" afterDir="false" />
|
|
19
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler/url_utils.rb" afterDir="false" />
|
|
20
|
+
<change afterPath="$PROJECT_DIR$/lib/by_crawler/version.rb" afterDir="false" />
|
|
21
|
+
<change afterPath="$PROJECT_DIR$/resource/urls.txt" afterDir="false" />
|
|
22
|
+
</list>
|
|
23
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
24
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
25
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
26
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
27
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
28
|
+
</component>
|
|
29
|
+
<component name="FileEditorManager">
|
|
30
|
+
<leaf>
|
|
31
|
+
<file pinned="false" current-in-tab="false">
|
|
32
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
|
33
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
34
|
+
<state relative-caret-position="60">
|
|
35
|
+
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
|
36
|
+
</state>
|
|
37
|
+
</provider>
|
|
38
|
+
</entry>
|
|
39
|
+
</file>
|
|
40
|
+
<file pinned="false" current-in-tab="true">
|
|
41
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler.rb">
|
|
42
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
43
|
+
<state relative-caret-position="315">
|
|
44
|
+
<caret line="21" column="19" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
|
45
|
+
</state>
|
|
46
|
+
</provider>
|
|
47
|
+
</entry>
|
|
48
|
+
</file>
|
|
49
|
+
<file pinned="false" current-in-tab="false">
|
|
50
|
+
<entry file="file://$PROJECT_DIR$/bin/by_crawler">
|
|
51
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
52
|
+
<state relative-caret-position="45">
|
|
53
|
+
<caret line="3" column="13" lean-forward="true" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
|
|
54
|
+
</state>
|
|
55
|
+
</provider>
|
|
56
|
+
</entry>
|
|
57
|
+
</file>
|
|
58
|
+
<file pinned="false" current-in-tab="false">
|
|
59
|
+
<entry file="file://$PROJECT_DIR$/resource/urls.txt">
|
|
60
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
61
|
+
<state relative-caret-position="15">
|
|
62
|
+
<caret line="1" column="30" lean-forward="true" selection-start-line="1" selection-start-column="30" selection-end-line="1" selection-end-column="30" />
|
|
63
|
+
</state>
|
|
64
|
+
</provider>
|
|
65
|
+
</entry>
|
|
66
|
+
</file>
|
|
67
|
+
<file pinned="false" current-in-tab="false">
|
|
68
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs26/basic_object.rb">
|
|
69
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
70
|
+
<state relative-caret-position="187">
|
|
71
|
+
<caret line="231" column="8" selection-start-line="231" selection-start-column="8" selection-end-line="231" selection-end-column="8" />
|
|
72
|
+
</state>
|
|
73
|
+
</provider>
|
|
74
|
+
</entry>
|
|
75
|
+
</file>
|
|
76
|
+
<file pinned="false" current-in-tab="false">
|
|
77
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/version.rb">
|
|
78
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
79
|
+
</entry>
|
|
80
|
+
</file>
|
|
81
|
+
<file pinned="false" current-in-tab="false">
|
|
82
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/command_line_argument_parser.rb">
|
|
83
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
84
|
+
<state relative-caret-position="187">
|
|
85
|
+
<caret line="33" column="21" selection-start-line="33" selection-start-column="21" selection-end-line="33" selection-end-column="21" />
|
|
86
|
+
</state>
|
|
87
|
+
</provider>
|
|
88
|
+
</entry>
|
|
89
|
+
</file>
|
|
90
|
+
<file pinned="false" current-in-tab="false">
|
|
91
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/url_store.rb">
|
|
92
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
93
|
+
<state relative-caret-position="135">
|
|
94
|
+
<caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
|
|
95
|
+
</state>
|
|
96
|
+
</provider>
|
|
97
|
+
</entry>
|
|
98
|
+
</file>
|
|
99
|
+
<file pinned="false" current-in-tab="false">
|
|
100
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/url_utils.rb">
|
|
101
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
102
|
+
<state relative-caret-position="304">
|
|
103
|
+
<caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
|
|
104
|
+
</state>
|
|
105
|
+
</provider>
|
|
106
|
+
</entry>
|
|
107
|
+
</file>
|
|
108
|
+
<file pinned="false" current-in-tab="false">
|
|
109
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/spider.rb">
|
|
110
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
111
|
+
<state relative-caret-position="240">
|
|
112
|
+
<caret line="16" column="20" selection-start-line="16" selection-start-column="20" selection-end-line="16" selection-end-column="20" />
|
|
113
|
+
</state>
|
|
114
|
+
</provider>
|
|
115
|
+
</entry>
|
|
116
|
+
</file>
|
|
117
|
+
</leaf>
|
|
118
|
+
</component>
|
|
119
|
+
<component name="FileTemplateManagerImpl">
|
|
120
|
+
<option name="RECENT_TEMPLATES">
|
|
121
|
+
<list>
|
|
122
|
+
<option value="Ruby Module" />
|
|
123
|
+
<option value="Ruby Class" />
|
|
124
|
+
<option value="Ruby File" />
|
|
125
|
+
</list>
|
|
126
|
+
</option>
|
|
127
|
+
</component>
|
|
128
|
+
<component name="FindInProjectRecents">
|
|
129
|
+
<findStrings>
|
|
130
|
+
<find>urls_list</find>
|
|
131
|
+
<find>ByCrawler</find>
|
|
132
|
+
</findStrings>
|
|
133
|
+
</component>
|
|
134
|
+
<component name="Git.Settings">
|
|
135
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
136
|
+
</component>
|
|
137
|
+
<component name="IdeDocumentHistory">
|
|
138
|
+
<option name="CHANGED_PATHS">
|
|
139
|
+
<list>
|
|
140
|
+
<option value="$PROJECT_DIR$/by_crawler.gemspec" />
|
|
141
|
+
<option value="$PROJECT_DIR$/spec/spec_helper.rb" />
|
|
142
|
+
<option value="$PROJECT_DIR$/Rakefile" />
|
|
143
|
+
<option value="$PROJECT_DIR$/lib/by_crawler/url_utils.rb" />
|
|
144
|
+
<option value="$PROJECT_DIR$/lib/by_crawler/spider.rb" />
|
|
145
|
+
<option value="$PROJECT_DIR$/lib/by_crawler/command_line_argument_parser.rb" />
|
|
146
|
+
<option value="$PROJECT_DIR$/lib/by_crawler/url_store.rb" />
|
|
147
|
+
<option value="$PROJECT_DIR$/lib/by_crawler.rb" />
|
|
148
|
+
<option value="$PROJECT_DIR$/bin/by_crawler" />
|
|
149
|
+
<option value="$PROJECT_DIR$/bin/by_crawler.rb" />
|
|
150
|
+
<option value="$PROJECT_DIR$/resource/urls.txt" />
|
|
151
|
+
</list>
|
|
152
|
+
</option>
|
|
153
|
+
</component>
|
|
154
|
+
<component name="ProjectConfigurationFiles">
|
|
155
|
+
<option name="files">
|
|
156
|
+
<list>
|
|
157
|
+
<option value="$PROJECT_DIR$/.idea/by_crawler.iml" />
|
|
158
|
+
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
|
159
|
+
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
|
160
|
+
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
|
161
|
+
<option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
|
162
|
+
</list>
|
|
163
|
+
</option>
|
|
164
|
+
</component>
|
|
165
|
+
<component name="ProjectFrameBounds">
|
|
166
|
+
<option name="x" value="250" />
|
|
167
|
+
<option name="y" value="52" />
|
|
168
|
+
<option name="width" value="1400" />
|
|
169
|
+
<option name="height" value="1000" />
|
|
170
|
+
</component>
|
|
171
|
+
<component name="ProjectView">
|
|
172
|
+
<navigator proportions="" version="1">
|
|
173
|
+
<foldersAlwaysOnTop value="true" />
|
|
174
|
+
</navigator>
|
|
175
|
+
<panes>
|
|
176
|
+
<pane id="Scope" />
|
|
177
|
+
<pane id="ProjectPane">
|
|
178
|
+
<subPane>
|
|
179
|
+
<expand>
|
|
180
|
+
<path>
|
|
181
|
+
<item name="by_crawler" type="b2602c69:ProjectViewProjectNode" />
|
|
182
|
+
<item name="by_crawler" type="462c0819:PsiDirectoryNode" />
|
|
183
|
+
</path>
|
|
184
|
+
<path>
|
|
185
|
+
<item name="by_crawler" type="b2602c69:ProjectViewProjectNode" />
|
|
186
|
+
<item name="by_crawler" type="462c0819:PsiDirectoryNode" />
|
|
187
|
+
<item name="resource" type="462c0819:PsiDirectoryNode" />
|
|
188
|
+
</path>
|
|
189
|
+
</expand>
|
|
190
|
+
<select />
|
|
191
|
+
</subPane>
|
|
192
|
+
</pane>
|
|
193
|
+
</panes>
|
|
194
|
+
</component>
|
|
195
|
+
<component name="PropertiesComponent">
|
|
196
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
197
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
198
|
+
<property name="node.js.detected.package.eslint" value="true" />
|
|
199
|
+
<property name="node.js.detected.package.tslint" value="true" />
|
|
200
|
+
<property name="node.js.path.for.package.eslint" value="project" />
|
|
201
|
+
<property name="node.js.path.for.package.tslint" value="project" />
|
|
202
|
+
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
|
203
|
+
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
|
204
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
|
205
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
206
|
+
</component>
|
|
207
|
+
<component name="RunDashboard">
|
|
208
|
+
<option name="ruleStates">
|
|
209
|
+
<list>
|
|
210
|
+
<RuleState>
|
|
211
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
|
212
|
+
</RuleState>
|
|
213
|
+
<RuleState>
|
|
214
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
|
215
|
+
</RuleState>
|
|
216
|
+
</list>
|
|
217
|
+
</option>
|
|
218
|
+
</component>
|
|
219
|
+
<component name="RunManager" selected="Ruby.by_crawler">
|
|
220
|
+
<configuration name="by_crawler" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
|
|
221
|
+
<module name="by_crawler" />
|
|
222
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
|
223
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib" />
|
|
224
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
225
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
226
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
|
227
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
228
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
229
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
|
|
230
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
231
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
232
|
+
</COVERAGE_PATTERN>
|
|
233
|
+
</EXTENSION>
|
|
234
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/by_crawler.rb" />
|
|
235
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
|
236
|
+
<method v="2" />
|
|
237
|
+
</configuration>
|
|
238
|
+
<configuration name="command_line_argument_parser" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
|
|
239
|
+
<module name="by_crawler" />
|
|
240
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
|
241
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/by_crawler" />
|
|
242
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
243
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
244
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
|
245
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
246
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
247
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
|
|
248
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
249
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
250
|
+
</COVERAGE_PATTERN>
|
|
251
|
+
</EXTENSION>
|
|
252
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/by_crawler/command_line_argument_parser.rb" />
|
|
253
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
|
254
|
+
<method v="2" />
|
|
255
|
+
</configuration>
|
|
256
|
+
<recent_temporary>
|
|
257
|
+
<list>
|
|
258
|
+
<item itemvalue="Ruby.by_crawler" />
|
|
259
|
+
<item itemvalue="Ruby.command_line_argument_parser" />
|
|
260
|
+
</list>
|
|
261
|
+
</recent_temporary>
|
|
262
|
+
</component>
|
|
263
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
|
264
|
+
<component name="SvnConfiguration">
|
|
265
|
+
<configuration />
|
|
266
|
+
</component>
|
|
267
|
+
<component name="TaskManager">
|
|
268
|
+
<task active="true" id="Default" summary="Default task">
|
|
269
|
+
<changelist id="951dfaf1-fe62-449b-b7d2-e8b602086f46" name="Default Changelist" comment="" />
|
|
270
|
+
<created>1592970041828</created>
|
|
271
|
+
<option name="number" value="Default" />
|
|
272
|
+
<option name="presentableId" value="Default" />
|
|
273
|
+
<updated>1592970041828</updated>
|
|
274
|
+
<workItem from="1592970042966" duration="10126000" />
|
|
275
|
+
</task>
|
|
276
|
+
<servers />
|
|
277
|
+
</component>
|
|
278
|
+
<component name="TimeTrackingManager">
|
|
279
|
+
<option name="totallyTimeSpent" value="10126000" />
|
|
280
|
+
</component>
|
|
281
|
+
<component name="ToolWindowManager">
|
|
282
|
+
<frame x="250" y="52" width="1400" height="1000" extended-state="0" />
|
|
283
|
+
<layout>
|
|
284
|
+
<window_info id="Favorites" side_tool="true" />
|
|
285
|
+
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2496318" />
|
|
286
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
287
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
|
288
|
+
<window_info anchor="bottom" id="Database Changes" />
|
|
289
|
+
<window_info anchor="bottom" id="Version Control" />
|
|
290
|
+
<window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32929516" />
|
|
291
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
292
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
|
293
|
+
<window_info anchor="bottom" id="Find" order="1" weight="0.32929516" />
|
|
294
|
+
<window_info anchor="bottom" id="Run" order="2" weight="0.32929516" />
|
|
295
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
296
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
|
297
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
|
298
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
|
299
|
+
<window_info anchor="right" id="Database" />
|
|
300
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
|
301
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
|
302
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
303
|
+
</layout>
|
|
304
|
+
</component>
|
|
305
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
306
|
+
<option name="version" value="1" />
|
|
307
|
+
</component>
|
|
308
|
+
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
|
309
|
+
<SUITE FILE_PATH="coverage/by_crawler@by_crawler.rcov" NAME="by_crawler Coverage Results" MODIFIED="1592987586573" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib" MODULE_NAME="by_crawler" />
|
|
310
|
+
<SUITE FILE_PATH="coverage/by_crawler@command_line_argument_parser.rcov" NAME="command_line_argument_parser Coverage Results" MODIFIED="1592982065753" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/by_crawler" MODULE_NAME="by_crawler" />
|
|
311
|
+
</component>
|
|
312
|
+
<component name="editorHistoryManager">
|
|
313
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
314
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
315
|
+
</entry>
|
|
316
|
+
<entry file="file://$PROJECT_DIR$/by_crawler.gemspec">
|
|
317
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
318
|
+
<state relative-caret-position="255">
|
|
319
|
+
<caret line="17" column="71" selection-start-line="17" selection-start-column="71" selection-end-line="17" selection-end-column="71" />
|
|
320
|
+
</state>
|
|
321
|
+
</provider>
|
|
322
|
+
</entry>
|
|
323
|
+
<entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
|
|
324
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
325
|
+
<state>
|
|
326
|
+
<caret column="19" selection-start-column="19" selection-end-column="19" />
|
|
327
|
+
</state>
|
|
328
|
+
</provider>
|
|
329
|
+
</entry>
|
|
330
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs26/kernel.rb">
|
|
331
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
332
|
+
<state>
|
|
333
|
+
<caret line="974" selection-start-line="974" selection-end-line="974" />
|
|
334
|
+
</state>
|
|
335
|
+
</provider>
|
|
336
|
+
</entry>
|
|
337
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/url_utils.rb">
|
|
338
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
339
|
+
<state relative-caret-position="304">
|
|
340
|
+
<caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
|
|
341
|
+
</state>
|
|
342
|
+
</provider>
|
|
343
|
+
</entry>
|
|
344
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/command_line_argument_parser.rb">
|
|
345
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
346
|
+
<state relative-caret-position="187">
|
|
347
|
+
<caret line="33" column="21" selection-start-line="33" selection-start-column="21" selection-end-line="33" selection-end-column="21" />
|
|
348
|
+
</state>
|
|
349
|
+
</provider>
|
|
350
|
+
</entry>
|
|
351
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/url_store.rb">
|
|
352
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
353
|
+
<state relative-caret-position="135">
|
|
354
|
+
<caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
|
|
355
|
+
</state>
|
|
356
|
+
</provider>
|
|
357
|
+
</entry>
|
|
358
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/version.rb">
|
|
359
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
360
|
+
</entry>
|
|
361
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
|
362
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
363
|
+
<state relative-caret-position="60">
|
|
364
|
+
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
|
365
|
+
</state>
|
|
366
|
+
</provider>
|
|
367
|
+
</entry>
|
|
368
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs26/basic_object.rb">
|
|
369
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
370
|
+
<state relative-caret-position="187">
|
|
371
|
+
<caret line="231" column="8" selection-start-line="231" selection-start-column="8" selection-end-line="231" selection-end-column="8" />
|
|
372
|
+
</state>
|
|
373
|
+
</provider>
|
|
374
|
+
</entry>
|
|
375
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler/spider.rb">
|
|
376
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
377
|
+
<state relative-caret-position="240">
|
|
378
|
+
<caret line="16" column="20" selection-start-line="16" selection-start-column="20" selection-end-line="16" selection-end-column="20" />
|
|
379
|
+
</state>
|
|
380
|
+
</provider>
|
|
381
|
+
</entry>
|
|
382
|
+
<entry file="file://$PROJECT_DIR$/bin/by_crawler">
|
|
383
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
384
|
+
<state relative-caret-position="15">
|
|
385
|
+
<caret line="1" column="36" lean-forward="true" selection-start-line="1" selection-start-column="36" selection-end-line="1" selection-end-column="36" />
|
|
386
|
+
</state>
|
|
387
|
+
</provider>
|
|
388
|
+
</entry>
|
|
389
|
+
<entry file="file://$PROJECT_DIR$/resource/urls.txt">
|
|
390
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
391
|
+
<state relative-caret-position="15">
|
|
392
|
+
<caret line="1" column="30" lean-forward="true" selection-start-line="1" selection-start-column="30" selection-end-line="1" selection-end-column="30" />
|
|
393
|
+
</state>
|
|
394
|
+
</provider>
|
|
395
|
+
</entry>
|
|
396
|
+
<entry file="file://$PROJECT_DIR$/bin/by_crawler">
|
|
397
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
398
|
+
<state relative-caret-position="45">
|
|
399
|
+
<caret line="3" column="13" lean-forward="true" selection-start-line="3" selection-start-column="13" selection-end-line="3" selection-end-column="13" />
|
|
400
|
+
</state>
|
|
401
|
+
</provider>
|
|
402
|
+
</entry>
|
|
403
|
+
<entry file="file://$PROJECT_DIR$/lib/by_crawler.rb">
|
|
404
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
405
|
+
<state relative-caret-position="315">
|
|
406
|
+
<caret line="21" column="19" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
|
407
|
+
</state>
|
|
408
|
+
</provider>
|
|
409
|
+
</entry>
|
|
410
|
+
</component>
|
|
411
|
+
</project>
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at zhaosi@yunjiglobal.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Bryce
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# ByCrawler
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/by_crawler`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'by_crawler'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install by_crawler
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/by_crawler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
40
|
+
|
|
41
|
+
## Code of Conduct
|
|
42
|
+
|
|
43
|
+
Everyone interacting in the ByCrawler project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/by_crawler/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/by_crawler
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "by_crawler"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/by_crawler.gemspec
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "by_crawler/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "by_crawler"
|
|
8
|
+
spec.version = ByCrawler::VERSION
|
|
9
|
+
spec.authors = ["Bryce"]
|
|
10
|
+
spec.email = ["zhaosi@yunjiglobal.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{a demo for study ruby}
|
|
13
|
+
spec.description = %q{a demo for study ruby}
|
|
14
|
+
spec.homepage = "https://github.com/YaoJuan/by_crawler.git"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
end
|
|
23
|
+
spec.bindir = "exe"
|
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
|
+
spec.require_paths = ["lib"]
|
|
26
|
+
|
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
28
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
|
29
|
+
spec.add_development_dependency "rspec"
|
|
30
|
+
spec.add_development_dependency "pry"
|
|
31
|
+
end
|
data/lib/by_crawler.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "by_crawler/version"
|
|
2
|
+
require 'by_crawler/command_line_argument_parser'
|
|
3
|
+
require 'by_crawler/url_store'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BYCrawler
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
@argument_parser = CommandLineArgumentParser.new
|
|
11
|
+
@argument_parser.parse_arguments
|
|
12
|
+
@spider = Spider.new
|
|
13
|
+
@url_store = UrlStore.new(@argument_parser.url_file)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def crawl
|
|
17
|
+
if @argument_parser.crawl_type == CommandLineArgumentParser::WEB_CRAWLER
|
|
18
|
+
@spider.crawl_web(@url_store.get_urls,
|
|
19
|
+
@argument_parser.crawl_depth,
|
|
20
|
+
@argument_parser.page_limit)
|
|
21
|
+
else
|
|
22
|
+
@spider.crawl_domain(@url_store.get_url,
|
|
23
|
+
@argument_parser.page_limit)
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
require 'getoptlong'
|
|
3
|
+
|
|
4
|
+
class CommandLineArgumentParser
|
|
5
|
+
WEB_CRAWLER = 'web'
|
|
6
|
+
DOMAIN_CRAWLER = 'domain'
|
|
7
|
+
|
|
8
|
+
attr_reader :crawl_type, :crawl_depth, :page_limit, :url_file
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
unless ARGV.length >= 1
|
|
12
|
+
display_usage
|
|
13
|
+
exit
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@opts = GetoptLong.new(
|
|
17
|
+
["--crawl", "-c", GetoptLong::REQUIRED_ARGUMENT],
|
|
18
|
+
["--crawl-depth", "-d", GetoptLong::OPTIONAL_ARGUMENT],
|
|
19
|
+
["--page-limit", "-p", GetoptLong::OPTIONAL_ARGUMENT],
|
|
20
|
+
["--url-file", "-f", GetoptLong::OPTIONAL_ARGUMENT]
|
|
21
|
+
)
|
|
22
|
+
@crawl_depth = 3
|
|
23
|
+
@crawl_type = "data.txt"
|
|
24
|
+
@page_limit = 100
|
|
25
|
+
@url_file = 'urls.txt'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def display_usage
|
|
29
|
+
p "simple usage:"
|
|
30
|
+
p "ruby search-engine-main.rb -c web -d 3 -p 100 -f 'urls.txt'"
|
|
31
|
+
p "-c must be either 'web' or 'domain', will default to 'web' is your type garbage"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def parse_arguments
|
|
35
|
+
@opts.each do |opt, arg|
|
|
36
|
+
case opt
|
|
37
|
+
when '--crawl'
|
|
38
|
+
ensure_crawl_type_correct(arg)
|
|
39
|
+
when '--crawl-depth'
|
|
40
|
+
@crawl_depth = arg
|
|
41
|
+
when '--page-limit'
|
|
42
|
+
@page_limit = arg
|
|
43
|
+
when '--url-file'
|
|
44
|
+
@url_file = arg
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def ensure_crawl_type_correct(value)
|
|
50
|
+
if value != WEB_CRAWLER && value != DOMAIN_CRAWLER
|
|
51
|
+
@crawl_type = WEB_CRAWLER
|
|
52
|
+
else
|
|
53
|
+
@crawl_type = value
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'uri'
|
|
3
|
+
require 'open-uri'
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'hpricot'
|
|
6
|
+
require 'url_utils'
|
|
7
|
+
|
|
8
|
+
class Spider
|
|
9
|
+
include UrlUtils
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@already_visited = {}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def crawl_web(urls, depth=2, page_limit = 100)
|
|
16
|
+
depth.times do
|
|
17
|
+
next_urls = []
|
|
18
|
+
urls.each do |url|
|
|
19
|
+
url_object = open_url(url)
|
|
20
|
+
next if url_object.nil?
|
|
21
|
+
|
|
22
|
+
url = update_url_if_redirected(url_object)
|
|
23
|
+
parsed_doc = parse_url(url_object)
|
|
24
|
+
next if parsed_doc.nil?
|
|
25
|
+
|
|
26
|
+
@already_visited[url] = true if @already_visited[url].nil?
|
|
27
|
+
return if @already_visited.size == page_limit
|
|
28
|
+
|
|
29
|
+
next_urls += (find_urls_on_page(parsed_doc, url) - @already_visited.keys)
|
|
30
|
+
next_urls.uniq!
|
|
31
|
+
end
|
|
32
|
+
urls = next_urls
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def crawl_domain(url, page_limit = 100)
|
|
37
|
+
return if @already_visited.size == page_limit
|
|
38
|
+
|
|
39
|
+
url_object = open_url(url)
|
|
40
|
+
return if url_object.nil?
|
|
41
|
+
|
|
42
|
+
parsed_doc = parse_url(url_object)
|
|
43
|
+
return if parsed_doc.nil?
|
|
44
|
+
|
|
45
|
+
@already_visited[url] = true if @already_visited[url].nil?
|
|
46
|
+
page_urls = find_urls_on_page(parsed_doc, url)
|
|
47
|
+
page_urls.each do |page_url|
|
|
48
|
+
if urls_on_same_domain?(url, page_url) && @already_visited[page_url].nil?
|
|
49
|
+
crawl_domain(page_url)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def open_url(url)
|
|
57
|
+
open(url)
|
|
58
|
+
rescue
|
|
59
|
+
puts "unable to open url : " + url
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def update_url_if_redirected(url_object)
|
|
63
|
+
url_object.base_uri.to_s
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def parse_url(url_object)
|
|
67
|
+
doc = Hpricot(url_object) #nokogiri
|
|
68
|
+
puts 'Crawling url ' + url_object.base_uri.to_s
|
|
69
|
+
doc
|
|
70
|
+
rescue
|
|
71
|
+
puts 'Could not parse url: ' + url_object.base_uri.to_s
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def find_urls_on_page(parsed_doc, current_url)
|
|
76
|
+
parsed_doc.search('a[@href]').each_with_object([]) do |x, urls_list|
|
|
77
|
+
new_url = x['href'].split('#')[0]
|
|
78
|
+
if new_url
|
|
79
|
+
new_url = make_absolute(current_url, new_url) if relative?(new_url)
|
|
80
|
+
urls_list.push(new_url)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class UrlStore
|
|
2
|
+
attr_reader :urls
|
|
3
|
+
alias :get_urls :urls
|
|
4
|
+
|
|
5
|
+
def initialize(url_file)
|
|
6
|
+
@urls
|
|
7
|
+
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_url
|
|
11
|
+
@urls[0]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def read_urls_from_file(url_file)
|
|
15
|
+
urls = []
|
|
16
|
+
File.open(url_file, 'r') do |file|
|
|
17
|
+
file.readlines.each do |line|
|
|
18
|
+
urls.push(line.chomp)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
urls
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module UrlUtils
|
|
2
|
+
def relative?(url)
|
|
3
|
+
!url.match(/^http/)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def make_absolute(potential_base, relative_url)
|
|
7
|
+
if relative_url.match(/^\//)
|
|
8
|
+
create_absolute_url_from_base(potential_base, relative_url)
|
|
9
|
+
else
|
|
10
|
+
create_absolute_url_from_context(potential_base, relative_url)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def urls_on_same_domain?(url1, url2)
|
|
15
|
+
get_domain(url1) == get_domain(url2)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get_domain(url)
|
|
19
|
+
remove_extra_paths(url)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def create_absolute_url_from_base(potential_base, relative_url)
|
|
25
|
+
remove_extra_paths(potential_base) + relative_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def remove_extra_paths(potential_base)
|
|
29
|
+
index_to_start_slash_search = potential_base.index('://')+3
|
|
30
|
+
index_of_first_relevant_slash = potential_base.index('/', index_to_start_slash_search)
|
|
31
|
+
if index_of_first_relevant_slash != nil
|
|
32
|
+
potential_base[0, index_of_first_relevant_slash]
|
|
33
|
+
else
|
|
34
|
+
potential_base
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def create_absolute_url_from_context(potential_base, relative_url)
|
|
39
|
+
absolute_url = nil
|
|
40
|
+
if potential_base.match(/\/$/)
|
|
41
|
+
absolute_url = potential_base+relative_url
|
|
42
|
+
else
|
|
43
|
+
last_index_of_slash = potential_base.rindex('/')
|
|
44
|
+
if potential_base[last_index_of_slash-2, 2] == ':/'
|
|
45
|
+
absolute_url = potential_base+'/'+relative_url
|
|
46
|
+
else
|
|
47
|
+
last_index_of_dot = potential_base.rindex('.')
|
|
48
|
+
if last_index_of_dot < last_index_of_slash
|
|
49
|
+
absolute_url = potential_base+'/'+relative_url
|
|
50
|
+
else
|
|
51
|
+
absolute_url = potential_base[0, last_index_of_slash+1] + relative_url
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
absolute_url
|
|
56
|
+
end
|
|
57
|
+
end
|
data/resource/urls.txt
ADDED
metadata
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: by_crawler
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bryce
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-06-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.17'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.17'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 12.3.3
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 12.3.3
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description: a demo for study ruby
|
|
70
|
+
email:
|
|
71
|
+
- zhaosi@yunjiglobal.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- ".idea/.rakeTasks"
|
|
78
|
+
- ".idea/by_crawler.iml"
|
|
79
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
80
|
+
- ".idea/misc.xml"
|
|
81
|
+
- ".idea/modules.xml"
|
|
82
|
+
- ".idea/vcs.xml"
|
|
83
|
+
- ".idea/workspace.xml"
|
|
84
|
+
- ".rspec"
|
|
85
|
+
- CODE_OF_CONDUCT.md
|
|
86
|
+
- Gemfile
|
|
87
|
+
- LICENSE.txt
|
|
88
|
+
- README.md
|
|
89
|
+
- Rakefile
|
|
90
|
+
- bin/by_crawler
|
|
91
|
+
- bin/console
|
|
92
|
+
- bin/setup
|
|
93
|
+
- by_crawler.gemspec
|
|
94
|
+
- lib/by_crawler.rb
|
|
95
|
+
- lib/by_crawler/command_line_argument_parser.rb
|
|
96
|
+
- lib/by_crawler/spider.rb
|
|
97
|
+
- lib/by_crawler/url_store.rb
|
|
98
|
+
- lib/by_crawler/url_utils.rb
|
|
99
|
+
- lib/by_crawler/version.rb
|
|
100
|
+
- resource/urls.txt
|
|
101
|
+
homepage: https://github.com/YaoJuan/by_crawler.git
|
|
102
|
+
licenses:
|
|
103
|
+
- MIT
|
|
104
|
+
metadata: {}
|
|
105
|
+
post_install_message:
|
|
106
|
+
rdoc_options: []
|
|
107
|
+
require_paths:
|
|
108
|
+
- lib
|
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
|
+
requirements:
|
|
111
|
+
- - ">="
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: '0'
|
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0'
|
|
119
|
+
requirements: []
|
|
120
|
+
rubygems_version: 3.0.8
|
|
121
|
+
signing_key:
|
|
122
|
+
specification_version: 4
|
|
123
|
+
summary: a demo for study ruby
|
|
124
|
+
test_files: []
|