From addaec4cf403f79250add5c0e9efa3eea0fe2122 Mon Sep 17 00:00:00 2001 From: "Hancel.Lin" Date: Tue, 10 Apr 2018 17:32:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=A1=B9=E7=9B=AE=E4=BA=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81=E5=92=8C=E7=88=AC=E8=99=AB?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01/readme.md | 6 +- 02/crawler/Python/main_bs4.py | 30 ++++++++++ 02/crawler/Python/main_re.py | 29 +++++++++ 02/crawler/Python/requirements.txt | 4 ++ 02/crawler/node/app.js | 36 +++++++++++ 02/crawler/node/package.json | 15 +++++ 02/frontend/css/style.css | 93 +++++++++++++++++++++++++++++ 02/frontend/img/logo.png | Bin 0 -> 11455 bytes 02/frontend/index.html | 30 ++++++++++ 02/frontend/js/do.js | 20 +++++++ 02/readme.md | 6 +- 03/readme.md | 8 +++ readme.md | 5 +- 13 files changed, 274 insertions(+), 8 deletions(-) create mode 100644 02/crawler/Python/main_bs4.py create mode 100644 02/crawler/Python/main_re.py create mode 100644 02/crawler/Python/requirements.txt create mode 100644 02/crawler/node/app.js create mode 100644 02/crawler/node/package.json create mode 100644 02/frontend/css/style.css create mode 100644 02/frontend/img/logo.png create mode 100644 02/frontend/index.html create mode 100644 02/frontend/js/do.js create mode 100644 03/readme.md diff --git a/01/readme.md b/01/readme.md index 6590fde..b9f35db 100644 --- a/01/readme.md +++ b/01/readme.md @@ -1,14 +1,14 @@ # 第一期项目 -[[后端] 3/21 猜数字](./backend) +## [[后端] 3/21 猜数字](./backend) 猜数字是一个古老的游戏,由一个出题者随机出一个数字,由猜题者猜,若所猜数字大于所出数字,则出题者回答『大了』;若小于,则回答『小了』;直到猜题者猜中。现在请编写程序模拟出题者,随机数字在1~1000之间。当使用者猜中时,同时打印出猜测次数。 -[[爬虫] 3/21 获取IP](./crawler) +## [[爬虫] 3/21 获取IP](./crawler) 访问网站:ip.sxisa.com 可以得到本机的外网IP。现在,请编写程序,打印出本机的外网IP。 -[[前端] 3/21 网站设计](./frontend) +## [[前端] 3/21 网站设计](./frontend) 按照设计图制作出对应的网页: diff --git a/02/crawler/Python/main_bs4.py b/02/crawler/Python/main_bs4.py new file mode 100644 index 0000000..500a8ed --- /dev/null +++ b/02/crawler/Python/main_bs4.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import requests +from bs4 import BeautifulSoup + +def get_html(url, encoding='utf-8'): + rsp = requests.get(url) + return rsp.content.decode(encoding) + +def analyze(html): + return BeautifulSoup(html, 'lxml') + +def main(): + html = get_html('http://www.myip.cn/') + document = analyze(html) + fonts = document.find_all('font') + my_ip = 'not found' + telecom = 'not found' + for font in fonts: + innerText = font.get_text().strip() + if innerText.find(u'您的IP') >= 0: + my_ip = innerText[innerText.find(':') + 1:].strip() + elif innerText.find(u'来自') >= 0: + telecom = innerText[innerText.find(':') + 1:innerText.find('.')].strip() + + print(u'IP: {ip} \n运营商: {telecom}'.format(ip=my_ip, telecom=telecom)) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/02/crawler/Python/main_re.py b/02/crawler/Python/main_re.py new file mode 100644 index 0000000..b3ebc06 --- /dev/null +++ b/02/crawler/Python/main_re.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import requests +import re + +def get_html(url, encoding='utf-8'): + rsp = requests.get(url) + return rsp.content.decode(encoding) + +def main(): + html = get_html('http://www.myip.cn/') + ip_match = re.search(ur'您的IP地址:\s*(?P(\d{1,3}\.){3}\d{1,3})', html) + telecom_match = re.search(ur'来自:\s*(?P[^.]*?)\.', html) + + if ip_match: + my_ip = ip_match.group('IP') + else: + my_ip = 'not found' + + if telecom_match: + telecom = telecom_match.group('telecom') + else: + telecom = 'not found' + + print(u'IP: {ip} \n运营商: {telecom}'.format(ip=my_ip, telecom=telecom)) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/02/crawler/Python/requirements.txt b/02/crawler/Python/requirements.txt new file mode 100644 index 0000000..63e9915 --- /dev/null +++ b/02/crawler/Python/requirements.txt @@ -0,0 +1,4 @@ +beautifulsoup4==4.6.0 +bs4==0.0.1 +lxml==4.2.1 +requests==2.18.4 \ No newline at end of file diff --git a/02/crawler/node/app.js b/02/crawler/node/app.js new file mode 100644 index 0000000..221067d --- /dev/null +++ b/02/crawler/node/app.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +const request = require('request'); +const { JSDOM } = require('jsdom'); + +function ip(callback) { + request('http://www.myip.cn/', (err, rsp, body) => { + if (err) throw (err) + const window = new JSDOM(rsp.body).window; + const document = window.document; + // 获取所有的 font 标签 + let fonts = document.getElementsByTagName('font'); + // 过滤出包含IP的标签 + let ipElem = Array.from(fonts).filter(f => f.textContent.indexOf('您的IP') >= 0)[0] || { textContent: '' }; + // 过滤出包含电信运营商的标签 + let telecomElem = Array.from(fonts).filter(f => f.textContent.indexOf('来自') >= 0)[0] || { textContent: '' }; + + // 取出标签文本 + let ip = ipElem.textContent.trim(); + let telecom = telecomElem.textContent.trim(); + + // 根据文本特征提取关键内容 + ip = ip.slice(ip.indexOf(':') + 1).trim(); + telecom = telecom.slice(telecom.indexOf(':') + 1, telecom.indexOf('.')).trim(); + + if (callback) callback({ + ip: ip, + telecom: telecom + }) + }) +} + +module.exports = ip; + +if (require.main === module) { + ip(info => console.log('IP:', info.ip, '运营商:', info.telecom)); +} \ No newline at end of file diff --git a/02/crawler/node/package.json b/02/crawler/node/package.json new file mode 100644 index 0000000..f08c429 --- /dev/null +++ b/02/crawler/node/package.json @@ -0,0 +1,15 @@ +{ + "name": "crawler", + "version": "1.0.0", + "description": "", + "main": "app.js", + "scripts": { + "start": "node ./app.js" + }, + "author": "", + "license": "ISC", + "dependencies": { + "jsdom": "^11.7.0", + "request": "^2.85.0" + } +} diff --git a/02/frontend/css/style.css b/02/frontend/css/style.css new file mode 100644 index 0000000..ef448df --- /dev/null +++ b/02/frontend/css/style.css @@ -0,0 +1,93 @@ +html { + min-height: 100%; + position: relative; +} +body { + max-width: 300px; + margin: auto; + font: 300 1em/1.8 PingFang SC,Lantinghei SC,Microsoft Yahei,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans; + padding: 0 1em; +} + +.logo { + text-align: center; +} + +.logo img{ + width: 100%; + max-width: 300px; /*最大宽度不能大于图片宽度*/ +} + +:focus { + outline: none; +} + +.content .title{ + text-align: center; + font-size: 300%; + font-weight: 100; +} + +.input-text { + border: none; + width: 100%; + text-align: center; + font-size: 1.5em; + border-bottom: 1px dashed #000; + padding: .2em 0; +} + +.submit-btn { + -webkit-appearance: none; /* 取出ios系统按钮默认带有的渐变样式 */ + background-color: #AD190E; + color: #FFF; + border: 0; + width: 100%; + font-size: 1.5em; + padding: .5em; + border-radius: 1.25em; +} + +.submit-btn:hover { + cursor: pointer; +} + +.submit-btn:active { /*实现按下时按钮收缩效果*/ + padding: .45em; + margin: .05em; +} + +.submit-btn[disabled] { + background-color: #727272; +} + +.error-msg { + display: block; + height: 1.5em; + color: #AD190E; + text-align: center; + font-weight: 500; +} + +.tip { + text-align: center; +} + +.tip a { + color: #CCC; + text-decoration: none; +} + +footer { + text-align: center; + color: #CCC; + height: 4em; +} + +footer p { + font-size: 80%; + position: absolute; + bottom: 0; + width: 100%; + left: 0; +} \ No newline at end of file diff --git a/02/frontend/img/logo.png b/02/frontend/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..027bb52b741ab8b988d0100fa037970cdec03bce GIT binary patch literal 11455 zcmbVyWmH_vvM3A=10e(_xVyUrnZbj*4KRZ{gS)%CySrO(2o51Y&;$q;+yaC^!s9#l zocrF7yY7#-SFPREz010~y7%htidK6shmA>!iGYBBtspO}fq;O>_JWI|qrSX{);hnx z6eMtv9$eGO67Ff{3PX^BI+??$6d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y;RCrdIMOvhK@bvmk&Um8_qN5r*O1@oiu;V{mW4D-mnxU8;9kml^5kIyY*!Mo|z=`n1e7``->OE|Y;T$0yt@Z-SRTU2;7b=1&Fj z(^iuS%py}pys^@+)UfAr2g6vg4E#^sVnOAPOvf`UtUQRToc4RWXLq`T+89Cl3 z_L*FGCaYxMJRrDs&scpTqX0Fnmn|NBOQfMKb>@biupmQbUlQ~ts%cX^->UqI0+V>6 z#v8cdF1Jx;D_6854m=x9yO!rWX? z7um1hk(JxFs7(aJj+zv!pWc;g^u@9rv1`#rGDV1kj+o6{IlTJt%uP8*z%ku*H lAPG&Be=ygYiDx1RLaX8-uJt(i_CG1b3ZVD04bqU1{{s%MG~ECI literal 0 HcmV?d00001 diff --git a/02/frontend/index.html b/02/frontend/index.html new file mode 100644 index 0000000..8cc518a --- /dev/null +++ b/02/frontend/index.html @@ -0,0 +1,30 @@ + + + + + + + 报名查询 + + + +

