",{"class":t.sPageButton+" "+g,id:0===r&&"string"===typeof d?
8 | h.sTableId+"_"+d:null,href:"#","aria-controls":h.sTableId,"aria-label":u[d],"data-dt-idx":p,tabindex:h.iTabIndex}).html(f).appendTo(a),h.oApi._fnBindAction(l,{action:d},m),p++)}},i;try{i=b(a).find(e.activeElement).data("dt-idx")}catch(v){}q(b(a).empty().html('').children(),s);i!==m&&b(a).find("[data-dt-idx="+i+"]").focus()};b(e).on("init.dt",function(a,e){if("dt"===a.namespace){var c=new b.fn.dataTable.Api(e);b.fn.dropdown&&b("div.dataTables_length select",
9 | c.table().container()).dropdown();b("div.dataTables_filter.ui.input",c.table().container()).removeClass("input").addClass("form");b("div.dataTables_filter input",c.table().container()).wrap('')}});return c});
10 |
--------------------------------------------------------------------------------
/docs/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source 'https://rubygems.org'
4 |
5 | gemspec
6 |
--------------------------------------------------------------------------------
/docs/LICENSE:
--------------------------------------------------------------------------------
1 | CC0 1.0 Universal
2 |
3 | Statement of Purpose
4 |
5 | The laws of most jurisdictions throughout the world automatically confer
6 | exclusive Copyright and Related Rights (defined below) upon the creator and
7 | subsequent owner(s) (each and all, an "owner") of an original work of
8 | authorship and/or a database (each, a "Work").
9 |
10 | Certain owners wish to permanently relinquish those rights to a Work for the
11 | purpose of contributing to a commons of creative, cultural and scientific
12 | works ("Commons") that the public can reliably and without fear of later
13 | claims of infringement build upon, modify, incorporate in other works, reuse
14 | and redistribute as freely as possible in any form whatsoever and for any
15 | purposes, including without limitation commercial purposes. These owners may
16 | contribute to the Commons to promote the ideal of a free culture and the
17 | further production of creative, cultural and scientific works, or to gain
18 | reputation or greater distribution for their Work in part through the use and
19 | efforts of others.
20 |
21 | For these and/or other purposes and motivations, and without any expectation
22 | of additional consideration or compensation, the person associating CC0 with a
23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25 | and publicly distribute the Work under its terms, with knowledge of his or her
26 | Copyright and Related Rights in the Work and the meaning and intended legal
27 | effect of CC0 on those rights.
28 |
29 | 1. Copyright and Related Rights. A Work made available under CC0 may be
30 | protected by copyright and related or neighboring rights ("Copyright and
31 | Related Rights"). Copyright and Related Rights include, but are not limited
32 | to, the following:
33 |
34 | i. the right to reproduce, adapt, distribute, perform, display, communicate,
35 | and translate a Work;
36 |
37 | ii. moral rights retained by the original author(s) and/or performer(s);
38 |
39 | iii. publicity and privacy rights pertaining to a person's image or likeness
40 | depicted in a Work;
41 |
42 | iv. rights protecting against unfair competition in regards to a Work,
43 | subject to the limitations in paragraph 4(a), below;
44 |
45 | v. rights protecting the extraction, dissemination, use and reuse of data in
46 | a Work;
47 |
48 | vi. database rights (such as those arising under Directive 96/9/EC of the
49 | European Parliament and of the Council of 11 March 1996 on the legal
50 | protection of databases, and under any national implementation thereof,
51 | including any amended or successor version of such directive); and
52 |
53 | vii. other similar, equivalent or corresponding rights throughout the world
54 | based on applicable law or treaty, and any national implementations thereof.
55 |
56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59 | and Related Rights and associated claims and causes of action, whether now
60 | known or unknown (including existing as well as future claims and causes of
61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum
62 | duration provided by applicable law or treaty (including future time
63 | extensions), (iii) in any current or future medium and for any number of
64 | copies, and (iv) for any purpose whatsoever, including without limitation
65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66 | the Waiver for the benefit of each member of the public at large and to the
67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver
68 | shall not be subject to revocation, rescission, cancellation, termination, or
69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work
70 | by the public as contemplated by Affirmer's express Statement of Purpose.
71 |
72 | 3. Public License Fallback. Should any part of the Waiver for any reason be
73 | judged legally invalid or ineffective under applicable law, then the Waiver
74 | shall be preserved to the maximum extent permitted taking into account
75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76 | is so judged Affirmer hereby grants to each affected person a royalty-free,
77 | non transferable, non sublicensable, non exclusive, irrevocable and
78 | unconditional license to exercise Affirmer's Copyright and Related Rights in
79 | the Work (i) in all territories worldwide, (ii) for the maximum duration
80 | provided by applicable law or treaty (including future time extensions), (iii)
81 | in any current or future medium and for any number of copies, and (iv) for any
82 | purpose whatsoever, including without limitation commercial, advertising or
83 | promotional purposes (the "License"). The License shall be deemed effective as
84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the
85 | License for any reason be judged legally invalid or ineffective under
86 | applicable law, such partial invalidity or ineffectiveness shall not
87 | invalidate the remainder of the License, and in such case Affirmer hereby
88 | affirms that he or she will not (i) exercise any of his or her remaining
89 | Copyright and Related Rights in the Work or (ii) assert any associated claims
90 | and causes of action with respect to the Work, in either case contrary to
91 | Affirmer's express Statement of Purpose.
92 |
93 | 4. Limitations and Disclaimers.
94 |
95 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
96 | surrendered, licensed or otherwise affected by this document.
97 |
98 | b. Affirmer offers the Work as-is and makes no representations or warranties
99 | of any kind concerning the Work, express, implied, statutory or otherwise,
100 | including without limitation warranties of title, merchantability, fitness
101 | for a particular purpose, non infringement, or the absence of latent or
102 | other defects, accuracy, or the present or absence of errors, whether or not
103 | discoverable, all to the greatest extent permissible under applicable law.
104 |
105 | c. Affirmer disclaims responsibility for clearing rights of other persons
106 | that may apply to the Work or any use thereof, including without limitation
107 | any person's Copyright and Related Rights in the Work. Further, Affirmer
108 | disclaims responsibility for obtaining any necessary consents, permissions
109 | or other rights required for any use of the Work.
110 |
111 | d. Affirmer understands and acknowledges that Creative Commons is not a
112 | party to this document and has no duty or obligation with respect to this
113 | CC0 or use of the Work.
114 |
115 | For more information, please see
116 |
117 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | title: 逃离北上广
2 | description: 如果你是一个正准备逃离北上广等一线城市却又找不到去处的IT人士,或许这个项目能给你点建议。
3 | show_downloads: false
4 | google_analytics:
5 | theme: jekyll-theme-slate
6 |
--------------------------------------------------------------------------------
/docs/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
24 | {% seo %}
25 |
26 |
27 |
28 |
29 |
30 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
71 |
72 | {% if site.google_analytics %}
73 |
81 | {% endif %}
82 |
83 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/docs/_sass/jekyll-theme-slate.scss:
--------------------------------------------------------------------------------
1 | @import "rouge-github";
2 |
3 | /*******************************************************************************
4 | MeyerWeb Reset
5 | *******************************************************************************/
6 |
7 | html, body, div, span, applet, object, iframe,
8 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
9 | a, abbr, acronym, address, big, cite, code,
10 | del, dfn, em, img, ins, kbd, q, s, samp,
11 | small, strike, strong, sub, sup, tt, var,
12 | b, u, i, center,
13 | dl, dt, dd, ol, ul, li,
14 | fieldset, form, label, legend,
15 | table, caption, tbody, tfoot, thead, tr, th, td,
16 | article, aside, canvas, details, embed,
17 | figure, figcaption, footer, header, hgroup,
18 | menu, nav, output, ruby, section, summary,
19 | time, mark, audio, video {
20 | margin: 0;
21 | padding: 0;
22 | border: 0;
23 | font: inherit;
24 | vertical-align: baseline;
25 | }
26 |
27 | /* HTML5 display-role reset for older browsers */
28 | article, aside, details, figcaption, figure,
29 | footer, header, hgroup, menu, nav, section {
30 | display: block;
31 | }
32 |
33 | ol, ul {
34 | list-style: none;
35 | }
36 |
37 | table {
38 | border-collapse: collapse;
39 | border-spacing: 0;
40 | }
41 |
42 | /*******************************************************************************
43 | Theme Styles
44 | *******************************************************************************/
45 |
46 | body {
47 | box-sizing: border-box;
48 | color:#373737;
49 | background: #212121;
50 | font-size: 16px;
51 | font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
52 | line-height: 1.5;
53 | -webkit-font-smoothing: antialiased;
54 | }
55 |
56 | h1, h2, h3, h4, h5, h6 {
57 | margin: 10px 0;
58 | font-weight: 700;
59 | color:#222222;
60 | font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
61 | letter-spacing: -1px;
62 | }
63 |
64 | h1 {
65 | font-size: 36px;
66 | font-weight: 700;
67 | }
68 |
69 | h2 {
70 | padding-bottom: 10px;
71 | font-size: 32px;
72 | background: url('../images/bg_hr.png') repeat-x bottom;
73 | }
74 |
75 | h3 {
76 | font-size: 24px;
77 | }
78 |
79 | h4 {
80 | font-size: 21px;
81 | }
82 |
83 | h5 {
84 | font-size: 18px;
85 | }
86 |
87 | h6 {
88 | font-size: 16px;
89 | }
90 |
91 | p {
92 | margin: 10px 0 15px 0;
93 | }
94 |
95 | footer p {
96 | color: #f2f2f2;
97 | }
98 |
99 | a {
100 | text-decoration: none;
101 | color: #0F79D0;
102 | text-shadow: none;
103 |
104 | transition: color 0.5s ease;
105 | transition: text-shadow 0.5s ease;
106 | -webkit-transition: color 0.5s ease;
107 | -webkit-transition: text-shadow 0.5s ease;
108 | -moz-transition: color 0.5s ease;
109 | -moz-transition: text-shadow 0.5s ease;
110 | -o-transition: color 0.5s ease;
111 | -o-transition: text-shadow 0.5s ease;
112 | -ms-transition: color 0.5s ease;
113 | -ms-transition: text-shadow 0.5s ease;
114 | }
115 |
116 | a:hover, a:focus {
117 | text-decoration: underline;
118 | }
119 |
120 | footer a {
121 | color: #F2F2F2;
122 | text-decoration: underline;
123 | }
124 |
125 | em, cite {
126 | font-style: italic;
127 | }
128 |
129 | strong {
130 | font-weight: bold;
131 | }
132 |
133 | img {
134 | position: relative;
135 | margin: 0 auto;
136 | max-width: 739px;
137 | padding: 5px;
138 | margin: 10px 0 10px 0;
139 | border: 1px solid #ebebeb;
140 |
141 | box-shadow: 0 0 5px #ebebeb;
142 | -webkit-box-shadow: 0 0 5px #ebebeb;
143 | -moz-box-shadow: 0 0 5px #ebebeb;
144 | -o-box-shadow: 0 0 5px #ebebeb;
145 | -ms-box-shadow: 0 0 5px #ebebeb;
146 | }
147 |
148 | p img {
149 | display: inline;
150 | margin: 0;
151 | padding: 0;
152 | vertical-align: middle;
153 | text-align: center;
154 | border: none;
155 | }
156 |
157 | pre, code {
158 | color: #222;
159 | background-color: #fff;
160 |
161 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
162 | font-size: 14px;
163 |
164 | border-radius: 2px;
165 | -moz-border-radius: 2px;
166 | -webkit-border-radius: 2px;
167 | }
168 |
169 | pre {
170 | padding: 10px;
171 | box-shadow: 0 0 10px rgba(0,0,0,.1);
172 | overflow: auto;
173 | }
174 |
175 | code {
176 | padding: 3px;
177 | margin: 0 3px;
178 | box-shadow: 0 0 10px rgba(0,0,0,.1);
179 | }
180 |
181 | pre code {
182 | display: block;
183 | box-shadow: none;
184 | }
185 |
186 | blockquote {
187 | color: #666;
188 | margin-bottom: 20px;
189 | padding: 0 0 0 20px;
190 | border-left: 3px solid #bbb;
191 | }
192 |
193 |
194 | ul, ol, dl {
195 | margin-bottom: 15px
196 | }
197 |
198 | ul {
199 | list-style-position: inside;
200 | list-style: disc;
201 | padding-left: 20px;
202 | }
203 |
204 | ol {
205 | list-style-position: inside;
206 | list-style: decimal;
207 | padding-left: 20px;
208 | }
209 |
210 | dl dt {
211 | font-weight: bold;
212 | }
213 |
214 | dl dd {
215 | padding-left: 20px;
216 | font-style: italic;
217 | }
218 |
219 | dl p {
220 | padding-left: 20px;
221 | font-style: italic;
222 | }
223 |
224 | hr {
225 | height: 1px;
226 | margin-bottom: 5px;
227 | border: none;
228 | background: url('../images/bg_hr.png') repeat-x center;
229 | }
230 |
231 | table {
232 | border: 1px solid #373737;
233 | margin-bottom: 20px;
234 | text-align: left;
235 | }
236 |
237 | th {
238 | font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
239 | padding: 10px;
240 | background: #373737;
241 | color: #fff;
242 | }
243 |
244 | td {
245 | padding: 10px;
246 | border: 1px solid #373737;
247 | }
248 |
249 | form {
250 | background: #f2f2f2;
251 | padding: 20px;
252 | }
253 |
254 | /*******************************************************************************
255 | Full-Width Styles
256 | *******************************************************************************/
257 |
258 | .outer {
259 | width: 100%;
260 | }
261 |
262 | .inner {
263 | position: relative;
264 | max-width: 640px;
265 | padding: 20px 10px;
266 | margin: 0 auto;
267 | }
268 |
269 | #forkme_banner {
270 | display: block;
271 | position: absolute;
272 | top:0;
273 | right: 10px;
274 | z-index: 10;
275 | padding: 10px 50px 10px 10px;
276 | color: #fff;
277 | background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%;
278 | font-weight: 700;
279 | box-shadow: 0 0 10px rgba(0,0,0,.5);
280 | border-bottom-left-radius: 2px;
281 | border-bottom-right-radius: 2px;
282 | }
283 |
284 | #header_wrap {
285 | background: #212121;
286 | background: -moz-linear-gradient(top, #373737, #212121);
287 | background: -webkit-linear-gradient(top, #373737, #212121);
288 | background: -ms-linear-gradient(top, #373737, #212121);
289 | background: -o-linear-gradient(top, #373737, #212121);
290 | background: linear-gradient(to top, #373737, #212121);
291 | }
292 |
293 | #header_wrap .inner {
294 | padding: 50px 10px 30px 10px;
295 | }
296 |
297 | #project_title {
298 | margin: 0;
299 | color: #fff;
300 | font-size: 42px;
301 | font-weight: 700;
302 | text-shadow: #111 0px 0px 10px;
303 | }
304 |
305 | #project_tagline {
306 | color: #fff;
307 | font-size: 24px;
308 | font-weight: 300;
309 | background: none;
310 | text-shadow: #111 0px 0px 10px;
311 | }
312 |
313 | #downloads {
314 | position: absolute;
315 | width: 210px;
316 | z-index: 10;
317 | bottom: -40px;
318 | right: 0;
319 | height: 70px;
320 | background: url('../images/icon_download.png') no-repeat 0% 90%;
321 | }
322 |
323 | .zip_download_link {
324 | display: block;
325 | float: right;
326 | width: 90px;
327 | height:70px;
328 | text-indent: -5000px;
329 | overflow: hidden;
330 | background: url(../images/sprite_download.png) no-repeat bottom left;
331 | }
332 |
333 | .tar_download_link {
334 | display: block;
335 | float: right;
336 | width: 90px;
337 | height:70px;
338 | text-indent: -5000px;
339 | overflow: hidden;
340 | background: url(../images/sprite_download.png) no-repeat bottom right;
341 | margin-left: 10px;
342 | }
343 |
344 | .zip_download_link:hover {
345 | background: url(../images/sprite_download.png) no-repeat top left;
346 | }
347 |
348 | .tar_download_link:hover {
349 | background: url(../images/sprite_download.png) no-repeat top right;
350 | }
351 |
352 | #main_content_wrap {
353 | background: #f2f2f2;
354 | border-top: 1px solid #111;
355 | border-bottom: 1px solid #111;
356 | }
357 |
358 | #main_content {
359 | padding-top: 40px;
360 | }
361 |
362 | #footer_wrap {
363 | background: #212121;
364 | }
365 |
366 |
367 |
368 | /*******************************************************************************
369 | Small Device Styles
370 | *******************************************************************************/
371 |
372 | @media screen and (max-width: 992px) {
373 | img {
374 | max-width: 100%;
375 | }
376 | }
377 |
378 | @media screen and (max-width: 480px) {
379 | body {
380 | font-size:14px;
381 | }
382 |
383 | #downloads {
384 | display: none;
385 | }
386 |
387 | .inner {
388 | min-width: 320px;
389 | max-width: 480px;
390 | }
391 |
392 | #project_title {
393 | font-size: 32px;
394 | }
395 |
396 | h1 {
397 | font-size: 28px;
398 | }
399 |
400 | h2 {
401 | font-size: 24px;
402 | }
403 |
404 | h3 {
405 | font-size: 21px;
406 | }
407 |
408 | h4 {
409 | font-size: 18px;
410 | }
411 |
412 | h5 {
413 | font-size: 14px;
414 | }
415 |
416 | h6 {
417 | font-size: 12px;
418 | }
419 |
420 | code, pre {
421 | font-size: 11px;
422 | }
423 |
424 | }
425 |
426 | @media screen and (max-width: 320px) {
427 | body {
428 | font-size:14px;
429 | }
430 |
431 | #downloads {
432 | display: none;
433 | }
434 |
435 | .inner {
436 | min-width: 240px;
437 | max-width: 320px;
438 | }
439 |
440 | #project_title {
441 | font-size: 28px;
442 | }
443 |
444 | h1 {
445 | font-size: 24px;
446 | }
447 |
448 | h2 {
449 | font-size: 21px;
450 | }
451 |
452 | h3 {
453 | font-size: 18px;
454 | }
455 |
456 | h4 {
457 | font-size: 16px;
458 | }
459 |
460 | h5 {
461 | font-size: 14px;
462 | }
463 |
464 | h6 {
465 | font-size: 12px;
466 | }
467 |
468 | code, pre {
469 | min-width: 240px;
470 | max-width: 320px;
471 | font-size: 11px;
472 | }
473 |
474 | }
475 |
--------------------------------------------------------------------------------
/docs/_sass/rouge-github.scss:
--------------------------------------------------------------------------------
1 | .highlight table td { padding: 5px; }
2 | .highlight table pre { margin: 0; }
3 | .highlight .cm {
4 | color: #777772;
5 | font-style: italic;
6 | }
7 | .highlight .cp {
8 | color: #797676;
9 | font-weight: bold;
10 | }
11 | .highlight .c1 {
12 | color: #777772;
13 | font-style: italic;
14 | }
15 | .highlight .cs {
16 | color: #797676;
17 | font-weight: bold;
18 | font-style: italic;
19 | }
20 | .highlight .c, .highlight .cd {
21 | color: #777772;
22 | font-style: italic;
23 | }
24 | .highlight .err {
25 | color: #a61717;
26 | background-color: #e3d2d2;
27 | }
28 | .highlight .gd {
29 | color: #000000;
30 | background-color: #ffdddd;
31 | }
32 | .highlight .ge {
33 | color: #000000;
34 | font-style: italic;
35 | }
36 | .highlight .gr {
37 | color: #aa0000;
38 | }
39 | .highlight .gh {
40 | color: #797676;
41 | }
42 | .highlight .gi {
43 | color: #000000;
44 | background-color: #ddffdd;
45 | }
46 | .highlight .go {
47 | color: #888888;
48 | }
49 | .highlight .gp {
50 | color: #555555;
51 | }
52 | .highlight .gs {
53 | font-weight: bold;
54 | }
55 | .highlight .gu {
56 | color: #aaaaaa;
57 | }
58 | .highlight .gt {
59 | color: #aa0000;
60 | }
61 | .highlight .kc {
62 | color: #000000;
63 | font-weight: bold;
64 | }
65 | .highlight .kd {
66 | color: #000000;
67 | font-weight: bold;
68 | }
69 | .highlight .kn {
70 | color: #000000;
71 | font-weight: bold;
72 | }
73 | .highlight .kp {
74 | color: #000000;
75 | font-weight: bold;
76 | }
77 | .highlight .kr {
78 | color: #000000;
79 | font-weight: bold;
80 | }
81 | .highlight .kt {
82 | color: #445588;
83 | font-weight: bold;
84 | }
85 | .highlight .k, .highlight .kv {
86 | color: #000000;
87 | font-weight: bold;
88 | }
89 | .highlight .mf {
90 | color: #009999;
91 | }
92 | .highlight .mh {
93 | color: #009999;
94 | }
95 | .highlight .il {
96 | color: #009999;
97 | }
98 | .highlight .mi {
99 | color: #009999;
100 | }
101 | .highlight .mo {
102 | color: #009999;
103 | }
104 | .highlight .m, .highlight .mb, .highlight .mx {
105 | color: #009999;
106 | }
107 | .highlight .sb {
108 | color: #d14;
109 | }
110 | .highlight .sc {
111 | color: #d14;
112 | }
113 | .highlight .sd {
114 | color: #d14;
115 | }
116 | .highlight .s2 {
117 | color: #d14;
118 | }
119 | .highlight .se {
120 | color: #d14;
121 | }
122 | .highlight .sh {
123 | color: #d14;
124 | }
125 | .highlight .si {
126 | color: #d14;
127 | }
128 | .highlight .sx {
129 | color: #d14;
130 | }
131 | .highlight .sr {
132 | color: #009926;
133 | }
134 | .highlight .s1 {
135 | color: #d14;
136 | }
137 | .highlight .ss {
138 | color: #990073;
139 | }
140 | .highlight .s {
141 | color: #d14;
142 | }
143 | .highlight .na {
144 | color: #008080;
145 | }
146 | .highlight .bp {
147 | color: #797676;
148 | }
149 | .highlight .nb {
150 | color: #0086B3;
151 | }
152 | .highlight .nc {
153 | color: #445588;
154 | font-weight: bold;
155 | }
156 | .highlight .no {
157 | color: #008080;
158 | }
159 | .highlight .nd {
160 | color: #3c5d5d;
161 | font-weight: bold;
162 | }
163 | .highlight .ni {
164 | color: #800080;
165 | }
166 | .highlight .ne {
167 | color: #990000;
168 | font-weight: bold;
169 | }
170 | .highlight .nf {
171 | color: #990000;
172 | font-weight: bold;
173 | }
174 | .highlight .nl {
175 | color: #990000;
176 | font-weight: bold;
177 | }
178 | .highlight .nn {
179 | color: #555555;
180 | }
181 | .highlight .nt {
182 | color: #000080;
183 | }
184 | .highlight .vc {
185 | color: #008080;
186 | }
187 | .highlight .vg {
188 | color: #008080;
189 | }
190 | .highlight .vi {
191 | color: #008080;
192 | }
193 | .highlight .nv {
194 | color: #008080;
195 | }
196 | .highlight .ow {
197 | color: #000000;
198 | font-weight: bold;
199 | }
200 | .highlight .o {
201 | color: #000000;
202 | font-weight: bold;
203 | }
204 | .highlight .w {
205 | color: #bbbbbb;
206 | }
207 | .highlight {
208 | background-color: #f8f8f8;
209 | }
210 |
--------------------------------------------------------------------------------
/docs/another-page.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 | ## Welcome to another page
6 |
7 | _yay_
8 |
9 | [back](./)
10 |
--------------------------------------------------------------------------------
/docs/assets/css/style.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | @import "jekyll-theme-slate";
5 |
--------------------------------------------------------------------------------
/docs/assets/images/bg_hr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jinnrry/getAwayBSG/f86ac37680e2bfb83feb67ecc7dc61326e0ccecf/docs/assets/images/bg_hr.png
--------------------------------------------------------------------------------
/docs/assets/images/blacktocat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jinnrry/getAwayBSG/f86ac37680e2bfb83feb67ecc7dc61326e0ccecf/docs/assets/images/blacktocat.png
--------------------------------------------------------------------------------
/docs/assets/images/icon_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jinnrry/getAwayBSG/f86ac37680e2bfb83feb67ecc7dc61326e0ccecf/docs/assets/images/icon_download.png
--------------------------------------------------------------------------------
/docs/assets/images/sprite_download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jinnrry/getAwayBSG/f86ac37680e2bfb83feb67ecc7dc61326e0ccecf/docs/assets/images/sprite_download.png
--------------------------------------------------------------------------------
/docs/docs/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at opensource@github.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/docs/docs/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to The Slate Theme
2 |
3 | Hi there! We're thrilled that you'd like to contribute to The Slate Theme. Your help is essential for keeping it great.
4 |
5 | The Slate Theme is an open source project supported by the efforts of an entire community and built one contribution at a time by users like you. We'd love for you to get involved. Whatever your level of skill or however much time you can give, your contribution is greatly appreciated. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, helping other users by commenting on issues, or writing code which can be incorporated into The Slate Theme itself.
6 |
7 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.
8 |
9 |
10 | ## Looking for support?
11 |
12 | We'd love to help. Check out [the support guidelines](SUPPORT.md).
13 |
14 | ## How to report a bug
15 |
16 | Think you found a bug? Please check [the list of open issues](https://github.com/pages-themes/slate/issues) to see if your bug has already been reported. If it hasn't please [submit a new issue](https://github.com/pages-themes/slate/issues/new).
17 |
18 | Here are a few tips for writing *great* bug reports:
19 |
20 | * Describe the specific problem (e.g., "widget doesn't turn clockwise" versus "getting an error")
21 | * Include the steps to reproduce the bug, what you expected to happen, and what happened instead
22 | * Check that you are using the latest version of the project and its dependencies
23 | * Include what version of the project your using, as well as any relevant dependencies
24 | * Only include one bug per issue. If you have discovered two bugs, please file two issues
25 | * Even if you don't know how to fix the bug, including a failing test may help others track it down
26 |
27 | **If you find a security vulnerability, do not open an issue. Please email security@github.com instead.**
28 |
29 | ## How to suggest a feature or enhancement
30 |
31 | If you find yourself wishing for a feature that doesn't exist in The Slate Theme, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that The Slate Theme has today have been added because our users saw the need.
32 |
33 | Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and goals of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible, including describing the problem you're trying to solve.
34 |
35 | [Open an issue](https://github.com/pages-themes/slate/issues/new) which describes the feature you would like to see, why you want it, how it should work, etc.
36 |
37 |
38 |
39 | ## Your first contribution
40 |
41 | We'd love for you to contribute to the project. Unsure where to begin contributing to The Slate Theme? You can start by looking through these "good first issue" and "help wanted" issues:
42 |
43 | * [Good first issues](https://github.com/pages-themes/slate/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - issues which should only require a few lines of code and a test or two
44 | * [Help wanted issues](https://github.com/pages-themes/slate/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) - issues which may be a bit more involved, but are specifically seeking community contributions
45 |
46 | *p.s. Feel free to ask for help; everyone is a beginner at first* :smiley_cat:
47 |
48 | ## How to propose changes
49 |
50 | Here's a few general guidelines for proposing changes:
51 |
52 | * If you are making visual changes, include a screenshot of what the affected element looks like, both before and after.
53 | * Follow the [Jekyll style guide](https://ben.balter.com/jekyll-style-guide).
54 | * If you are changing any user-facing functionality, please be sure to update the documentation
55 | * Each pull request should implement **one** feature or bug fix. If you want to add or fix more than one thing, submit more than one pull request
56 | * Do not commit changes to files that are irrelevant to your feature or bug fix
57 | * Don't bump the version number in your pull request (it will be bumped prior to release)
58 | * Write [a good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
59 |
60 | At a high level, [the process for proposing changes](https://guides.github.com/introduction/flow/) is:
61 |
62 | 1. [Fork](https://github.com/pages-themes/slate/fork) and clone the project
63 | 2. Configure and install the dependencies: `script/bootstrap`
64 | 3. Make sure the tests pass on your machine: `script/cibuild`
65 | 4. Create a new branch: `git checkout -b my-branch-name`
66 | 5. Make your change, add tests, and make sure the tests still pass
67 | 6. Push to your fork and [submit a pull request](https://github.com/pages-themes/slate/compare)
68 | 7. Pat your self on the back and wait for your pull request to be reviewed and merged
69 |
70 | **Interesting in submitting your first Pull Request?** It's easy! You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
71 |
72 | ## Bootstrapping your local development environment
73 |
74 | `script/bootstrap`
75 |
76 | ## Running tests
77 |
78 | `script/cibuild`
79 |
80 | ## Code of conduct
81 |
82 | This project is governed by [the Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
83 |
84 | ## Additional Resources
85 |
86 | * [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
87 | * [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
88 | * [GitHub Help](https://help.github.com)
89 |
--------------------------------------------------------------------------------
/docs/docs/SUPPORT.md:
--------------------------------------------------------------------------------
1 | ## Where to get help
2 |
3 | If you think you've found a bug in The Slate Theme, please [check the existing issues](https://github.com/pages-themes/slate/issues), and if no one has reported the problem, [open a new issue](https://github.com/pages-themes/slate/issues/new).
4 |
5 | If you have a general question about the theme, how to implement it, or how to customize it for your site you have two options:
6 |
7 | 1. [Contact GitHub Support](https://github.com/contact?form%5Bsubject%5D=GitHub%20Pages%20theme%20pages-themes/slate), or
8 |
9 | 2. Ask your question of the Jekyll community on [talk.jekyllrb.com](https://talk.jekyllrb.com/)
10 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 |
6 | ## What!
7 |
8 | 如果你是一个正准备逃离北上广等一线城市却又找不到去处的IT人士,或许这个项目能给你点建议。
9 |
10 | ## Desc
11 |
12 | 项目起因,大约2年前,我大学毕业时,初入社会,完全不知道要到哪里去。于是当时写了个爬虫,抓取了各个城市的招聘、租房数据,分享了各个城市哪里工作机会多,哪里租房便宜,哪里大企业多...大约半年前,又到毕业季,看见很多人跟我当初一样讨论薪资,租房相关的东西,于是我想起了当时的这个项目,然后翻出当时的项目,改了改,最终开源出来,希望给大家一些参考。
13 |
14 | 爬虫抓取了智联招聘跟链家这2个平台的全部数据。目前抓到了18W+全国各个城市的招聘数据与200W+全国各地的房屋数据。
15 |
16 | 其中,招聘数据我直接爬的智联的ajax接口,接口返回中包括学历,工作经验,薪资,地点等等数据,原封不动,直接存MongoDB数据库。
17 |
18 | 使用了['php', 'java', 'python', 'c/c++', 'c#', 'mysql', 'oracle', 'javascript', 'linux', 'SQL', '软件', '程序员']作为关键词搜索。基本上涵盖了程序猿们绝大部分工作
19 |
20 | 租房和二手房数据,我使用了Colly框架,抓的链接租房和二手房页面。
21 |
22 | ## Release Date
23 |
24 | 数据更新日期:2019-08-08
25 |
26 | 数据后续可能半年左右更新一次吧,爬虫会一直跑着,以后可以做一些环比,同比之类的数据
27 |
28 | ## Other
29 |
30 | 如果有更多统计建议或者相关讨论,欢迎在[Issues](https://github.com/Jinnrry/getAwayBSG/issues)留言
--------------------------------------------------------------------------------
/docs/jekyll-theme-slate.gemspec:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Gem::Specification.new do |s|
4 | s.name = 'jekyll-theme-slate'
5 | s.version = '0.1.1'
6 | s.license = 'CC0-1.0'
7 | s.authors = ['Jason Costello', 'GitHub, Inc.']
8 | s.email = ['opensource+jekyll-theme-slate@github.com']
9 | s.homepage = 'https://github.com/pages-themes/slate'
10 | s.summary = 'Slate is a Jekyll theme for GitHub Pages'
11 |
12 | s.files = `git ls-files -z`.split("\x0").select do |f|
13 | f.match(%r{^((_includes|_layouts|_sass|assets)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)
14 | end
15 |
16 | s.platform = Gem::Platform::RUBY
17 | s.add_runtime_dependency 'jekyll', '> 3.5', '< 5.0'
18 | s.add_runtime_dependency 'jekyll-seo-tag', '~> 2.0'
19 | s.add_development_dependency 'html-proofer', '~> 3.0'
20 | s.add_development_dependency 'rubocop', '~> 0.50'
21 | s.add_development_dependency 'w3c_validators', '~> 1.3'
22 | end
23 |
--------------------------------------------------------------------------------
/docs/post/all.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 | ## 综合分析
6 |
7 | 注:
8 |
9 | 买房难度:(每平米房价/月薪)的值来表示一个城市的买房难度(数值表示多少个月的工资能买1平米)。结果如下
10 |
11 | 房屋租售比:房屋租售比是指每平方米使用面积的月租金与每平方米建筑面积房价之间的比值。国际上一般认为1:300以下的房屋具有投资价值,而1:300以上的房屋就存在泡沫(我记得是有案例证明过的,好几个城市都是过了这个线房产也就崩盘了)。但是我大天朝就特么牛逼了,因为就没几个城市还有1:300以下的,北京都到1:744了,房地产依然稳健,充分证明了那句话:任何经济学理论在中国都是扯淡,特别是在中国的房地产行业(PS:这句话我说的)
12 |
13 |
14 | |城市|平均每平米价格|平均薪资|平均每平米租房|租售比|买房难度|
15 | |:--|:--|:--|:--|:--|:--|
16 | |重庆|14049.7938650934|9871.44588071233|32.6049202656223|430.910235345894|1.42327618819702|
17 | |合肥|15821.643488499|10145.9775490295|28.3332206249216|558.413167989185|1.55940060107982|
18 | |北京|66959.4315965188|15795.6497729197|89.9914519378178|744.064354498762|4.2391058651677|
19 | |济南|19391.7312712318|9749.9121708134|31.4253723635053|617.072442194883|1.98891343137238|
20 | |中山|13144.8280582953|9833.7175791133|25.4360058497079|516.780352071127|1.33670994235331|
21 | |厦门|40530.8596393192|11798.4239132939|47.6245369904594|851.049946111575|3.43527745207146|
22 | |芜湖|10950.8466770202|9211.11111111111|17.5559380716716|623.768814421291|1.1888735837537|
23 | |贵阳|10675.3327682551|8836.68067204852|29.5939015128736|360.727454729524|1.20807044686162|
24 | |烟台|12934.9655580386|8408.31435079726|23.2921366521935|555.336152762116|1.53835418353646|
25 | |潍坊|7341.39899915421|7320.35603741005|18.8444005611223|389.579863543135|1.002874581733|
26 | |珠海|23989.1805283373|11737.9651621798|42.2253750081167|568.122379581615|2.04372565405386|
27 | |惠州|11610.7863247863|11867.6108374384|22.1306350838624|524.647678694628|0.97835920673756|
28 | |廊坊|19123.9187036031|10740.173410818|20.1306198077101|949.991549504033|1.78059682763973|
29 | |漳州|13380.6266073673||26.2195822030773|510.329512641771||
30 | |石家庄|15699.9508163472|7660.15304198412|24.8912468700822|630.741838618684|2.04956098530906|
31 | |威海|9708.5820606582|7356.48148148148|24.3529174520595|398.661970573762|1.31973173385914|
32 | |泉州|12403.2305938675|11357.2254332503|27.4375767349651|452.052698154696|1.09210041367629|
33 | |安庆|9375.78489913544||15.3778959764289|609.692308590626||
34 | |福州|25420.6492189321|10242.0915880153|50.3886246047011|504.491825652261|2.48197831472996|
35 | |南充|8140.89086668303||17.3750946091478|468.537930285395||
36 | |马鞍山|7047.73698281349||17.2901417334591|407.615917293207||
37 | |淄博|8629.80224748127|7477.5641025641|17.4452130591045|494.680243700288|1.15409271376518|
38 | |湛江|9319.45733788396||27.7389329433093|335.970289734301||
39 | |北海|7690.26788816932||19.5336060867021|393.694223894718||
40 | |绵阳|8976.64880557398|7140.40590388308|17.9497575467647|500.09861036769|1.25716225749748|
41 | |江门|8617.08310601927|7336.64122155604|29.737582699798|289.770799227666|1.17452698664085|
42 | |临沂|9791.59518963922|8137.14285680225|17.5827109477228|556.887684655213|1.20332103810294|
43 | |西安|15842.7303264766|10360.0023424186|30.6978377563523|516.086196435717|1.52922072822409|
44 | |东莞|19832.9196290571|11655.701077866|34.5271307893925|574.415515440113|1.70156385244981|
45 | |成都|15317.4505445654|11028.5309182934|34.2189543785275|447.630584357573|1.38889310444402|
46 | |清远|8735.604||21.5478876471608|405.404192886212||
47 | |宝鸡|5015.04960164482||15.8584673082762|316.237975849505||
48 | |呼和浩特|11987.1419567004|7753.67553847522|25.2530206356651|474.681509576357|1.54599478624272|
49 | |郑州|15266.2585518814|8707.75862079927|29.9738006641389|509.320079990596|1.75317888525488|
50 | |哈尔滨|9966.5586962792|7483.12123150771|29.7455672895844|335.060299884382|1.33187187377307|
51 | |汉中|5339.75762859633||15.7408352539935|339.229624250188||
52 | |沈阳|12014.0177725118|8118.40359095388|29.6281724374139|405.493042066298|1.47984978055276|
53 | |广州|33671.4053333333|12787.1498769272|58.478736978435|575.788860586202|2.63322207508407|
54 | |武汉|19873.8600896861|10344.4364604899|39.804217827251|499.29030576453|1.92121244744394|
55 | |常州|15571.575511432|8692.30349329361|26.7713612984344|581.650493519828|1.79142105696677|
56 | |洛阳|10481.422369611|7300.1779360279|20.2043798966597|518.769812447639|1.4357762867509|
57 | |长春|11276.4049561801|8043.42169947757|28.6728606291683|393.277988618577|1.40194128537517|
58 | |南通|15526.3613216126|8402.70506087398|23.212283831088|668.885553640279|1.84778130484538|
59 | |佛山|16890.4170976574|11159.3434347046|31.9824914743249|528.114487616351|1.51356728077117|
60 | |嘉兴|16344.7973716381|11007.4307324003|||1.48488759720534|
61 | |上海|58721.3633281972|15029.9298415025|95.5516755486563|614.550848962302|3.9069619051746|
62 | |新乡|8140.63726095003|7414.11042944785|17.8166400742456|456.912034313222|1.09799244810497|
63 | |天津|26009.3356058258|10704.4774010356|48.5547685518512|535.670056341648|2.42976229771941|
64 | |徐州|13109.3665116279|7821.88034159505|20.6387833763624|635.181167056681|1.67598658367543|
65 | |南京|33886.1523898199|11818.0920381794|56.4020804222479|600.796143265195|2.86731159990527|
66 | |昆山|18161.6779503105|10600.7500000794|34.0615553990361|533.201662036386|1.71324462421758|
67 | |杭州|36837.2219459123|14222.7723694659|71.3253039060405|516.4677|2.59001698044441|
68 | |银川|5951.60167910447|8366.02272662249|18.5473501864974|320.886898627561|0.711401567218457|
69 | |深圳|61416.8113089659|13759.8602023066|112.102381909613|547.863571342183|4.46347640208368|
70 | |南昌|14386.8306199123|8681.39386146574|28.7557937662165|500.310676063289|1.65720284662713|
71 | |兰州|12952.4943502824|8492.23107629879|33.6533536761635|384.87975002196|1.52521689929421|
72 | |许昌|7219.03989946591|8710.68376047998|18.3868313709809|392.620117833864|0.828756972238896|
73 | |太原|13154.0437795275|8015.1240776882|25.0619789539069|524.860538895191|1.64115285702745|
74 | |唐山|10770.377007874|8244.79418834243|||1.30632454392889|
75 | |淮安|9761.5282067444|6606.69291301036|19.3576744398053|504.271741788968|1.47752110401882|
76 | |海口|15924.1393728223|8797.98245597304|||1.8099762590469|
77 | |无锡|16880.4505703422|9879.93722828847|29.9140082494629|564.299188178678|1.70855848375329|
78 | |青岛|25126.2417617237|9457.98565818402|32.2403846312461|779.340632846307|2.65661660630474|
79 | |株洲|6761.70969793322|8279.06976744186|21.9668878354198|307.813730765745|0.81672336239081|
80 | |丹东|6612.38593700286||21.2853034436567|310.654999798626||
81 | |桂林|7096.17776361898|7637.42690058479|18.9237472440825|374.987980556439|0.929132004271705|
82 | |襄阳|9661.78653477983||20.5759360540475|469.567290129639||
83 | |开封|9366.39067985956|||||
84 | |镇江|11164.4185823754|8304.58515283842|18.7894331330997|594.186024841166|1.34436800597553|
85 | |盐城|11706.4162939297|7289.50617269233|23.2795321567124|502.863039305293|1.60592720776941|
86 | |温州|22116.6395906619|9107.26027358068|41.9516853471863|527.193112925683|2.4284624493296|
87 | |长沙|11339.2464788732|10482.1547527909|34.2864748662332|330.720685725571|1.08176674989979|
88 | |九江|8257.2878642331||21.1405524930945|390.589974738376||
89 | |张家口|9465.57683670195|||||
90 | |吉林|7547.97719241888||22.6479204910991|333.274624281082||
91 | |昆明|13267.8472177549|9121.0371819261|29.9403950699343|443.14202223331|1.45464237817668|
92 | |绍兴|16003.6758064516|9336.38613766963|||1.71411888609463|
93 | |上饶|8377.14239586696||21.8100247351876|384.095960347608||
94 | |南宁|13970.4174474959|8817.30769198019|33.6057591137982|415.714979095943|1.58443120457311|
95 | |宜昌|8894.11416558861|7500|25.9000020383992|343.402064308808|1.18588188874515|
96 | |苏州|29345.5750323415|11495.6175921413|48.1269988785651|609.752856320561|2.55276193707095|
97 | |达州|7639.37237140084||28.3688397460547|269.287444949639||
98 | |吉安|7944.64627831715||20.2274173121893|392.766221989676||
99 | |赣州|11265.1146373057|8237.1287133434|31.0907552894534|362.33004095359|1.36760211347156|
100 | |金华|16779.0665368386|9873.63636363636|||1.6993806454767|
101 | |柳州|9722.4522417154|7955.74324356543|27.8477236415413|349.129155648906|1.22206712107997|
102 | |台州|15745.810406504|9140.23437723517|||1.72269219329001|
103 | |黄石|7244.83496732026||20.6235259259178|351.289832463401||
104 | |湖州|12129.6066164428|10733.1932773109|||1.13010231932409|
105 | |大连|15639.9649410222|10086.5152916092|39.3225021455689|397.735751482046|1.55058159224057|
106 | |宁波|21571.1290430143|10334.5145635234|||2.08729001351951|
107 | |岳阳|8053.03713235294||23.0294739753962|349.683937243052||
108 | |常德|7897.6149231346||25.6296145133268|308.144116604954||
109 | |凉山|10694.5613697576||25.3397820732061|422.046304062965||
110 | |咸阳|9002.87688641779||18.1136061831494|497.022889610624||
111 | |三亚|33035.0143737166|||||
112 |
113 |
114 |
115 | 结果很明显了,如果你想去一个安稳生活的地方,这个表中前几的城市都不错,买房压力较低,并且我相信经常逛Github的程序猿肯定都是平均薪资几倍的收入。反之,如果你想挑战人生的地狱模式,emmmmm
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/docs/post/room.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 | ## 房价分析
6 |
7 |
8 | ### 二手房数据
9 |
10 | 差异情况:使用标准差除以平均值得到,这个值越大,表示这个城市的房价个体差异越大。(数学上这个值好像叫变异系数还是啥来的,忘记了)
11 |
12 |
13 | |城市|平均每平米价格|样本总数|样本差异情况|标准差|
14 | |:--|:--|:--|:--|:--|
15 | |重庆|14049.7938650934|78143|0.30792158950918|4326.23485921592|
16 | |合肥|15821.643488499|58604|0.294706106461092|4662.73495031106|
17 | |北京|66959.4315965188|53316|0.406045881020244|27188.6013952232|
18 | |济南|19391.7312712318|33558|0.358121143903821|6944.58898512907|
19 | |中山|13144.8280582953|20379|0.326732300674321|4294.83991345519|
20 | |厦门|40530.8596393192|19685|0.47317456125916|19178.1717272915|
21 | |芜湖|10950.8466770202|18673|0.274337747569986|3004.23061135801|
22 | |贵阳|10675.3327682551|15927|0.299995892928561|3202.55598612224|
23 | |烟台|12934.9655580386|15214|0.405310736668038|5242.68041910435|
24 | |潍坊|7341.39899915421|14188|0.299299938654406|2197.28027008437|
25 | |珠海|23989.1805283373|12757|0.380213046280622|9120.99940645496|
26 | |惠州|11610.7863247863|12402|0.291032627336679|3379.11764954734|
27 | |廊坊|19123.9187036031|11046|0.270759840063387|5177.9891695728|
28 | |漳州|13380.6266073673|10343|0.316333618696762|4232.74203513868|
29 | |石家庄|15699.9508163472|9861|0.25302249159529|3972.44067347569|
30 | |威海|9708.5820606582|9298|0.450394972346659|4372.69654873543|
31 | |泉州|12403.2305938675|8773|0.362161963996968|4491.97835178235|
32 | |安庆|9375.78489913544|8675|0.200322516515102|1878.18082529911|
33 | |福州|25420.6492189321|8578|0.381673233271135|9702.3813792412|
34 | |南充|8140.89086668303|8146|0.30195422418009|2458.17638578405|
35 | |马鞍山|7047.73698281349|7855|0.383388787080446|2702.02333350286|
36 | |淄博|8629.80224748127|7742|0.309939428123821|2674.71597340601|
37 | |湛江|9319.45733788396|7325|0.384620487636941|3584.4542258086|
38 | |北海|7690.26788816932|6331|0.361882133325911|2782.97054921847|
39 | |绵阳|8976.64880557398|6028|0.31773708221256|2852.21419952994|
40 | |江门|8617.08310601927|5499|0.426548132264212|3675.60070443802|
41 | |临沂|9791.59518963922|5405|0.474516264505232|4646.271172935|
42 | |西安|15842.7303264766|5299|0.293202475328725|4645.12774768844|
43 | |东莞|19832.9196290571|5176|0.333788662471363|6620.00371588504|
44 | |成都|15317.4505445654|4499|0.363231357721971|5563.77835814166|
45 | |清远|8735.604|4000|0.239211977116498|2089.66110414679|
46 | |宝鸡|5015.04960164482|3891|0.503954098073008|2527.35479878831|
47 | |呼和浩特|11987.1419567004|3649|0.255722047858137|3065.37648913364|
48 | |郑州|15266.2585518814|3508|0.338337431321811|5165.1467043382|
49 | |哈尔滨|9966.5586962792|3467|0.390598277685423|3892.92066121733|
50 | |汉中|5339.75762859633|3441|0.301259450693997|1608.65245003001|
51 | |沈阳|12014.0177725118|3376|0.353105818613082|4242.21958039492|
52 | |广州|33671.4053333333|3375|0.440300104278458|14825.5232794689|
53 | |武汉|19873.8600896861|3345|0.305672082353412|6074.88419801472|
54 | |常州|15571.575511432|3324|0.302998257637409|4718.16024863325|
55 | |洛阳|10481.422369611|3317|0.352120897201621|3690.7278487366|
56 | |长春|11276.4049561801|3309|0.287424743846495|3241.11780603942|
57 | |南通|15526.3613216126|3299|0.399844533200378|6208.1306949406|
58 | |佛山|16890.4170976574|3287|0.347719940822015|5873.1348336566|
59 | |嘉兴|16344.7973716381|3272|0.299896251417379|4901.74346193091|
60 | |上海|58721.3633281972|3245|0.397112707542837|23318.9995818671|
61 | |新乡|8140.63726095003|3242|0.267483583755426|2177.48682861187|
62 | |天津|26009.3356058258|3227|0.493999993099058|12848.611609789|
63 | |徐州|13109.3665116279|3225|0.327375765341358|4291.68889488455|
64 | |南京|33886.1523898199|3222|0.377742527473401|12800.2408500794|
65 | |昆山|18161.6779503105|3220|0.26373437487667|4789.85878093655|
66 | |杭州|36837.2219459123|3217|0.349673762557912|12881.010000008|
67 | |银川|5951.60167910447|3216|0.358995520876603|2136.59834484018|
68 | |深圳|61416.8113089659|3201|0.396725372446119|24365.6073410025|
69 | |南昌|14386.8306199123|3194|0.328264563457727|4722.68667298579|
70 | |兰州|12952.4943502824|3186|0.290353317881962|3760.79970945188|
71 | |许昌|7219.03989946591|3183|0.264019789910024|1905.96939760907|
72 | |太原|13154.0437795275|3175|0.437870840703515|5759.77220839257|
73 | |唐山|10770.377007874|3175|0.369876731853283|3983.71184850018|
74 | |淮安|9761.5282067444|3173|0.286407496769779|2795.77485834126|
75 | |海口|15924.1393728223|3157|0.274004851879009|4363.29145015088|
76 | |无锡|16880.4505703422|3156|0.331812803051291|5601.14962051402|
77 | |青岛|25126.2417617237|3156|0.401310911762035|10083.4349905506|
78 | |株洲|6761.70969793322|3145|0.254308066489945|1719.55731944771|
79 | |丹东|6612.38593700286|3143|0.365607775247813|2417.53971150754|
80 | |桂林|7096.17776361898|3139|0.416385134551486|2954.74293290575|
81 | |襄阳|9661.78653477983|3134|0.216876043936359|2095.41004102064|
82 | |开封|9366.39067985956|3133|0.360738213956176|3378.81504506831|
83 | |镇江|11164.4185823754|3132|0.336205886557935|3753.54324739143|
84 | |盐城|11706.4162939297|3130|0.333601266512191|3905.2753019739|
85 | |温州|22116.6395906619|3127|0.373396641728128|8258.27894946455|
86 | |长沙|11339.2464788732|3124|0.267050165482247|3028.14764862709|
87 | |保定|13448.9599743836|3123|0.228643834958002|3075.02178473974|
88 | |九江|8257.2878642331|3123|0.277125249367965|2288.30295847867|
89 | |张家口|9465.57683670195|3117|0.221584308722544|2097.42330002073|
90 | |吉林|7547.97719241888|3113|0.278968708440091|2105.64944870436|
91 | |昆明|13267.8472177549|3109|0.311554010669804|4133.65101364574|
92 | |绍兴|16003.6758064516|3100|0.326199536663575|5220.39163297858|
93 | |上饶|8377.14239586696|3097|0.232863571146091|1950.7312943009|
94 | |南宁|13970.4174474959|3095|0.313832539090024|4384.37157969524|
95 | |宜昌|8894.11416558861|3092|0.366197012928098|3256.99804008004|
96 | |苏州|29345.5750323415|3092|0.392609127662379|11521.3406141985|
97 | |达州|7639.37237140084|3091|0.233084200687315|1780.61700294072|
98 | |吉安|7944.64627831715|3090|0.240724066422001|1912.46755840092|
99 | |赣州|11265.1146373057|3088|0.305471376500562|3441.1700746944|
100 | |金华|16779.0665368386|3081|0.301781943618591|5063.61931159285|
101 | |柳州|9722.4522417154|3078|0.287668243707782|2796.84076090706|
102 | |台州|15745.810406504|3075|0.348056962530831|5480.43894267415|
103 | |黄石|7244.83496732026|3060|0.289767452966582|2099.31737564362|
104 | |湖州|12129.6066164428|3053|0.256007240676248|3105.26712036389|
105 | |大连|15639.9649410222|3052|0.396348226246088|6198.87236292518|
106 | |宁波|21571.1290430143|2999|0.304716554770738|6573.08012450234|
107 | |岳阳|8053.03713235294|2720|0.265908695307455|2141.37259712646|
108 | |常德|7897.6149231346|2667|0.270868844848695|2139.21783128928|
109 | |凉山|10694.5613697576|2599|0.25728365554617|2751.53584367409|
110 | |咸阳|9002.87688641779|2518|0.332272541206577|2991.40878121999|
111 | |三亚|33035.0143737166|974|0.338425749821625|11179.8995097932|
112 |
113 |
114 |
115 |
116 | ### 租房数据
117 |
118 | |城市|平均价格|样本总数|样本差异情况|标准差|平均每平米每月价格|
119 | |:--|:--|:--|:--|:--|:--|
120 | |武汉|2665.06829041598|83921|1.4825914465624|3951.20745187544|39.804217827251|
121 | |郑州|2185.54492111537|59137|1.11607039608023|2439.22198576037|29.9738006641389|
122 | |南京|3184.10951151707|50360|1.35569268492994|4316.67397277956|56.4020804222479|
123 | |成都|1763.41547173732|38496|1.41754688179263|2499.72410326613|34.2189543785275|
124 | |广州|4192.76479637746|34451|1.33341956011566|5590.71459045407|58.478736978435|
125 | |青岛|2787.33845124894|34389|1.34841664295398|3758.49355720967|32.2403846312461|
126 | |济南|2182.74538572337|29853|0.858526354271969|1873.94443830905|31.4253723635053|
127 | |重庆|2393.83628607795|29069|1.05349912121184|2521.90442370815|32.6049202656223|
128 | |西安|2176.28396195233|27229|1.61936462091895|3524.19725305893|30.6978377563523|
129 | |长沙|3315.52650666232|24541|2.32597673341812|7711.83751352763|34.2864748662332|
130 | |沈阳|2205.73580563791|22597|1.30120000769064|2870.10344725959|29.6281724374139|
131 | |深圳|6103.63767123287|21900|1.48855941728119|9085.62733518594|112.102381909613|
132 | |北京|7414.66903949775|20229|0.900529440011712|6677.12775801109|89.9914519378178|
133 | |合肥|2378.59200281308|19907|1.11093664733518|2642.46502498344|28.3332206249216|
134 | |上海|11096.1574380165|19360|1.26332938747738|14018.101779522|95.5516755486563|
135 | |大连|2860.3298776695|19292|1.53526073158995|4391.35214057948|39.3225021455689|
136 | |佛山|2628.57672151127|16410|0.915525034237419|2406.52779295729|31.9824914743249|
137 | |徐州|1903.5603665662|16259|1.05601699225847|2010.19209288369|20.6387833763624|
138 | |东莞|3103.38739242986|14293|0.934915151859013|2901.4038952709|34.5271307893925|
139 | |廊坊|1675.22685253118|13630|0.893145817301126|1496.22185636875|20.1306198077101|
140 | |芜湖|1458.71205407435|13315|0.677479774385002|988.247913286975|17.5559380716716|
141 | |长春|2327.78283204905|12069|1.15382578947673|2685.85586391938|28.6728606291683|
142 | |烟台|1809.42421912542|10405|0.795903032949798|1440.12622389474|23.2921366521935|
143 | |苏州|4148.64381577677|10357|1.12380400292528|4662.26252688115|48.1269988785651|
144 | |昆明|2527.27943454686|10328|3.16309277004522|7994.01930729916|29.9403950699343|
145 | |惠州|1916.60684710159|9902|0.661298561338791|1267.44935064036|22.1306350838624|
146 | |中山|2307.20537546163|9748|0.693034769737743|1598.97354612073|25.4360058497079|
147 | |无锡|2659.881183841|9258|0.667616212961422|1775.77980288327|29.9140082494629|
148 | |厦门|3903.26080330902|9187|1.75765697737527|6860.59358545153|47.6245369904594|
149 | |贵阳|2910.31904044501|8629|2.602217432868|7573.28294225367|29.5939015128736|
150 | |福州|2702.67245272368|7086|2.11711558408668|5721.86996834308|50.3886246047011|
151 | |泉州|2497.25064084306|7022|0.794378050180849|1983.76109488578|27.4375767349651|
152 | |南通|2225.91795028214|6557|1.4867997335217|3309.49421532067|23.212283831088|
153 | |兰州|3087.17661609498|6064|1.32854676742477|4101.45851378235|33.6533536761635|
154 | |呼和浩特|2448.21000503609|5957|1.9155744549952|4689.72854611082|25.2530206356651|
155 | |哈尔滨|2184.41585967476|5473|2.05940008179635|4498.58620009147|29.7455672895844|
156 | |南昌|2385.6155803484|5109|0.77595003259534|1851.11848733129|28.7557937662165|
157 | |洛阳|1870.42834960071|4508|1.12451930937859|2103.33279593512|20.2043798966597|
158 | |漳州|1923.31032061783|4273|1.73702755514399|3340.843024006|26.2195822030773|
159 | |常州|2231.69239876864|4223|0.519750741174405|1159.92377833329|26.7713612984344|
160 | |湛江|2651.3391326928|3851|1.05029513615282|2784.6885953589|27.7389329433093|
161 | |赣州|3006.7483713355|3684|1.0110750576839|3040.04828298902|31.0907552894534|
162 | |银川|1654.22762008733|3664|1.84950547326702|3059.50303738102|18.5473501864974|
163 | |太原|1609.22384291725|3565|0.578876566380366|931.541972725356|25.0619789539069|
164 | |吉林|1582.84960496613|3544|2.43896482194772|3860.51450494627|22.6479204910991|
165 | |珠海|4362.5018397962|3533|0.831586129264547|3627.79601886559|42.2253750081167|
166 | |南宁|3355.39517518667|3482|0.890339415663248|2987.44057959498|33.6057591137982|
167 | |绵阳|1667.69993540051|3096|0.813131298021806|1356.0590131831|17.9497575467647|
168 | |石家庄|1029.29262266148|2833|0.455797657039299|469.149165816942|24.8912468700822|
169 | |许昌|1672.86292380605|2743|1.01979154695437|1705.97146891078|18.3868313709809|
170 | |南充|1543.06032568467|2702|2.21178791446534|3412.92217964032|17.3750946091478|
171 | |潍坊|1724.22695298037|2701|1.5294228858372|2637.07216226554|18.8444005611223|
172 | |镇江|1687.17829754601|2608|0.825161795938338|1392.19507407125|18.7894331330997|
173 | |淄博|1597.66736053288|2402|0.605810771063165|967.884095586881|17.4452130591045|
174 | |咸阳|1815.42994966442|2384|0.882367630414102|1601.87662286819|18.1136061831494|
175 | |襄阳|2039.81575246132|2133|1.03307320279598|2107.27899250892|20.5759360540475|
176 | |威海|2245.87868197703|2003|0.611380777941409|1373.08705574914|24.3529174520595|
177 | |昆山|2527.36911392405|1975|0.637777712650937|1611.8996925031|34.0615553990361|
178 | |温州|3847.33248081841|1955|1.00214069291063|3855.56843818497|41.9516853471863|
179 | |上饶|2239.23102493074|1805|1.17449863070962|2629.97377262367|21.8100247351876|
180 | |淮安|1702.80701754385|1710|0.378422276217911|644.38010753878|19.3576744398053|
181 | |天津|1179.38823529411|1700|0.322736599603938|380.631748671712|48.5547685518512|
182 | |吉安|2112.86795881284|1651|2.20133249490565|4651.12489517968|20.2274173121893|
183 | |新乡|1654.15545959284|1621|0.917551923757102|1517.77352414272|17.8166400742456|
184 | |北海|2242.29798308393|1537|3.21429194380693|7207.4003426412|19.5336060867021|
185 | |临沂|1767.34797072521|1503|1.46756559015707|2593.69906767026|17.5827109477228|
186 | |黄石|1849.84735413839|1474|0.614492253754022|1136.71686974542|20.6235259259178|
187 | |清远|2067.55864661654|1330|0.74138815516404|1532.86349070849|21.5478876471608|
188 | |宝鸡|1552.4|1320|1.26998825614068|1971.5297688328|15.8584673082762|
189 | |盐城|2140.84503816793|1310|0.40213813596845|860.915433046161|23.2795321567124|
190 | |江门|2525.11306340718|1309|1.20124140666241|3033.27036826888|29.737582699798|
191 | |凉山|2564.89548693586|1263|1.41514953817485|3629.71066380406|25.3397820732061|
192 | |宜昌|2504.90854700854|1170|0.840791611262243|2106.10609330388|25.9000020383992|
193 | |安庆|1415.92227979274|1158|0.430001218899363|608.848306177647|15.3778959764289|
194 | |桂林|2009.21928817451|871|0.66185880223355|1329.81947149572|18.9237472440825|
195 | |汉中|1496.03423848878|847|0.968520939220504|1448.94048576718|15.7408352539935|
196 | |柳州|2563.48125|800|0.451889211393374|1158.4095204842|27.8477236415413|
197 | |常德|2202.27886056971|667|0.665672634235793|1465.99677043724|25.6296145133268|
198 | |岳阳|2157.41666666666|660|0.449513043068963|969.786931001033|23.0294739753962|
199 | |马鞍山|1554.9459041731|647|0.76600303448639|1191.09328105878|17.2901417334591|
200 | |九江|1887.63111888111|572|0.364445647116357|687.938944637602|21.1405524930945|
201 | |丹东|1793.38431372549|510|2.77160962486559|4970.56122500454|21.2853034436567|
202 | |株洲|1546.75442043222|509|0.250728789532804|387.815863539484|21.9668878354198|
203 | |达州|2409.04522613065|398|1.53432335031197|3696.25434240985|28.3688397460547|
204 | |杭州|3876.23171914214|35064|0.967959372074438|3752.03482087584|71.3253039060405|
205 |
--------------------------------------------------------------------------------
/docs/script/bootstrap:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | gem install bundler
6 | bundle install
7 |
--------------------------------------------------------------------------------
/docs/script/cibuild:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | bundle exec jekyll build
6 | bundle exec htmlproofer ./_site --check-html --check-sri
7 | bundle exec rubocop -D
8 | bundle exec script/validate-html
9 | gem build jekyll-theme-slate.gemspec
10 |
--------------------------------------------------------------------------------
/docs/script/release:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Tag and push a release.
3 |
4 | set -e
5 |
6 | # Make sure we're in the project root.
7 |
8 | cd $(dirname "$0")/..
9 |
10 | # Make sure the darn thing works
11 |
12 | bundle update
13 |
14 | # Build a new gem archive.
15 |
16 | rm -rf jekyll-theme-slate-*.gem
17 | gem build -q jekyll-theme-slate.gemspec
18 |
19 | # Make sure we're on the master branch.
20 |
21 | (git branch | grep -q 'master') || {
22 | echo "Only release from the master branch."
23 | exit 1
24 | }
25 |
26 | # Figure out what version we're releasing.
27 |
28 | tag=v`ls jekyll-theme-slate-*.gem | sed 's/^jekyll-theme-slate-\(.*\)\.gem$/\1/'`
29 |
30 | # Make sure we haven't released this version before.
31 |
32 | git fetch -t origin
33 |
34 | (git tag -l | grep -q "$tag") && {
35 | echo "Whoops, there's already a '${tag}' tag."
36 | exit 1
37 | }
38 |
39 | # Tag it and bag it.
40 |
41 | gem push jekyll-theme-slate-*.gem && git tag "$tag" &&
42 | git push origin master && git push origin "$tag"
43 |
--------------------------------------------------------------------------------
/docs/script/validate-html:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require 'w3c_validators'
5 |
6 | def validator(file)
7 | extension = File.extname(file)
8 | if extension == '.html'
9 | W3CValidators::NuValidator.new
10 | elsif extension == '.css'
11 | W3CValidators::CSSValidator.new
12 | end
13 | end
14 |
15 | def validate(file)
16 | puts "Checking #{file}..."
17 |
18 | path = File.expand_path "../_site/#{file}", __dir__
19 | results = validator(file).validate_file(path)
20 |
21 | return puts 'Valid!' if results.errors.empty?
22 |
23 | results.errors.each { |err| puts err.to_s }
24 | exit 1
25 | end
26 |
27 | validate 'index.html'
28 | validate File.join 'assets', 'css', 'style.css'
29 |
--------------------------------------------------------------------------------
/docs/thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jinnrry/getAwayBSG/f86ac37680e2bfb83feb67ecc7dc61326e0ccecf/docs/thumbnail.png
--------------------------------------------------------------------------------
/entrance/clean_status.go:
--------------------------------------------------------------------------------
1 | package entrance
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "getAwayBSG/configs"
7 | "getAwayBSG/db"
8 | "go.mongodb.org/mongo-driver/bson"
9 | "go.mongodb.org/mongo-driver/mongo"
10 | "go.mongodb.org/mongo-driver/mongo/options"
11 | "os"
12 | "strings"
13 | "time"
14 | )
15 |
16 | func Start_clean() {
17 | var choice int
18 | if strings.Index(strings.Join(os.Args, ""), "lianjia_ershou") > -1 {
19 | choice = 1
20 | } else if strings.Index(strings.Join(os.Args, ""), "zhilian") > -1 {
21 | choice = 2
22 | } else if strings.Index(strings.Join(os.Args, ""), "lianjia_zufang") > -1 {
23 | choice = 3
24 | } else {
25 | fmt.Println("清除抓取状态(不清除状态的话爬虫会从上次停止位置继续抓取)")
26 | fmt.Println("请选择需要清除哪个爬虫的的状态数据:(输入数字)")
27 | fmt.Println("1.链家二手房")
28 | fmt.Println("2.智联")
29 | fmt.Println("3.链家租房")
30 | fmt.Scanln(&choice)
31 |
32 | }
33 |
34 | if choice == 1 {
35 | db.SetLianjiaStatus(0)
36 | clean_visit()
37 | fmt.Println("Done!")
38 | } else if choice == 2 {
39 | db.SetZhilianStatus(0, 0)
40 | fmt.Println("Done!")
41 | } else if choice == 3 {
42 | db.SetLianjiaZuFangStatus(0)
43 | clean_visit()
44 | fmt.Println("Done!")
45 | } else {
46 | fmt.Println("选择错误!")
47 | }
48 |
49 | }
50 |
51 | func clean_visit() {
52 | conf := configs.Config()
53 |
54 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
55 | defer cancel()
56 |
57 | client, _ := mongo.NewClient(options.Client().ApplyURI(conf["dburl"].(string) + "/colly"))
58 | if err := client.Connect(ctx); err != nil {
59 | fmt.Println(err)
60 | }
61 |
62 | odb := client.Database("colly")
63 | cookies := odb.Collection("colly_cookies")
64 | visit := odb.Collection("colly_visited")
65 | //清除全部的cookies
66 | _, err := cookies.DeleteMany(ctx, bson.M{})
67 | if err != nil {
68 | fmt.Println(err)
69 | }
70 | _, err = visit.DeleteMany(ctx, bson.M{})
71 | if err != nil {
72 | fmt.Println(err)
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/entrance/info.go:
--------------------------------------------------------------------------------
1 | package entrance
2 |
3 | import (
4 | "getAwayBSG/configs"
5 | "getAwayBSG/db"
6 | "go.mongodb.org/mongo-driver/bson"
7 | "os"
8 | "strconv"
9 | "strings"
10 | "time"
11 | )
12 |
13 | func Start_info(path string) {
14 |
15 | fd, _ := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
16 | fd_time := time.Now().Format("2006-01-02 15:04:05")
17 | fd_content := strings.Join([]string{
18 | fd_time, ":",
19 | getLianjiaErShouFangStatus(), " ",
20 | getLianJiaZuFangStatus(), " ",
21 | getZhiLianStatus(), "\n",
22 | }, "")
23 | buf := []byte(fd_content)
24 | fd.Write(buf)
25 | fd.Close()
26 |
27 | }
28 |
29 | func getLianjiaErShouFangStatus() string {
30 | configInfo := configs.Config()
31 | client := db.GetClient()
32 | ctx := db.GetCtx()
33 |
34 | odb := client.Database(configInfo["dbDatabase"].(string))
35 | lianjia := odb.Collection(configInfo["dbCollection"].(string))
36 | lianjia_status := odb.Collection("lianjia_status")
37 | var info bson.M
38 |
39 | res := lianjia_status.FindOne(ctx, bson.M{})
40 | res.Decode(&info)
41 | detailNum, _ := lianjia.CountDocuments(ctx, bson.M{"address": bson.M{"$exists": true}})
42 | allNum, _ := lianjia.CountDocuments(ctx, bson.M{})
43 |
44 | return "链家二手房:详情数" + strconv.Itoa(int(detailNum)) + "总数:" + strconv.Itoa(int(allNum)) + " index:" + strconv.Itoa(int(info["index"].(int32)));
45 | }
46 |
47 | func getZhiLianStatus() string {
48 | configInfo := configs.Config()
49 | client := db.GetClient()
50 | ctx := db.GetCtx()
51 |
52 | odb := client.Database(configInfo["dbDatabase"].(string))
53 | zhilian := odb.Collection(configInfo["zlDBCollection"].(string))
54 | zhilian_status := odb.Collection("zhilian_status")
55 |
56 | zhilianNum, _ := zhilian.CountDocuments(ctx, bson.M{})
57 | var info bson.M
58 | res := zhilian_status.FindOne(ctx, bson.M{})
59 | res.Decode(&info)
60 |
61 | return "智联总数:" + strconv.Itoa(int(zhilianNum)) + " city_index:" + strconv.Itoa(int(info["city_index"].(int32))) + " kw_index:" + strconv.Itoa(int(info["kw_index"].(int32)))
62 | }
63 |
64 | func getLianJiaZuFangStatus() string {
65 | configInfo := configs.Config()
66 | client := db.GetClient()
67 | ctx := db.GetCtx()
68 |
69 | odb := client.Database(configInfo["dbDatabase"].(string))
70 | lianjiaZf := odb.Collection(configInfo["zufangCollection"].(string))
71 | lianjiaZFStatus := odb.Collection("lianjiazf_status")
72 |
73 | var info bson.M
74 |
75 | res := lianjiaZFStatus.FindOne(ctx, bson.M{})
76 |
77 | res.Decode(&info)
78 |
79 | allNum, _ := lianjiaZf.CountDocuments(ctx, bson.M{})
80 |
81 | return "链家租房:总数" + strconv.Itoa(int(allNum)) + " index:" + strconv.Itoa(int(info["index"].(int32)))
82 | }
83 |
--------------------------------------------------------------------------------
/entrance/lianjia.go:
--------------------------------------------------------------------------------
1 | package entrance
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "getAwayBSG/configs"
7 | "getAwayBSG/db"
8 | "github.com/gocolly/colly"
9 | "github.com/gocolly/colly/extensions"
10 | "github.com/gocolly/colly/proxy"
11 | cachemongo "github.com/zolamk/colly-mongo-storage/colly/mongo"
12 | "go.mongodb.org/mongo-driver/bson"
13 | "net/url"
14 | "regexp"
15 | "strconv"
16 | "strings"
17 | "time"
18 | )
19 |
20 | type Page struct {
21 | TotalPage int
22 | CurPage int
23 | }
24 |
25 | func crawlerOneCity(cityUrl string) {
26 | c := colly.NewCollector()
27 | configInfo := configs.Config()
28 |
29 | if configInfo["crawlDelay"] != nil {
30 | delay, _ := configInfo["crawlDelay"].(json.Number).Int64()
31 | if delay > 0 {
32 | c.Limit(&colly.LimitRule{
33 | DomainGlob: "*",
34 | Delay: time.Duration(delay) * time.Second,
35 | })
36 | }
37 | }
38 |
39 | if configInfo["proxyList"] != nil && len(configInfo["proxyList"].([]interface{})) > 0 {
40 | var proxyList []string
41 | for _, v := range configInfo["proxyList"].([]interface{}) {
42 | proxyList = append(proxyList, v.(string))
43 | }
44 |
45 | if configInfo["proxyList"] != nil {
46 | rp, err := proxy.RoundRobinProxySwitcher(proxyList...)
47 | if err != nil {
48 | fmt.Println(err)
49 | }
50 | c.SetProxyFunc(rp)
51 | }
52 | }
53 | extensions.RandomUserAgent(c)
54 | extensions.Referer(c)
55 | storage := &cachemongo.Storage{
56 | Database: "colly",
57 | URI: configInfo["dburl"].(string) + "/colly",
58 | }
59 | if err := c.SetStorage(storage); err != nil {
60 | panic(err)
61 | }
62 | c.OnRequest(func(r *colly.Request) {
63 | fmt.Println("列表抓取:", r.URL.String())
64 | })
65 |
66 | c.OnHTML("title", func(element *colly.HTMLElement) {
67 | fmt.Println(element.Text)
68 | })
69 |
70 | c.OnHTML("body", func(element *colly.HTMLElement) {
71 | // 获取一页的数据
72 | element.ForEach(".LOGCLICKDATA", func(i int, e *colly.HTMLElement) {
73 | link := e.ChildAttr("a", "href")
74 |
75 | title := e.ChildText("a:first-child")
76 | fmt.Println(title)
77 |
78 | price := e.ChildText(".totalPrice")
79 | price = strings.Replace(price, "万", "0000", 1)
80 | //fmt.Println("总价:" + price)
81 | iPrice, err := strconv.Atoi(price)
82 | if err != nil {
83 | iPrice = 0
84 | }
85 |
86 | unitPrice := e.ChildAttr(".unitPrice", "data-price")
87 |
88 | //fmt.Println("每平米:" + unitPrice)
89 | //fmt.Println(e.Text)
90 |
91 | iUnitPrice, err := strconv.Atoi(unitPrice)
92 | if err != nil {
93 | iUnitPrice = 0
94 | }
95 | db.Add(bson.M{"zq_detail_status": 0, "Title": title, "TotalePrice": iPrice, "UnitPrice": iUnitPrice, "Link": link, "listCrawlTime": time.Now()})
96 |
97 | })
98 |
99 | // 切换地点
100 | element.ForEach(".position a", func(i int, element *colly.HTMLElement) {
101 | u, err := url.Parse(cityUrl)
102 | if err != nil {
103 | panic(err)
104 | }
105 | rootUrl := u.Scheme + "://" + u.Host
106 | goUrl := element.Attr("href")
107 | u, err = url.Parse(goUrl)
108 | if err != nil {
109 | fmt.Println(err)
110 | }
111 | if u.Scheme == "" {
112 | goUrl = rootUrl + u.Path
113 | } else {
114 | goUrl = u.String()
115 | }
116 | re, _ := regexp.Compile("pg\\d+/*")
117 | goUrl = re.ReplaceAllString(goUrl, "")
118 | err = c.Visit(goUrl)
119 | fmt.Println(err)
120 | })
121 |
122 | // 下一页
123 | element.ForEach(".page-box", func(i int, element *colly.HTMLElement) {
124 | var page Page
125 | err := json.Unmarshal([]byte(element.ChildAttr(".house-lst-page-box", "page-data")), &page)
126 | if err == nil {
127 | if page.CurPage < page.TotalPage {
128 | var gourl string
129 | re, _ := regexp.Compile("pg\\d+/*")
130 | gourl = re.ReplaceAllString(element.Request.URL.String(), "")
131 | gourl = gourl + "pg" + strconv.Itoa(page.CurPage+1)
132 | err = c.Visit(gourl)
133 | fmt.Println(err)
134 | }
135 | }
136 | })
137 |
138 | })
139 |
140 | err := c.Visit(cityUrl)
141 | fmt.Println(err)
142 |
143 | }
144 |
145 | func listCrawler() {
146 | confInfo := configs.Config()
147 | cityList := confInfo["cityList"].([]interface{})
148 | for i := db.GetLianjiaStatus(); i < len(cityList); i++ {
149 | crawlerOneCity(cityList[i].(string))
150 | db.SetLianjiaStatus(i)
151 | }
152 | }
153 |
154 | func crawlDetail() (sucnum int) {
155 | sucnum = 0
156 | c := colly.NewCollector()
157 | configInfo := configs.Config()
158 |
159 | //设置延时
160 | if configInfo["crawlDelay"] != nil {
161 | delay, _ := configInfo["crawlDelay"].(json.Number).Int64()
162 | if delay > 0 {
163 | c.Limit(&colly.LimitRule{
164 | DomainGlob: "*",
165 | Delay: time.Duration(delay) * time.Second,
166 | })
167 | }
168 | }
169 |
170 | //设置代理
171 | if configInfo["proxyList"] != nil && len(configInfo["proxyList"].([]interface{})) > 0 {
172 | var proxyList []string
173 | for _, v := range configInfo["proxyList"].([]interface{}) {
174 | proxyList = append(proxyList, v.(string))
175 | }
176 |
177 | if configInfo["proxyList"] != nil {
178 | rp, err := proxy.RoundRobinProxySwitcher(proxyList...)
179 | if err != nil {
180 | fmt.Println(err)
181 | }
182 | c.SetProxyFunc(rp)
183 | }
184 | }
185 |
186 | //随机UA
187 | extensions.RandomUserAgent(c)
188 | //自动referer
189 | extensions.Referer(c)
190 | //设置MongoDB存储状态信息
191 | storage := &cachemongo.Storage{
192 | Database: "colly",
193 | URI: configInfo["dburl"].(string) + "/colly",
194 | }
195 | if err := c.SetStorage(storage); err != nil {
196 | panic(err)
197 | }
198 | c.OnHTML(".area .mainInfo", func(element *colly.HTMLElement) {
199 | area := strings.Replace(element.Text, "平米", "", 1)
200 | iArea, err := strconv.Atoi(area)
201 | if err != nil {
202 | iArea = 0
203 | }
204 |
205 | db.Update(element.Request.URL.String(), bson.M{"area": iArea, "detailCrawlTime": time.Now()})
206 |
207 | })
208 |
209 | c.OnHTML("title", func(element *colly.HTMLElement) {
210 | fmt.Println(element.Text)
211 | })
212 |
213 | c.OnHTML(".aroundInfo .communityName .info", func(element *colly.HTMLElement) {
214 | db.Update(element.Request.URL.String(), bson.M{"xiaoqu": element.Text, "detailCrawlTime": time.Now()})
215 | })
216 |
217 | c.OnHTML(".l-txt", func(element *colly.HTMLElement) {
218 | res := strings.Replace(element.Text, "二手房", "", 99)
219 | res = strings.Replace(res, " ", "", 99)
220 | address := strings.Split(res, ">")
221 | db.Update(element.Request.URL.String(), bson.M{"address": address[1 : len(address)-1], "detailCrawlTime": time.Now()})
222 | })
223 |
224 | c.OnHTML(".transaction li", func(element *colly.HTMLElement) {
225 | if element.ChildText("span:first-child") == "挂牌时间" {
226 |
227 | sGTime := element.ChildText("span:last-child")
228 | ttime, err := time.Parse("2006-01-02", sGTime)
229 |
230 | if err != nil {
231 | ttime = time.Now()
232 | }
233 |
234 | db.Update(element.Request.URL.String(), bson.M{"zq_detail_status": 1, "guapaitime": ttime, "detailCrawlTime": time.Now()})
235 | }
236 | })
237 |
238 | c.OnRequest(func(r *colly.Request) {
239 | fmt.Println("详情抓取:", r.URL.String())
240 | })
241 |
242 | client := db.GetClient()
243 | ctx := db.GetCtx()
244 |
245 | odb := client.Database(configInfo["dbDatabase"].(string))
246 | lianjia := odb.Collection(configInfo["dbCollection"].(string))
247 |
248 | //读取出全部需要抓取详情的数据
249 | cur, err := lianjia.Find(ctx, bson.M{"zq_detail_status": 0})
250 |
251 | if err != nil {
252 | fmt.Println(err)
253 | } else {
254 | defer cur.Close(ctx)
255 | for cur.Next(ctx) {
256 | var item bson.M
257 | if err := cur.Decode(&item); err != nil {
258 | fmt.Print("数据库读取失败!")
259 | fmt.Println(err)
260 | } else {
261 | sucnum++
262 | c.Visit(item["Link"].(string))
263 | }
264 |
265 | }
266 | }
267 |
268 | return sucnum
269 | }
270 |
271 | func Start_lianjia_ershou() {
272 | listFlag := make(chan int) //记录列表抓取是否完成
273 | detailFlag := make(chan int) //记录详情是否抓取完成
274 |
275 | go func() {
276 | listCrawler()
277 | listFlag <- 1 //列表抓取完成
278 | }()
279 |
280 | go func() {
281 | zeroNum := 0
282 | for i := 0; i < 1; i = 0 {
283 | if crawlDetail() == 0 {
284 | zeroNum++
285 | if zeroNum > 3 { //尝试3次都没有详情需要抓取,结束详情抓取
286 | break
287 | }
288 | time.Sleep(300 * time.Second) //没有详情需要抓取了,等待5分钟再尝试
289 | }
290 | }
291 | detailFlag <- 1 //详情抓取完成
292 | }()
293 |
294 | //详情抓取与列表抓取都完成了,结束主线程
295 | <-listFlag
296 | <-detailFlag
297 | }
298 |
--------------------------------------------------------------------------------
/entrance/lianjia_zufang.go:
--------------------------------------------------------------------------------
1 | package entrance
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "getAwayBSG/configs"
7 | "getAwayBSG/db"
8 | "github.com/gocolly/colly"
9 | "github.com/gocolly/colly/extensions"
10 | "github.com/gocolly/colly/proxy"
11 | cachemongo "github.com/zolamk/colly-mongo-storage/colly/mongo"
12 | "go.mongodb.org/mongo-driver/bson"
13 | "net/url"
14 | "regexp"
15 | "strconv"
16 | "strings"
17 | "time"
18 | )
19 |
20 | func TcrawlerOneCityZuFang(cityUrl string, cityname string) {
21 | c := colly.NewCollector()
22 | configInfo := configs.Config()
23 |
24 | if configInfo["crawlDelay"] != nil {
25 | delay, _ := configInfo["crawlDelay"].(json.Number).Int64()
26 | if delay > 0 {
27 | c.Limit(&colly.LimitRule{
28 | DomainGlob: "*",
29 | Delay: time.Duration(delay) * time.Second,
30 | })
31 | }
32 | }
33 |
34 | if configInfo["proxyList"] != nil && len(configInfo["proxyList"].([]interface{})) > 0 {
35 | var proxyList []string
36 | for _, v := range configInfo["proxyList"].([]interface{}) {
37 | proxyList = append(proxyList, v.(string))
38 | }
39 |
40 | if configInfo["proxyList"] != nil {
41 | rp, err := proxy.RoundRobinProxySwitcher(proxyList...)
42 | if err != nil {
43 | fmt.Println(err)
44 | }
45 | c.SetProxyFunc(rp)
46 | }
47 | }
48 | extensions.RandomUserAgent(c)
49 | extensions.Referer(c)
50 | storage := &cachemongo.Storage{
51 | Database: "colly",
52 | URI: configInfo["dburl"].(string) + "/colly",
53 | }
54 | if err := c.SetStorage(storage); err != nil {
55 | panic(err)
56 | }
57 | c.OnRequest(func(r *colly.Request) {
58 | fmt.Println("列表抓取:", r.URL.String())
59 | })
60 |
61 | c.OnHTML("title", func(element *colly.HTMLElement) {
62 | fmt.Println(element.Text)
63 | })
64 |
65 | c.OnHTML(".content__list--item", func(element *colly.HTMLElement) {
66 | var err error
67 | var link string
68 | var title string
69 | var address string
70 | var area string
71 | var price int
72 | var mianji int
73 | element.ForEach(".twoline a", func(i int, element *colly.HTMLElement) {
74 | link = "https://" + element.Request.URL.Host + element.Attr("href")
75 | title = strings.TrimSpace(element.Text)
76 | })
77 |
78 | element.ForEach(".content__list--item--des a", func(i int, element *colly.HTMLElement) {
79 | if i == 0 {
80 | address = element.Text
81 | } else {
82 | area = element.Text
83 | }
84 | })
85 |
86 | desc := element.ChildText(".content__list--item--des")
87 | desc = strings.ReplaceAll(desc, " ", "")
88 | desc = strings.ReplaceAll(desc, "\n", "")
89 | fmt.Println(desc)
90 | re, _ := regexp.Compile("(\\d+)㎡/")
91 | indexs := re.FindStringIndex(desc)
92 | if len(indexs) == 2 {
93 |
94 | mianji, err = strconv.Atoi(desc[indexs[0] : indexs[1]-4])
95 | if err != nil {
96 | mianji = 0
97 | }
98 | } else {
99 | mianji = 0
100 | }
101 |
102 | element.ForEach(".content__list--item-price em", func(i int, element *colly.HTMLElement) {
103 | var err error
104 | price, err = strconv.Atoi(element.Text)
105 | if err != nil {
106 | price = 0
107 | }
108 | })
109 |
110 | //fmt.Println(price)
111 | //fmt.Println(link)
112 | //fmt.Println(title)
113 | //fmt.Println(address)
114 | //fmt.Println(area)
115 | //fmt.Println(cityname)
116 | fmt.Println("--------------------")
117 |
118 | client := db.GetClient()
119 | ctx := db.GetCtx()
120 |
121 | db := client.Database(configInfo["dbDatabase"].(string))
122 | lianjia := db.Collection(configInfo["zufangCollection"].(string))
123 | _, err = lianjia.InsertOne(ctx, bson.M{
124 | "Link": link,
125 | "title": title,
126 | "address": address,
127 | "area": area,
128 | "price": price,
129 | "city": cityname,
130 | "mianji": mianji,
131 | "crawl_time": time.Now(),
132 | })
133 | if err != nil {
134 | if !strings.Contains(err.Error(), "multiple write errors") {
135 | fmt.Print("数据库插入失败!")
136 | fmt.Println(err)
137 | }
138 | }
139 |
140 | })
141 |
142 | c.OnHTML(".content__pg", func(element *colly.HTMLElement) {
143 | totalPage := element.Attr("data-totalpage")
144 | iTotalPage, err := strconv.Atoi(totalPage)
145 |
146 | if err == nil {
147 | for i := 2; i < iTotalPage; i++ {
148 |
149 | re, _ := regexp.Compile("pg\\d+/*")
150 | goUrl := re.ReplaceAllString(element.Request.URL.String(), "")
151 |
152 | err = c.Visit(goUrl + "pg" + strconv.Itoa(i) + "/")
153 | if err != nil && err.Error() != "URL already visited" {
154 | fmt.Println(err)
155 | }
156 |
157 | }
158 | }
159 | })
160 |
161 | c.OnHTML(".filter ul", func(element *colly.HTMLElement) {
162 |
163 | data_target := element.Attr("data-target")
164 |
165 | if data_target == "area" {
166 | element.ForEach("a", func(i int, element *colly.HTMLElement) {
167 | //// 切换地点
168 | u, err := url.Parse(cityUrl)
169 | if err != nil {
170 | panic(err)
171 | }
172 | rootUrl := u.Scheme + "://" + u.Host
173 | goUrl := element.Attr("href")
174 | u, err = url.Parse(goUrl)
175 | if err != nil && err.Error() != "URL already visited" {
176 | fmt.Println(err)
177 | }
178 | if u.Scheme == "" {
179 | goUrl = rootUrl + u.Path
180 | } else {
181 | goUrl = u.String()
182 | }
183 | re, _ := regexp.Compile("pg\\d+/*")
184 | goUrl = re.ReplaceAllString(goUrl, "")
185 | err = c.Visit(goUrl)
186 | if err != nil && err.Error() != "URL already visited" {
187 | fmt.Println(err)
188 | }
189 |
190 | })
191 | }
192 |
193 | })
194 |
195 | err := c.Visit(cityUrl)
196 | if err != nil && err.Error() != "URL already visited" {
197 | fmt.Println(err)
198 | }
199 |
200 | }
201 |
202 | func Start_LianjiaZufang() {
203 | configinfo := configs.Config()
204 |
205 | cityList := configinfo["zufangCityList"].([]interface{})
206 |
207 | for i := db.GetLianjiaZuFangStatus(); i < len(cityList); i++ {
208 | TcrawlerOneCityZuFang(cityList[i].(map[string]interface{})["link"].(string), cityList[i].(map[string]interface{})["name"].(string))
209 | db.SetLianjiaZuFangStatus(i)
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/entrance/zhilian.go:
--------------------------------------------------------------------------------
1 | package entrance
2 |
3 | import (
4 | "crypto/tls"
5 | "encoding/json"
6 | "fmt"
7 | "getAwayBSG/configs"
8 | "getAwayBSG/db"
9 | "io/ioutil"
10 | "math/rand"
11 | "net/http"
12 | "net/url"
13 | "strconv"
14 | "time"
15 | )
16 |
17 | func Start_zhilian() {
18 | configInfo := configs.Config()
19 | keys := configInfo["zlKeyWords"].([]interface{})
20 | cityList := configInfo["zlCityList"].([]interface{})
21 |
22 | cityIndex, kwIndex := db.GetZhilianStatus()
23 |
24 | for i := kwIndex; i < len(keys); i++ {
25 | for j := cityIndex; j < len(cityList); j++ {
26 | var total int = 1000
27 | for start := 0; start < total; start += 50 {
28 | cityid := cityList[j].(map[string]interface{})["code"]
29 | if cityid == nil {
30 | fmt.Println(cityList[j])
31 | }
32 | icityid, err := cityid.(json.Number).Int64()
33 | if err != nil {
34 | icityid = 530
35 | }
36 | length := 50
37 | keyword := keys[i].(string)
38 | keyword = url.QueryEscape(keyword)
39 | ////apiUrl:= "https://fe-api.zhaopin.com/c/i/sou?start=" + strconv.Itoa(start) + "pageSize=" + strconv.Itoa(length) + "&cityId=" + strconv.Itoa(cityid) + "&workExperience=-1&education=-1&companyType=-1&employmentType=-1&jobWelfareTag=-1&sortType=publish&kw=" + keys[i].(string) + "&kt=3&_v=0.17996222&x-zp-page-request-id=e8d2c03d3c4347a9b5edffa03367d90d-1547646999572-254944"
40 | apiUrl := "https://fe-api.zhaopin.com/c/i/sou?start=" + strconv.Itoa(start) + "&pageSize=" + strconv.Itoa(length) + "&cityId=" + strconv.Itoa(int(icityid)) + "&workExperience=-1&education=-1&companyType=-1&employmentType=-1&jobWelfareTag=-1&sortType=publish&kw=" + keyword + "&kt=3&_v=0.96788938&x-zp-page-request-id=adce992a71af4857ad9dd407cae222ff-1562161856663-558612&x-zp-client-id=f0fe8f7b-8a03-4076-9894-4389e9959954"
41 | fmt.Println(apiUrl)
42 | res := get(apiUrl)
43 | var mapResult map[string]interface{}
44 | err = json.Unmarshal([]byte(res), &mapResult)
45 |
46 | if err != nil {
47 | fmt.Println("JsonToMapDemo err: ", err)
48 | } else {
49 | if mapResult["data"] != nil {
50 | data := mapResult["data"].(map[string]interface{})
51 | numTotal := data["numTotal"]
52 | total = int(numTotal.(float64))
53 | results := data["results"].([]interface{})
54 | for index := range results {
55 | var itemTime string
56 | loc, _ := time.LoadLocation("Local")
57 | itemTime = results[index].(map[string]interface{})["updateDate"].(string)
58 | results[index].(map[string]interface{})["updateDate"], _ = time.ParseInLocation("2006-01-02 15:04:05", itemTime, loc)
59 | results[index].(map[string]interface{})["crawler_time"] = time.Now()
60 | }
61 | db.AddZLItem(results)
62 | } else {
63 | fmt.Println("接口返回错误!")
64 | }
65 | }
66 | }
67 | db.SetZhilianStatus(j, i)
68 | }
69 | }
70 | //fmt.Println(keys[i])
71 |
72 | }
73 |
74 | func get(link string) (bodystr string) {
75 |
76 | bodystr = ""
77 | var client *http.Client
78 | configInfo := configs.Config()
79 |
80 | if configInfo["crawlDelay"] != nil {
81 | delay, _ := configInfo["crawlDelay"].(json.Number).Int64()
82 | if delay > 0 {
83 | time.Sleep(time.Duration(delay) * time.Second)
84 | }
85 | }
86 |
87 | if configInfo["proxyList"] != nil {
88 | var proxyList []string
89 | for _, v := range configInfo["proxyList"].([]interface{}) {
90 | proxyList = append(proxyList, v.(string))
91 | }
92 | rand.Seed(time.Now().Unix())
93 |
94 | proxy, _ := url.Parse(proxyList[rand.Intn(len(proxyList))])
95 | tr := &http.Transport{
96 | Proxy: http.ProxyURL(proxy),
97 | TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
98 | }
99 |
100 | client = &http.Client{
101 | Transport: tr,
102 | Timeout: time.Second * 10, //超时时间
103 | }
104 | } else {
105 | client = &http.Client{
106 | Timeout: time.Second * 10, //超时时间
107 | }
108 | }
109 |
110 | reqest, _ := http.NewRequest("GET", link, nil)
111 |
112 | reqest.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
113 | reqest.Header.Set("Accept-Charset", "GBK,utf-8;q=0.7,*;q=0.3")
114 | reqest.Header.Set("Accept-Encoding", "gzip,deflate,sdch")
115 | reqest.Header.Set("Accept-Language", "zh-CN,zh;q=0.8")
116 | reqest.Header.Set("Cache-Control", "max-age=0")
117 | reqest.Header.Set("Connection", "keep-alive")
118 | reqest.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36")
119 |
120 | response, _ := client.Do(reqest)
121 | if response != nil {
122 | if response.StatusCode == 200 {
123 | body, _ := ioutil.ReadAll(response.Body)
124 | bodystr = string(body)
125 | }
126 | }
127 |
128 | return bodystr
129 | }
130 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "flag"
5 | "fmt"
6 | "getAwayBSG/configs"
7 | "getAwayBSG/entrance"
8 | )
9 |
10 | // 申明配置变量
11 | var (
12 | help bool
13 | config string
14 | lianjia_ershou bool
15 | lianjia_zufang bool
16 | zhilian bool
17 | clean bool
18 | info bool
19 | infoSaveTo string
20 | )
21 |
22 | func init() {
23 | flag.BoolVar(&help, "help", false, "显示帮助")
24 | flag.StringVar(&config, "config", "./config.yaml", "设置配置文件")
25 | flag.BoolVar(&lianjia_ershou, "lianjia_ershou", false, "抓取链家二手房数据")
26 | flag.BoolVar(&lianjia_zufang, "lianjia_zufang", false, "抓取链家租房数据")
27 | flag.BoolVar(&zhilian, "zhilian", false, "抓取智联招聘数据")
28 | flag.BoolVar(&clean, "clean", false, "清理缓存")
29 | flag.BoolVar(&info, "info", false, "保存抓取状态")
30 | flag.StringVar(&infoSaveTo, "info_save_to", "./numlog.txt", "输入状态文件保存位置")
31 | }
32 |
33 | func main() {
34 | flag.Parse()
35 | //初始化配置信息,同时输出配置信息
36 | if config != "" {
37 | configs.SetConfig(config)
38 | }
39 | fmt.Println(configs.Config())
40 |
41 |
42 | //进入不同入口
43 | if help {
44 | flag.Usage()
45 | } else if lianjia_ershou {
46 | entrance.Start_lianjia_ershou()
47 | } else if lianjia_zufang {
48 | entrance.Start_LianjiaZufang()
49 | } else if zhilian {
50 | entrance.Start_zhilian()
51 | } else if clean {
52 | entrance.Start_clean()
53 | } else if info {
54 | entrance.Start_info(infoSaveTo)
55 | } else {
56 | flag.Usage()
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/numLog.txt:
--------------------------------------------------------------------------------
1 | ======2019-07-12 09:20:26=====链接:详情数166529总数:378005;智联总数:120759
2 | ======2019-07-12 09:20:46=====链接:详情数166538总数:378052;智联总数:120759
3 | ======2019-07-29 10:12:01=====链接:详情数552711总数:1328148;智联总数:134898 index:14 city_index:367 kw_index:1
4 | 2019-07-30 14:10:15:
5 | 链家二手房:详情数554007总数:1332650 index:0
6 | 链家租房:总数9675index:0
7 | 智联总数:137323 city_index:0 kw_index:0
8 | 2019-07-30 14:11:08:
9 | 链家二手房:详情数554007总数:1332650 index:0
10 | 链家租房:总数10003 index:0
11 | 智联总数:137323 city_index:0 kw_index:0
12 |
--------------------------------------------------------------------------------
/proxypool/proxy.go:
--------------------------------------------------------------------------------
1 | package proxypool
2 |
3 | // 代理实现层
4 | import (
5 | "context"
6 | "fmt"
7 | "getAwayBSG/configs"
8 | "github.com/gocolly/colly"
9 | "io/ioutil"
10 | "math/rand"
11 | "net/http"
12 | "net/url"
13 | )
14 |
15 | type proxyPool struct {
16 | proxyURLs []*url.URL
17 | }
18 |
19 | func (r *proxyPool) GetProxy(pr *http.Request) (*url.URL, error) {
20 | // 从配置文件读取代理,可以修改返回,从其他地方获取代理,比如代理池
21 | if len(r.proxyURLs) > 0 {
22 | proxyLink := r.proxyURLs[rand.Intn(len(r.proxyURLs))]
23 | // 将代理写入上下文
24 | ctx := context.WithValue(pr.Context(), colly.ProxyURLKey, proxyLink)
25 | *pr = *pr.WithContext(ctx)
26 | return proxyLink, nil
27 | } else {
28 | proxyLink, ip := getOneProxy()
29 | // 将代理写入上下文
30 | ctx := context.WithValue(pr.Context(), colly.ProxyURLKey, ip)
31 | *pr = *pr.WithContext(ctx)
32 | return url.Parse(proxyLink)
33 | }
34 |
35 | }
36 |
37 | func GetProxyPool() (colly.ProxyFunc, error) {
38 | configInfo := configs.Config()
39 | var proxyURLs []*url.URL
40 | if configInfo["proxyList"] != nil && len(configInfo["proxyList"].([]interface{})) > 0 {
41 | for _, v := range configInfo["proxyList"].([]interface{}) {
42 | urlLink, err := url.Parse(v.(string))
43 | if err == nil {
44 | proxyURLs = append(proxyURLs, urlLink)
45 | }
46 | }
47 |
48 | }
49 | return (&proxyPool{proxyURLs: proxyURLs}).GetProxy, nil
50 |
51 | }
52 |
53 | func getOneProxy() (string, string) {
54 | resp, _ := http.Get("http://45.78.45.70:5015/get/")
55 | defer resp.Body.Close()
56 | body, err := ioutil.ReadAll(resp.Body)
57 | if err != nil {
58 | // handle error
59 | }
60 | proxy := "http://" + string(body)
61 | fmt.Println("使用默认代理:" + proxy)
62 | return proxy, string(body)
63 | }
64 |
--------------------------------------------------------------------------------