iT邦幫忙

2021 iThome 鐵人賽

DAY 7
1
AI & Data

網路爬蟲,萬物皆爬 - 30 天搞懂並實戰網路爬蟲及應對反爬蟲技術系列 第 7

【Day 07】- 第一隻網路爬蟲要用什麼函式庫? (Requests)

  • 分享至 

  • xImage
  •  

前情提要

前一篇文章帶大家看了chrome 開發工具的使用,並向下又說明了 Element 、Network 等使用,未來幾天撰寫爬蟲時會經常使用開發工具來定位、分析請求。

開始之前

大家開啟網頁後,各位的瀏覽器(客戶端 Client)便會向網頁(伺服端 Server)進行 HTTP Request method,最常見為 GET、POST (HTTP request method),之後網頁(伺服端 Server)會回傳一個 HTTP Response, 瀏覽器(客戶端 Client)會將其渲染,變成可讀性較高的內容。

今天要帶各位寫的爬蟲便是代替人類進行上述操作。大家放心,Python 的 requests 庫包裝了各種用法,讓大家能夠非常方便的使用它。

Requests

Python 中的 Requests 庫被譽為沒有預設包含在 Python 內的最流行的 Python 庫。Requests 是個 HTTP client 函式庫,且使用十分便利、優雅。

由於我們的環境都是在 pipenv 下的,這邊給出它在 pipenv 下的安裝方法,注意要在想要的專案幕錄下進行 pipenv 安裝,記得加 s。


pipenv install requests

接下來將 pipenv --venv 回傳的路徑加到 Vscode settings "python.venvPath": "{這邊放 pipenv --venv 所得的值(上面請大家記住的)}" 。之後不會特別提醒,若有還沒看過環境設定的讀者,可以回去看【Day 02】- 網路爬蟲環境設定(Python、pipenv、Vscode)

HTTP 常用的 Request Method 是 GET 、 POST,下面針對兩個介紹。

Requests GET

安裝好 Requests 並確保進入虛擬環境後,我們先來做個簡單的 GET 請求。

import requests
url = 'https://www.google.com' #先將欲發出 GET 請求的網址先存在 url
res = requests.get(url) #對 url 發出 GET 請求,並將 Response 包成回傳物件存在 res
print(type(res), res) #Output: <class 'requests.models.Response'> <Response [200]>

讀者應該有發現 res 是個 requests.models.Response 的物件,且直接印出會是 <Response [200]> 這邊解釋一下 200 是什麼,簡單來說就是 HTTP 的狀態碼,下面解釋一些常見狀態碼,想了解更多能到這 https://zh.wikipedia.org/zh-tw/HTTP状态码

  • 200 OK:一切正常。
  • 301 Moved Permanently:永久搬家,會重新導向到新 url。
  • 302 Found(Moved Temporarily):暫時移到新位置。
  • 400 Bad Request:明顯的用戶端錯誤,伺服器無法處理這個 Request。
  • 401 Unauthorized:未授權,請求需攜帶憑證。
  • 403 Forbidden:沒有權限。
  • 404 Not Found:找不到資源。
  • 418 I’m a teapot:我是一個茶壺,不會泡咖啡。(愚人節彩蛋)
  • 500 Internal Server Error:伺服器端錯誤。
  • 502 Bad Gateway:通常是伺服器的某個服務沒有正確執行。
  • 503 Service Unavailable:伺服器臨時維護或是快掛了,暫時無法處理請求(臨時流量過大)。
  • 504 Gateway Timeout:伺服器上的服務沒有回應。

GET 是十分直觀的請求,不過有時候會攜帶參數。GET 請求攜帶參數會直接放在網址(url),位於 ? 後,若有多個則以 & 分隔。

https://www.google.com/search?q=IThome&oq=IThome為例,有兩個參數以 &分隔,第一個參數,參數名稱為 q ,參數值為 IThome ,第二個參數,參數名稱為 oq ,參數值為 IThome

Requests 提供了兩種 GET 參數傳入的方法。

import requests
# 方法一
url1 = '[https://www.google.com/search?q=IThome&oq=IThome](https://www.google.com/search?q=IThome&oq=IThome)' #直接將參數放到 url
res = requests.get(url1)
print(res.url, res) #Output: https://www.google.com/search?q=IThome&oq=IThome <Response [200]>
# 方法二
url2 = '[https://www.google.com/search](https://www.google.com/search?q=IThome&oq=IThome)'
params = {'q':'IThome','oq':'IThome'}
requests.get(url2, params=params) #Output: https://www.google.com/search?q=IThome&oq=IThome <Response [200]>

Requests POST

POST 常使用的例子是在填表單的時候,讀者們填好各種資料後按下送出按鈕,有些網頁的設計會送出一個 POST 請求,並夾帶著各位填入的資料(與 GET 不同,參數會放在 message body 而不是顯而易見的網址)。

▲ 登入 IThome 的過程中,用 chrome 開發工具分析登入的 POST 請求,發現其有夾帶輸入的帳號密碼

Python Requests 中 POST 請求可以使用許多不同種類的參數夾帶方法,像字典、元組、串列、JSON,這邊較推薦使用 JSON 與 字典進行傳入。

關於 JSON 它不是個 python 原生的資料型態,需要額外引入,之後會有一篇來單獨介紹它,目前只要知道它是個好用的結構就好(類似 Python 中的字典(dict))。

import requests
import json #JSON 非 python 原生型態但為內建,因此直接引入即可

# 使用字典傳入 POST 參數
data = {'account':'testOwO', 'password':'testOwO'}
url = 'https://zh.wikipedia.org/'
print(requests.post(url, data=data)) #Output: <Response [200]>

#使用 JSON 傳入 POST 參數
data = json.dumps(data)
url = 'https://zh.wikipedia.org/'
print(requests.post(url, data=data)) #Output: <Response [200]>

回應物件使用方法