+

+
+
+

报名查询

+
+

+ + +

+

+
+

没查到报名?点击这里前往报名→

+
+
+

Copyright © 2018
All Rights Reserved Powered By ISA.

+
+ + + \ No newline at end of file diff --git a/02/frontend/js/do.js b/02/frontend/js/do.js new file mode 100644 index 0000000..8557647 --- /dev/null +++ b/02/frontend/js/do.js @@ -0,0 +1,20 @@ +function verify_phone() { + var value = document.getElementById('phone').value; + var error = ''; + var error_msg = document.getElementById('phone_error'); + if (value.length != 11 || isNaN(value)) { + error = '请输入有效的手机号'; + } + error_msg.innerHTML = error; + document.getElementById('search').disabled = !!error; + return !error; +} + +document.getElementById('phone').addEventListener('input', function (ev) { + verify_phone(); +}); + +document.getElementById('search').addEventListener('click', function (ev) { + if (!verify_phone()) + ev.stopPropagation(); +}); \ No newline at end of file diff --git a/02/readme.md b/02/readme.md index 4952690..dfd9934 100644 --- a/02/readme.md +++ b/02/readme.md @@ -1,6 +1,6 @@ # 第二期项目 -[后端] 4/11 保存猜数字成绩 +## [后端] 4/11 保存猜数字成绩 修改上一个程序,添加如下功能: 1. 当用户猜到数字之后,提示其输入一个昵称作为游戏名称,然后保存成绩,包含昵称,开始时间,耗时,所猜数字,猜测次数; @@ -8,11 +8,11 @@ 3. 然后提示选择 1. 玩猜数字;2. 查看历史成绩;3. 更改设置昵称; 4. 实现2,3功能。 -[爬虫] 3/29 获取IP与IP相关信息 +## [[爬虫] 3/29 获取IP与IP相关信息](./crawler) 爬取 www.myip.cn 得到本机的外网IP,IP 地域,运营商。 -[前端] 3/29 表单验证 +## [[前端] 3/29 表单验证](./frontend) 修改上一个网页,添加如下功能: 当用户输入的电话号码非数字与长度不等于11位时,提示无效的手机号,同时禁用按钮,当输入符合要求时,则按钮恢复可用。 \ No newline at end of file diff --git a/03/readme.md b/03/readme.md new file mode 100644 index 0000000..9b6da46 --- /dev/null +++ b/03/readme.md @@ -0,0 +1,8 @@ +# 第三期项目 + +## [爬虫] 4/11 获取域名相关信息 +通过 http://tool.chinaz.com/ Whois查询,得到用户输入的域名的注册信息。 + +## [前端] 4/11 Ajax请求 +修改上一个网页,添加如下功能: +当用户点击『查询』时,通过对 API 接口:http://teach.sxisa.com/api/signup/phone/手机号 发起ajax请求,获取报名者的录取情况,按照返回值的 result 信息判断,1 为已录取,0 为没有录取。 \ No newline at end of file diff --git a/readme.md b/readme.md index 0ef0a82..1ff473e 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,5 @@ # 创软俱乐部项目训练 -[第一期项目](./01) -[第二期项目](./02) +[第一期项目](./01) +[第二期项目](./02) +[第三期项目](./03) \ No newline at end of file