不管使用 Requests 中 GET 或者是 POST ,都會回傳一個回應物件 requests.models.Response ,這個物件也有許多使用方法。

  • res.status_code : 該 HTTP 狀態碼

  • res.raw : 原始回應物件 urllib3.response.HTTPResponseres.raw.read() 讀取。

  • res.content : 回應物件的位元組序列(bytes)型態。

  • res.text : 回應物件的字串(str)型態。

  • res.headers : 回應物件的 headers。

  • res.json() : 回應物件的 JSON 格式,會將回應物件的字串用 JSON encode,不必引入 JSON。

  • res.raise_for_status() : 若請求失敗(Status Code 非 200),則拋出錯誤。

  • res.url : 請求的 url。

  • res.cookies : 請求後的 cookies。

  • res.encoding : 編碼格式。

更多參數

Requests 庫將許多 requests 請求的參數夾帶用法包入了,像是 Requests Headers、Proxy IP 使用、憑證驗證、Timeout、Cookies 傳入...等等都可以直接當成參數傳進像 requests.get [requests.post](http://requests.post) 等函數。

下面解釋上述用法例子。

  • Requests Headers

用 Requests 庫傳入 Requests Headers。

有些網頁會擋 User-Agent,若沒出現它允許的 User-Agent 就會拒絕存取,繞過方法十分簡單,複製 手動存取成功的 User-Agent,之後加到爬蟲的 Requests Headers 中即可。

import requests
url = 'https://snake-game-backend.herokuapp.com/Alldatas'
User_Agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'
headers = {
	'User-Agent' : User_Agent
}
print(requests.get(url, headers=headers).status_code) #Output: 200
  • Proxy IP 使用

Requests 庫可傳入 proxy IP 做網路代理服務,讀者可以去網路上的免費 proxy list,像是 https://geonode.com/free-proxy-list

import requests
url = 'https://snake-game-backend.herokuapp.com/Alldatas'
proxies = {'http' : 'http://62.33.207.202:80','https' : 'https://101.255.120.222:8080'}
print(requests.get(url, proxies=proxies).status_code) #Output: 200

  • 憑證驗證

如欲爬取的網站憑證失效等因素導致 https 失效(not secure),這時用 requests 會因為安全性無法爬取。Requests 可以將憑證驗證關閉,讓 Requests 成功爬取。

▲憑證失效時的確定頁面

import requests
r = requests.get('https://www.google.com', verify = False)
print(r.status_code()) #Output: 200
  • Timeout

Request 傳出後,到有回傳傳入如果超過給定 timeout 時間,會拋出一個例外。

import requests
r = requests.get('https://www.google.com', timeout=0.00000001) #**requests.exceptions.ConnectTimeout...**
  • Cookies 傳入

有些網頁用戶 session 會放在 Cookies,因此只要取得 Cookies ,並跟著 Request 一起送出就可以有用戶的 session 了。換句話說就是不需登入,可直接爬取登入後的資訊。

想要查看目前網頁下的 Cookies 可以透過開發工具的 Memory 頁簽找到。這邊有個更推薦的擴充套件可以查看/編輯,EditThisCookie

▲用 EditThisCookie 查看/編輯 Cookies

import requests
url = 'https://www.google.com'
cookies = {
	'account' : 'testOwO',
	'password' : 'testOwO'
}
print(requests.get(url, cookies=cookies).status_code) #Output: 200

Your First Crawler

讀者可以寫下下面的程式,輸出 google IThome 結果,但目前這種程度的爬蟲還沒進行任何的資料清理或鎖定,可讀性差(dom、HTML)

import requests
url1 = '[https://www.google.com/search?q=IThome&oq=IThome](https://www.google.com/search?q=IThome&oq=IThome)'
res = requests.get(url1)
print(res.text)

'''
<!doctype html><html lang="zh-TW"><head><meta charset="UTF-8"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>IThome - Google 搜尋</title><script nonce="2AVBOLh9+oVr1ju3HhSJZQ==">(function(){
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"===c||"q"===c&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&&a!==document.documentElement;a=a.parentElement)if("A"===a.tagName){a="1"===a.getAttribute("data-nohref");break a}a=!1}a&&b.preventDefault()},!0);}).call(this);(function(){
var a=window.performance;window.start=Date.now();a:{var b=window;if(a){var c=a.timing;if(c){var d=c.navigationStart,f=c.responseStart;if(f>d&&f<=window.start){window.start=f;b.wsrt=f-d;break a}}a.now&&(b.wsrt=Math.floor(a.now()))}}window.google=window.google||{};var h=function(g){g&&g.target.setAttribute("data-iml",Date.now())};document.documentElement.addEventListener("load",h,!0);google.rglh=function(){document.documentElement.removeEventListener("load",h,!0)};}).call(this);(function(){window.google.erd={sp:'srp',jsr:0,bv:166};})();(function(){
var c=[],e=0;window.ping=function(b){-1==b.indexOf("&zx")&&(b+="&zx="+Date.now());var a=new Image,d=e++;c[d]=a;a.onerror=a.onload=a.onabort=function(){delete c[d]};a.src=b};}).call(this);</script><style>body{margin:0 auto;max-width:736px;padding:0 8px;}a{color:#1967D2;text-decoration:none;tap-highlight-color:rgba(0,0,0,.10)}a:visited{color:#4B11A8}a:hover{text-decoration:underline}img{border:0}html{font-family:Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:20px;text-size-adjust:100%;color:#3c4043;word-wrap:break-word;background-color:#fff}.bRsWnc{background-color:#fff;border-top:1px solid #dadce0;height:39px;overflow:hidden}.N6RWV{height:51px;overflow-scrolling:touch;overflow-x:auto;overflow-y:hidden}.Uv67qb{box-pack:justify;font-size:12px;line-height:37px;justify-content:space-between;justify-content:space-between}.Uv67qb a,.Uv67qb span{color:#70757a;display:block;flex:none;padding:0 16px;text-align:center;text-transform:uppercase;}span.OXXup{border-bottom:2px solid #4285f4;color:#4285f4;font-weight:bold}a.eZt8xd:visited{color:#70757a}.FElbsf{border-left:1px solid rgba(0,0,0,.12)}header article{overflow:visible}.Pg70bf{height:39px;display:box;display:flex;display:flex;width:100%}.H0PQec{position:relative;flex:1}.sbc{display:flex;width:100%}.Pg70bf input{margin:2px 4px 2px 8px;}.x{width:26px;color:#70757a;font:27px/38px arial, sans-serif;line-height:40px;}#qdClwb{flex:0 0 auto;width:39px;height:39px;border-bottom:0;padding:0;border-top-right-radius:8px;background-color:#1a73e8;border:1px solid #1558d6;background-image:url(data:image/gif;base64,R0lGODdhJAAjAPIHAODr/nCk+MPZ/FmV96zK+/7+/5K5+kqL9iwAAAAAJAAjAEADani63P4wykmbKcQRXDscQAEMXmmeaLQVLCukzyC09AjfeK7v/MAajACLhPMVAgwjsUcEiZa8xgAYrVqv2Kx2iwsIAAABknfBBAKrTE4IcMyot8ur8datqIbQfJdnAfo2WE6BV05wXIiJigkAOw==);}.sc{font-size:16px;position:absolute;top:39px;left:0;right:0;box-shadow:0px 2px 5px rgba(0,0,0,.2);z-index:2;background-color:#fff}.sc>div{padding:10px 10px;padding-left:16px;padding-left:14px;border-top:1px solid #dfe1e5}.scs{background-color:#f8f9fa;}.noHIxc{display:block;font-size:16px;padding:0 0 0 8px;flex:1;height:35px;outline:none;border:none;width:100%;-webkit-tap-highlight-color:rgba(0,0,0,.00);overflow:hidden;}.sbc input[type=text]{background:none}.sml .cOl4Id{display:none}.l{display:none}.sml header{background:none}.sml .l{display:block;padding:0 8px}.sml .l{letter-spacing:-1px;text-align:center;border-radius:2px 0 0 0;font:22px/36px Futura, Arial, sans-serif;font-smoothing:antialiased}.bz1lBb{background:#fff;border-radius:8px 8px 0 0;box-shadow:0 1px 6px rgba(32, 33, 36, 0.18);margin-top:10px}.KP7LCb{border-radius:0 0 8px 8px;box-shadow:0 2px 3px rgba(32, 33, 36, 0.18);margin-bottom:10px;overflow:hidden}.cOl4Id{letter-spacing:-1px;text-align:center;font:22pt Futura, Arial, sans-serif;height:37px;font-smoothing:antialiased;padding:10px 0 5px 0;}.cOl4Id span{display:inline-block}.S591j{height:100%}.V6gwVd{color:#4285f4}.iWkuvd{color:#ea4335}.cDrQ7{color:#fcc934}.ntlR9{color:#34a853}.tJ3Myc{-webkit-transform:rotate(-20deg);position:relative;left:-1px;display:inline-block}footer{text-align:center;margin-top:18px}footer a,footer a:visited,.smiUbb{color:#70757a}.xeDNfc{margin:0 13px}#EOlPnc{margin-top:36px}#EOlPnc>div{margin:20px}.Srfpq{color:#70757a}</style></head><body jsmodel="hspDDf"><header id="hdr"><script nonce="2AVBOLh9+oVr1ju3HhSJZQ==">(function(){
var k=this||self,l=function(){},m=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},n=function(a,b){function c(){}c.prototype=b.prototype;a.l=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.o=function(d,e,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[e].apply(d,g)}};var p=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if("string"===typeof a)return"string"!==typeof b||1!=b.length?-1:a.indexOf(b,0);for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};var q=function(a){return"string"==typeof a.className?a.className:a.getAttribute&&a.getAttribute("class")||""},r=function(a,b){"string"==typeof a.className?a.className=b:a.setAttribute&&a.setAttribute("class",b)},t=function(a,b){a.classList?b=a.classList.contains(b):(a=a.classList?a.classList:q(a).match(/\S+/g)||[],b=0<=p(a,b));return b},w=function(){var a=u,b=v;a.classList?a.classList.remove(b):t(a,b)&&r(a,Array.prototype.filter.call(a.classList?a.classList:q(a).match(/\S+/g)||[],function(c){return c!=
b}).join(" "))};var x;a:{var y=k.navigator;if(y){var z=y.userAgent;if(z){x=z;break a}}x=""};var A=function(a){A[" "](a);return a};A[" "]=l;var B=-1!=x.indexOf("Gecko")&&!(-1!=x.toLowerCase().indexOf("webkit")&&-1==x.indexOf("Edge"))&&!(-1!=x.indexOf("Trident")||-1!=x.indexOf("MSIE"))&&-1==x.indexOf("Edge");var C=function(a,b){this.type=a;this.target=b};C.prototype.g=function(){};var D=function(){if(!k.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{k.addEventListener("test",l,b),k.removeEventListener("test",l,b)}catch(c){}return a}();var F=function(a){C.call(this,a?a.type:"");this.relatedTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.keyCode=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.state=null;this.pointerId=0;this.pointerType="";this.h=null;if(a){var b=this.type=a.type,c=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;var d=a.relatedTarget;if(d){if(B){a:{try{A(d.nodeName);var e=!0;break a}catch(f){}e=
!1}e||(d=null)}}else"mouseover"==b?d=a.fromElement:"mouseout"==b&&(d=a.toElement);this.relatedTarget=d;c?(this.clientX=void 0!==c.clientX?c.clientX:c.pageX,this.clientY=void 0!==c.clientY?c.clientY:c.pageY,this.screenX=c.screenX||0,this.screenY=c.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType="string"===typeof a.pointerType?a.pointerType:E[a.pointerType]||"";this.state=a.state;this.h=a;a.defaultPrevented&&F.l.g.call(this)}};n(F,C);var E={2:"touch",3:"pen",4:"mouse"};F.prototype.g=function(){F.l.g.call(this);var a=this.h;a.preventDefault?a.preventDefault():a.returnValue=!1};var G="closure_listenable_"+(1E6*Math.random()|0);var H=0;var I=function(a,b,c,d,e){this.listener=a;this.g=null;this.src=b;this.type=c;this.capture=!!d;this.i=e;this.key=++H;this.h=this.j=!1},J=function(a){a.h=!0;a.listener=null;a.g=null;a.src=null;a.i=null};var K=function(a){this.src=a;this.g={};this.h=0};K.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.g[f];a||(a=this.g[f]=[],this.h++);var g;a:{for(g=0;g<a.length;++g){var h=a[g];if(!h.h&&h.listener==b&&h.capture==!!d&&h.i==e)break a}g=-1}-1<g?(b=a[g],c||(b.j=!1)):(b=new I(b,this.src,f,!!d,e),b.j=c,a.push(b));return b};var L="closure_lm_"+(1E6*Math.random()|0),M={},N=0,P=function(a,b,c,d,e){if(d&&d.once)return O(a,b,c,d,e);if(Array.isArray(b)){for(var f=0;f<b.length;f++)P(a,b[f],c,d,e);return null}c=Q(c);return a&&a[G]?a.g(b,c,m(d)?!!d.capture:!!d,e):R(a,b,c,!1,d,e)},R=function(a,b,c,d,e,f){if(!b)throw Error("a");var g=m(e)?!!e.capture:!!e,h=S(a);h||(a[L]=h=new K(a));c=h.add(b,c,d,g,f);if(c.g)return c;d=T();c.g=d;d.src=a;d.listener=c;if(a.addEventListener)D||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(U(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("b");N++;return c},T=function(){var a=V,b=function(c){return a.call(b.src,b.listener,c)};return b},O=function(a,b,c,d,e){if(Array.isArray(b)){for(var f=0;f<b.length;f++)O(a,b[f],c,d,e);return null}c=Q(c);return a&&a[G]?a.h(b,c,m(d)?!!d.capture:!!d,e):R(a,b,c,!0,d,e)},W=function(a){if("number"!==typeof a&&a&&!a.h){var b=a.src;if(b&&b[G])b.i(a);else{var c=a.type,d=a.g;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(U(c),d):b.addListener&&b.removeListener&&b.removeListener(d);N--;if(c=S(b)){d=a.type;if(d in c.g){var e=c.g[d],f=p(e,a),g;(g=0<=f)&&Array.prototype.splice.call(e,f,1);g&&(J(a),0==c.g[d].length&&(delete c.g[d],c.h--))}0==c.h&&(c.src=null,b[L]=null)}else J(a)}}},U=function(a){return a in M?M[a]:M[a]="on"+a},V=function(a,b){if(a.h)a=!0;else{b=new F(b,this);var c=a.listener,d=a.i||a.src;a.j&&W(a);a=c.call(d,b)}return a},S=function(a){a=a[L];return a instanceof K?a:null},X="__closure_events_fn_"+(1E9*Math.random()>>>0),Q=function(a){if("function"===typeof a)return a;a[X]||(a[X]=function(b){return a.handleEvent(b)});return a[X]};var v,u=document.documentElement,Y;function aa(){W(Y);Y=O(u,"mousedown",function(){w();Z()},{capture:!0})}function Z(){W(Y);Y=P(u,"keydown",function(a){if(9===a.keyCode){a=u;var b=v;if(a.classList)a.classList.add(b);else if(!t(a,b)){var c=q(a);r(a,c+(0<c.length?" "+b:b))}aa()}})};v="zAoYTe";Z();}).call(this);(function(){var c=500;(function(){
window.screen&&window.screen.width<=c&&window.screen.height<=c&&document.getElementById("hdr").classList.add("sml");}).call(this);})();</script><div class="cOl4Id"><a href="/?sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQOwgC"><span class="V6gwVd">G</span><span class="iWkuvd">o</span><span class="cDrQ7">o</span><span class="V6gwVd">g</span><span class="ntlR9">l</span><span class="iWkuvd tJ3Myc">e</span></a></div><div class="bz1lBb"><form class="Pg70bf" id="sf"><a class="l" href="/?output=search&ie=UTF-8&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQPAgE"><span class="V6gwVd">G</span><span class="iWkuvd">o</span><span class="cDrQ7">o</span><span class="V6gwVd">g</span><span class="ntlR9">l</span><span class="iWkuvd tJ3Myc">e</span></a><input name="ie" value="ISO-8859-1" type="hidden"><div class="H0PQec"><div class="sbc esbc"><input class="noHIxc" value="IThome" autocapitalize="none" autocomplete="off" name="q" spellcheck="false" type="text"><input name="oq" type="hidden"><input name="aqs" type="hidden"><div class="x">×</div><div class="sc"></div></div></div><button id="qdClwb" type="submit"></button></form></div><noscript><meta content="0;url=/search?q=IThome&ie=UTF-8&gbv=1&sei=oRRIYff-M4-0mAWH4p7gCA" http-equiv="refresh"><style>table,div,span,p{display:none}</style><div style="display:block">如果系統沒有在數秒鐘後將您重新導向,請按一下<a href="/search?q=IThome&ie=UTF-8&gbv=1&sei=oRRIYff-M4-0mAWH4p7gCA">這裡</a>。</div></noscript></header><div id="main"><div><div class="KP7LCb"> <div class="bRsWnc"> <div class="N6RWV"> <div class="Pg70bf Uv67qb"> <span class="OXXup">全部</span><a class="eZt8xd" href="/search?q=IThome&ie=UTF-8&source=lnms&tbm=nws&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUICCgB">新聞</a><a class="eZt8xd" href="/search?q=IThome&ie=UTF-8&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUICSgC">圖片</a><a class="eZt8xd" href="/search?q=IThome&ie=UTF-8&source=lnms&tbm=vid&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUICigD">影片</a>  <a href="https://maps.google.com/maps?q=IThome&um=1&ie=UTF-8&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUICygE">地圖</a>  <a href="/search?q=IThome&ie=UTF-8&source=lnms&tbm=shop&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUIDCgF">購物</a>  <a href="/search?q=IThome&ie=UTF-8&source=lnms&tbm=bks&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQ_AUIDSgG">書籍</a>  <div class="FElbsf"><a href="/advanced_search" style="white-space:nowrap" id="st-toggle" role="button">搜尋工具</a></div> </div> </div> </div> </div><div class="Pg70bf wEsjbd ZINbbc xpd O9g5cc uUPGi" style="display:none" id="st-card"><style>.wEsjbd{background-color:#fff;height:44px;white-space:nowrap}.coPU8c{height:60px;overflow-scrolling:touch;overflow-x:auto;overflow-y:hidden}.Xj2aue{height:44px;overflow:hidden}.RnNGze{margin:11px 16px}.wEsjbd div,.wEsjbd a,.wEsjbd li{outline-width:0;outline:none}</style><div class="Xj2aue"><div class="coPU8c"><div class="RnNGze"><style>.PA9J5{display:inline-block}.RXaOfd{display:inline-block;height:22px;position:relative;padding-top:0;padding-bottom:0;padding-right:16px;padding-left:0;line-height:22px;cursor:pointer;text-transform:uppercase;font-size:12px;color:#70757a}.sa1toc{display:none;position:absolute;background:#fff;border:1px solid #d6d6d6;box-shadow:0 2px 4px rgba(0,0,0,0.3);margin:0;white-space:nowrap;z-index:103;line-height:17px;padding-top:5px;padding-bottom:5px;padding-left:0}.PA9J5:hover .sa1toc{display:block}.mGSy8d a:active,.RXaOfd:active{color:#4285f4}</style><div class="PA9J5"><div class="RXaOfd" role="button" tabindex="0"><style>.TWMOUc{display:inline-block;padding-right:14px;white-space:nowrap}.vQYuGf{font-weight:bold}.OmTIzf{border-color:#909090 transparent;border-style:solid;border-width:4px 4px 0 4px;width:0;height:0;margin-left:-10px;top:50%;margin-top:-2px;position:absolute}.RXaOfd:active .OmTIzf{border-color:#4285f4 transparent}</style><div class="TWMOUc">不限語言</div><span class="OmTIzf"></span></div><ul class="sa1toc ozatM"><style>.ozatM{font-size:12px;text-transform:uppercase}.ozatM .yNFsl,.ozatM li{list-style-type:none;list-style-position:outside;list-style-image:none}.yNFsl.SkUj4c,.yNFsl a{color:rgba(0,0,0,0.54);text-decoration:none;padding:6px 44px 6px 14px;line-height:17px;display:block}.SkUj4c{background-image:url(//ssl.gstatic.com/ui/v1/menu/checkmark2.png);background-position:right center;background-repeat:no-repeat}.SkUj4c:active{background-color:#f8f9fa}</style><li class="yNFsl SkUj4c">不限語言</li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=lr:lang_1zh-CN%7Clang_1zh-TW&lr=lang_zh-CN%7Clang_zh-TW&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIDw">搜尋所有中文網頁</a></li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=lr:lang_1zh-TW&lr=lang_zh-TW&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIEA">搜尋繁體中文網頁</a></li></ul></div><div class="PA9J5"><div class="RXaOfd" role="button" tabindex="0"><div class="TWMOUc">不限時間</div><span class="OmTIzf"></span></div><ul class="sa1toc ozatM"><li class="yNFsl SkUj4c">不限時間</li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=qdr:h&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIEg"> 過去 1 小時</a></li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=qdr:d&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIEw"> 過去 24 小時</a></li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=qdr:w&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIFA"> 過去 1 週</a></li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=qdr:m&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIFQ"> 過去 1 個月</a></li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=qdr:y&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIFg"> 過去 1 年</a></li></ul></div><div class="PA9J5"><div class="RXaOfd" role="button" tabindex="0"><div class="TWMOUc">所有結果</div><span class="OmTIzf"></span></div><ul class="sa1toc ozatM"><li class="yNFsl SkUj4c">所有結果</li><li class="yNFsl"><a href="/search?q=IThome&ie=UTF-8&source=lnt&tbs=li:1&sa=X&ved=0ahUKEwi308rm4YzzAhUPGqYKHQexB4wQpwUIGA">一字不差</a></li></ul></div></div></div></div><script nonce="2AVBOLh9+oVr1ju3HhSJZQ==">(function(){
var a=document.getElementById("st-toggle"),b=document.getElementById("st-card");a&&b&&a.addEventListener("click",function(c){b.style.display=b.style.display?"":"none";c.preventDefault()},!1);}).call(this);</script></div></div><style>.ZINbbc{background-color:#fff;margin-bottom:10px;box-shadow:0 1px 6px rgba(32, 33, 36, 0.28);border-radius:8px}.uUPGi{font-size:14px;line-height:20px;}.O9g5cc>*:first-child{border-top-left-radius:8px;border-top-right-radius:8px}.O9g5cc>*:last-child{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.O9g5cc>.qxDOhb>*:first-child{border-top-left-radius:8px;border-top-right-radius:8px}.O9g5cc>.qxDOhb>*:last-child{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.rl7ilb{display:block;clear:both}.kCrYT{padding:12px 16px 12px}a.fdYsqf{color:#4B11A8}.zBAuLc{font-weight:normal;line-height:normal;margin:0;padding:0}.BNeawe{white-space:pre-line;word-wrap:break-word}.vvjwJb{color:#1967D2;font-size:16px;line-height:20px}a:visited .vvjwJb,.vvjwJb a:visited{color:#4B11A8}.vvjwJb.HrGdeb{color:#fff}a:visited .vvjwJb.HrGdeb,.vvjwJb.HrGdeb a:visited{color:rgba(255,255,255,.70)}.UPmit{font-size:14px;line-height:20px}.UPmit.HrGdeb{color:rgba(255,255,255,.70)}.UPmit.AP7Wnd{color:#0d652d}.x54gtf{height:1px;background-color:#dfe1e5;margin:0 16px}.Q0HXG{height:1px;background-color:#dfe1e5}.Ap5OSd{padding-bottom:12px}.s3v9rd{font-size:14px;line-height:20px}.s3v9rd.HrGdeb{color:#fff}.s3v9rd.AP7Wnd{color:#202124}.mSx1Ee{padding-left:48px;margin:0}.v9i61e{padding-bottom:8px}.XLloXe{color:#1967D2;font-size:14px;line-height:20px}a:visited .XLloXe,.XLloXe a:visited{color:#4B11A8}.XLloXe.HrGdeb{color:#fff}a:visited .XLloXe.HrGdeb,.XLloXe.HrGdeb a:visited{color:rgba(255,255,255,.70)}.deIvCb{font-size:16px;line-height:20px;font-weight:400}.deIvCb.HrGdeb{color:#fff}.deIvCb.AP7Wnd{color:#202124}.FCUp0c{font-weight:bold}.Xdlr0d{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:0 -8px;padding:2px 0 16px 24px;margin-top:-2px;transform:translate3d(0,0,0)}.idg8be{display:table;border-collapse:separate;border-spacing:8px 0;margin:0 -8px;padding-right:16px}.BVG0Nb{display:table-cell;vertical-align:top;background-color:#fff;border-radius:8px;box-shadow:0 1px 6px rgba(32, 33, 36, 0.28);overflow:hidden}.EYOsld{display:inline-block;position:relative}.BFi9Zb{overflow:hidden;position:relative}.S7Jdze{align-items:center;display:flex;flex-direction:column;justify-content:space-around}.R0jTRc{vertical-align:middle}.Xb5VRe{color:#1967D2}a:visited .Xb5VRe{color:#4B11A8}.Xb5VRe.tr0dw{color:#fff}a:visited .Xb5VRe.tr0dw{color:rgba(255,255,255,.70)}.tAd8D{font-size:14px;line-height:20px}.tAd8D.HrGdeb{color:rgba(255,255,255,.70)}.tAd8D.AP7Wnd{color:#70757a}.nGphre{float:right;padding-left:16px}.UykT9d{border-radius:8px;display:block}.nYT7Qb{clear:both}.skVgpb{display:table;table-layout:fixed;width:100%}.VGHMXd{display:table-cell;vertical-align:middle;height:52px;text-align:center}.LpaDrb{margin:0 auto 8px;display:block}.vbShOe{padding-top:0}.AVsepf{padding-bottom:8px}.AVsepf.u2x1Od{padding-bottom:0}.r0bn4c.tr0dw{color:rgba(255,255,255,.70)}.r0bn4c.rQMQod{color:#70757a}.tP9Zud{display:inline-block;}.QzarWc{color:#3c4043}.oqSTJd{color:#70757a}.Hk2yDb,.Hk2yDb span{background-repeat:repeat-x;background-size:14px,14px;height:14px;width:70px}.Hk2yDb{display:inline-block;font-size:0;line-height:0;position:relative;top:1px}.Hk2yDb span{display:block}.Hk2yDb.KsR1A{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAD1BMVEVMaXEAAAAAAAAAAAAAAACF6eB8AAAABXRSTlMAID8OM2w9R7oAAACdSURBVHgBvdGBCcIwEEbhq+kAaXEA+5oBYuoAmnb/mQT5gcMDCoB+AIEA9y7EfmrIFl1uFrXVol4sSFBjB3LsQCzNsMQOlNjhq5S26Qrwmjbdp6PjlKMq4SiXwNOAhrOadDeymoyAPP1zfEUGJJvTNdFOLxFzElLPQqNb0/8F+x39iDTYzR56ucws7pBePtnU/aKomrpbM5sM1f7pDdrTIIXMnb07AAAAAElFTkSuQmCC)}.Hk2yDb.KsR1A span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEVMaXH0tAD0tAD0tAD0tAD0tAD0tAD0tAB7hoq7AAAACHRSTlMAP6Ib/oXVZJ3/vYgAAADHSURBVHgBnNE1A4JgGARgmtHW0dxtZ+OA0dbRdrX/v+RLmkc/9H3MH2HjEcgVIrA1iMCZEoF7NWwycA6hBKxDmAZ6IawA/aDx0FMLoGjgKIAdA3d0WM89SkfYOZaWl5SOdwSiGe0EMW4/jkIP5vdeU2t2k14sUGugKJ6GKGdfG0aoE/+l509I7y/4azfiL7/l4IDIU4rmHwv0zZUH94AaZ421f4DO1ofVCFmgbGwbQNwzahtrJ4sRoUQvva8JuRo9vcA8RyMAAIXWR1O6HNlyAAAAAElFTkSuQmCC)}.e1wPee{text-decoration:underline}.ji5jpf{text-align:center}.uEec3{font-size:12px;line-height:16px}.uEec3.HrGdeb{color:rgba(255,255,255,.70)}.uEec3.AP7Wnd{color:#70757a}.mEUgP{font-weight:bold;font-size:16px;color:#000;margin:0;padding:12px 16px 12px}.iIWm4b{box-sizing:border-box;min-height:48px}.gGQDvd{padding:14px;position:relative}.Q71vJc{display:block;position:relative;width:100%}.kjGX2{position:absolute;left:48px;right:0;vertical-align:bottom;display:inline-block;color:#3c4043}.ieB2Dd{width:40px;height:40px;overflow:hidden;margin-top:-10px;margin-bottom:-16px;margin-right:8px;border-radius:4px;display:inline-block;border-radius:50%;}.LsF2v span{color:#fff;mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAABa0lEQVR4AeyWtUIYQRBAX6yLu0uH08Q9ZfInNHF36UKFlHwHNLi7u2uNN9hgg3PsCVtx753fzOkalgkJieErOXQwsWAHOXwjZjcvXohsYy7xBOYgycwhDs6RzEECcJZyxGA5Z/HJIUoQVAp4z22OL3ibdxs+WgmH8EUqorZzl83cpR1RU/FBDKI2cMrhAzYgaiyeydDUQc7hxDkGNSoDj1xH1CfsxDNEvYEnXmtaNiayNPK1vw+UgIkEfx+pRdOiMRGlkS14YlLTjmHimEZO4IlxTTuCiSMaOYkn2jQtChORGtlr+ycX4YlXrotptkb+wxM3XFa0J4j60E5TMaRRNXgmHlEbOevQ2DUi6gt8kGJorjsQNW23OpxbnOQEt3lPMYLKNJdsdpkjuv5lo9MX/nMBUT/jk3iHYUs9zwGQ4LeAaHTgxTgtpPOLpyj8Dn4LE4l79RbhLV7bvsVnsHmLz1gk0e7lQ0LmRzMAAAU5VLMEuZJZAAAAAElFTkSuQmCC)}.lRVwie{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rLshyf,.BmP5tf{padding-top:12px;padding-bottom:12px}.YOx3Ab{padding-left:16px;}.w1C3Le,.BmP5tf,.G5NbBd,.CS4w5b{padding-left:16px;padding-right:16px;}.G5NbBd{padding-bottom:12px}.CS4w5b{padding-top:12px}.nMymef{display:flex}.G5eFlf{flex:1;display:block}.nMymef span{text-align:center}</style><div><!--SW_C_X--></div><div></div><div><div class="ZINbbc xpd O9g5cc uUPGi"><div class="kCrYT"><a href="/url?q=https://www.ithome.com.tw/&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQFnoECAIQAQ&usg=AOvVaw3tWSoAsz2-VyIAQRbTxmgB"><h3 class="zBAuLc"><div class="BNeawe vvjwJb AP7Wnd">iThome</div></h3><div class="BNeawe UPmit AP7Wnd">www.ithome.com.tw</div></a></div><div class="x54gtf"></div><div class="kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><div><div><div class="Ap5OSd"><div class="BNeawe s3v9rd AP7Wnd">按讚加入iThome粉絲團追蹤 . 數據為王!AWS 如何協助企業推動業務革新 · 線上分享如何強化企業數位韌性和I T 即戰力 · 利用SD-WAN完美掌握疫情時代網路與安全 ...</div></div><div class="v9i61e"><div class="BNeawe s3v9rd AP7Wnd"><span class="BNeawe"><a href="/url?q=https://www.ithome.com.tw/news&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQjBB6BAgCEAQ&usg=AOvVaw2EUT_A_Dd9GQT66m5ecjOM"><span class="XLloXe AP7Wnd">新聞</span></a></span></div></div><div class="v9i61e"><div class="BNeawe s3v9rd AP7Wnd"><span class="BNeawe"><a href="/url?q=https://www.ithome.com.tw/security&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQjBB6BAgCEAY&usg=AOvVaw34cGzfU_zqKmbLBAWYavpp"><span class="XLloXe AP7Wnd">資安</span></a></span></div></div><div class="v9i61e"><div class="BNeawe s3v9rd AP7Wnd"><span class="BNeawe"><a href="/url?q=https://www.ithome.com.tw/latest&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQjBB6BAgCEAg&usg=AOvVaw3Rs9x5wrboshQVceWpI0Kj"><span class="XLloXe AP7Wnd">今日最新</span></a></span></div></div><div><div class="BNeawe s3v9rd AP7Wnd"><span class="BNeawe"><a href="/url?q=https://www.ithome.com.tw/seminar&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQjBB6BAgCEAo&usg=AOvVaw1CKJfCyrJ0foj_5X5oeGD0"><span class="XLloXe AP7Wnd">研討會</span></a></span></div></div></div></div></div></div></div></div></div><div><div class="ZINbbc xpd O9g5cc uUPGi"><div class="kCrYT"><div class="BNeawe deIvCb AP7Wnd"><span class="FCUp0c rQMQod">來自 ithome.com.tw 的最新報導</span></div></div><div><div><div><div class="Xdlr0d"><div class="idg8be"><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/article/146788&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAD&usg=AOvVaw3WAnPCulX89D2fBqk9tFl-"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_1" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">誰偷了NSA的駭客祕笈?</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
5 小時前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/voice/146755&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAH&usg=AOvVaw3jU7wGKcf4rNCABeCO8I0a"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_3" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">維持零接觸體驗,背後需要更多互動</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
5 小時前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/news/146799&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAL&usg=AOvVaw1X3MHpfATY3O3M8Ow4gJa7"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_5" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">【疫情日報】9月21日至10月4日維持疫情警戒二級,有條件開放會展活動辦理</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
21 小時前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/news/146785&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAP&usg=AOvVaw0COBfhELsH73Fb_kApnHjn"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_7" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">Cloudflare發表可加速頁面載入的Early Hints功能,主流瀏覽器都承諾支援</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
2 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://ithome.com.tw/news/146786&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAT&usg=AOvVaw1VPJZrq9o_gyxY5142nPz-"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_9" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">聯合國警告:AI將對人權造成威脅,呼籲暫停銷售及使用AI系統</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
2 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/news/146711&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAX&usg=AOvVaw3DUx_2nu5ziLE2-9c3Cqph"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_11" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">IT人才月報第19期:微軟協作工具大更新,Teams不只能自動聚焦發言人還能辨識開會員工是誰</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
2 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/review/146769&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAb&usg=AOvVaw05MBWVi7WfSbMBbZ0hvP9O"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_13" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">整合5奈米製程Arm處理器核心,Marvell推出新一代DPU</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
2 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/news/146764&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAf&usg=AOvVaw1G3tbBFBrWpzs7q_NOlksc"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_15" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">微軟:Windows MSHTML漏洞已有勒索軟體開採</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
3 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://www.ithome.com.tw/news/146760&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAj&usg=AOvVaw1AQmprlX-0J_XtWdi_IHzV"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_19" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">微軟釋出新版非訂閱桌機版Office,Office 2021訂10月5日推出</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
3 天前</div></div></div></div></div></a><a class="BVG0Nb" href="/url?q=https://today.ithome.com.tw/news/146743&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlO8DegQIBBAn&usg=AOvVaw2__QrePEOCxuV9fS2MqzBa"><div><div style="width:232px"><div class="S7Jdze" style="width:232px;height:128px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:232px;max-height:128px" id="dimg_21" data-deferred="1"></div><div class="RWuggc kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><span class="rQMQod Xb5VRe">Microsoft帳號全面支援無密碼登入,甚至提供用戶能移除所設密碼</span></div></div><div><div class="BNeawe tAd8D AP7Wnd">iThome
3 天前</div></div></div></div></div></a></div></div></div></div></div></div></div><div><div class="ZINbbc xpd O9g5cc uUPGi"><div class="kCrYT"><div class="nGphre"><a href="/url?q=https://www.dxomark.cn/about-us/&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQwW56BAgIEAI&usg=AOvVaw3JOrkCTm8OHEYLHFXzq5Yz"><img class="UykT9d" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:72px;max-height:72px" id="dimg_17" data-deferred="1"></a></div><span><h3 class="zBAuLc"><div class="BNeawe deIvCb AP7Wnd">IT之家</div></h3></span><span><div class="BNeawe tAd8D AP7Wnd">網站</div></span><div class="nYT7Qb"></div></div><div class="Q0HXG"></div><div class="kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><div><div class="BNeawe s3v9rd AP7Wnd">IT之家是軟媒公司建立的網站,於2011年5月27日正式執行。後來軟媒將其所屬的Vista之家、Win7之家、Win8之家的內容將合併至IT之家中,並開發了Android,IOS,Windows Phone,Windows 10 UWP客戶端和微信小程式。 <span class="BNeawe"><a href="/url?q=https://zh.wikipedia.org/zh-tw/IT%25E4%25B9%258B%25E5%25AE%25B6&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQmhN6BAgIEAc&usg=AOvVaw3y37JvlcYoC2f3332zLx2a"><span class="XLloXe AP7Wnd">維基百科</span></a></span></div></div></div></div></div><div class="vbShOe kCrYT"><div class="AVsepf"><div class="BNeawe s3v9rd AP7Wnd"><span><span class="BNeawe s3v9rd AP7Wnd">上線日期</span></span>: <span><span class="BNeawe tAd8D AP7Wnd">2011 年 5 月 27 日</span></span></div></div><div class="AVsepf u2x1Od"><div class="BNeawe s3v9rd AP7Wnd"><span><span class="BNeawe s3v9rd AP7Wnd">網站類型</span></span>: <span><span class="BNeawe tAd8D AP7Wnd">網路媒體</span></span></div></div></div></div></div><div><div class="ZINbbc xpd O9g5cc uUPGi"><div class="kCrYT"><a href="/url?q=https://www.facebook.com/ithomeonline/&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQFnoECAcQAg&usg=AOvVaw0BpVrAzoUWo5PEncJPkrwU"><h3 class="zBAuLc"><div class="BNeawe vvjwJb AP7Wnd">iThome - Home | Facebook</div></h3><div class="BNeawe UPmit AP7Wnd">www.facebook.com › ... › Brand › Website › News & Media Website</div></a></div><div class="x54gtf"></div><div class="kCrYT"><div><div class="BNeawe s3v9rd AP7Wnd"><div><div><div class="BNeawe s3v9rd AP7Wnd">iThome Online 是臺灣第一個網路原生報,提供IT產業即時新聞、企業IT產品報導與測試、技術專題、IT應用報導、IT書訊,以及面向豐富的名家專欄。</div></div></div></div></div></div></div></div><div><div class="ZINbbc xpd O9g5cc uUPGi"><div class="kCrYT"><div class="nGphre"><img class="UykT9d" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:72px;max-height:72px" id="dimg_23" data-deferred="1"></div><span><h3 class="zBAuLc"><div class="BNeawe deIvCb AP7Wnd">電週文化事業股份有限公司</div></h3></span><span><div class="BNeawe tAd8D AP7Wnd"><span class="r0bn4c rQMQod tP9Zud"> <span class="Eq0J8 oqSTJd" aria-hidden="true">4.7</span> <div class="Hk2yDb KsR1A" aria-label="評等為 4.7,最高 5" role="img"><span style="width:63px"></span></div> <span class="Eq0J8">(7)</span> </span>
位於台北的媒體公司</div></span><div class="nYT7Qb"></div></div><div class="Q0HXG"></div><div class="kCrYT"><div class="skVgpb"><a class="VGHMXd" href="https://maps.google.com/maps?um=1&ie=UTF-8&fb=1&gl=tw&sa=X&geocode=KWM812BmqUI0MaccvMVQHekX&daddr=104%E5%8F%B0%E5%8C%97%E5%B8%82%E4%B8%AD%E5%B1%B1%E5%8D%80%E5%8D%97%E4%BA%AC%E6%9D%B1%E8%B7%AF%E4%BA%8C%E6%AE%B517%E8%99%9F%E9%9B%BB%E9%80%B1%E6%96%87%E5%8C%96%E4%BA%8B%E6%A5%AD%E8%82%A1%E4%BB%BD%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8+%E8%99%9F5%E6%A8%93&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQlDt6BAgJEAM"><div class="LpaDrb S7Jdze" style="width:24px;height:24px"><img class="EYOsld" alt="" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" style="max-width:24px;max-height:24px" id="dimg_25" data-deferred="1"></div><div class="BNeawe ji5jpf uEec3 AP7Wnd">規劃路線</div></a><a class="VGHMXd" href="/url?q=http://www.ithome.com.tw/&sa=U&ved=2ahUKEwi308rm4YzzAhUPGqYKHQexB4wQgU96BAgJEAQ&usg=AOvVaw2LK0JGwJOFjmOw_1TMJbc8"><div class="LpaDrb S7Jdze" style="width:24px;height:24px"><img class="EYOsld" alt=""...

結語

今天介紹了 requests 這個好用的套件, 最後讓大家寫了一隻爬蟲,但目前還沒進行清理或定位,讀者可以使用 【Day 05】- Python 字串操作(正規表達式 regexes 、原生基本操作) 來對資料作處理,或者等待明天或後天的資料處理分享。

明日內容

明天會與各位介紹 requests-HTML ,它是今天的 Requests 庫再進行進一步的封裝的產物,多了資料清洗的功能,敬請期待。

補充資料

Requests 庫官方文件 : https://docs.python-requests.org/en/latest/

[Python爬蟲教學]開發Python網頁爬蟲前需要知道的五個基本觀念 : https://www.learncodewithmike.com/2020/10/python-web-scraping.html


上一篇
【Day 06】- 聽說 F12 可以拿來駭入小恐龍? (網頁開發工具分析流量)
下一篇
【Day 08】- 有著資料清洗功能的 Requests-HTML
系列文
網路爬蟲,萬物皆爬 - 30 天搞懂並實戰網路爬蟲及應對反爬蟲技術30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言