SlideShare a Scribd company logo
1 of 14
Download to read offline
輕輕鬆鬆寫網路爬蟲
鍾傑倫
範例專案
• https://github.com/chungchiehlun/WebSpider
• site : express 與爬蟲程式寫成的網站服務
• spider : 爬蟲程式
攻略⽬目標
爬蟲三步驟
• 分析網⾴頁
• 開始寫爬蟲程式
• 解析爬到的內容
https://www.vanilla-air.com/reservation/ibe/ibe/booking
chrome developer tools
觀察瀏覽器(client)與 server 如何溝通
分析結論
• 需要拿到 cookie :
GET request 取得
• 需要送出完整版表單:
POST request 完整表單
認識 https.request
var https = require(‘https’)
Start Coding
解析資料
• 把爬到的資料存下來: fs
• 解析爬到的⽂文件: cheerio
快完成了
Finish !!
感謝您的聆聽
歡迎您⼀一起讓這專案變得更好

More Related Content

What's hot

Node js实践
Node js实践Node js实践
Node js实践jay li
 
Web scraping入門1
Web scraping入門1Web scraping入門1
Web scraping入門1兆欽 丘
 
Nosql七种武器之长生剑 mongodb的使用介绍
Nosql七种武器之长生剑 mongodb的使用介绍Nosql七种武器之长生剑 mongodb的使用介绍
Nosql七种武器之长生剑 mongodb的使用介绍yczealot
 
浮云脱水小说站的搭建
浮云脱水小说站的搭建浮云脱水小说站的搭建
浮云脱水小说站的搭建jondynet
 
Autorelease pool
Autorelease poolAutorelease pool
Autorelease poolMichael Pan
 
Communication with python_http_module
Communication with python_http_moduleCommunication with python_http_module
Communication with python_http_moduledreampuf
 
Python包管理工具介绍
Python包管理工具介绍Python包管理工具介绍
Python包管理工具介绍Young King
 
【Android终端安全分享】之android程序打包过程分析
【Android终端安全分享】之android程序打包过程分析【Android终端安全分享】之android程序打包过程分析
【Android终端安全分享】之android程序打包过程分析jicheng687
 
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例Will Huang
 
RxJS 6 新手入門
RxJS 6 新手入門RxJS 6 新手入門
RxJS 6 新手入門Will Huang
 
Elastic stack day-2
Elastic stack day-2Elastic stack day-2
Elastic stack day-2YI-CHING WU
 
Java_07:Thread
Java_07:ThreadJava_07:Thread
Java_07:ThreadBrad Chao
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIChu-Siang Lai
 
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2Yang FaFa
 
Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Chu-Siang Lai
 
课题二:Node.js那些事儿
课题二:Node.js那些事儿课题二:Node.js那些事儿
课题二:Node.js那些事儿Liu Allen
 
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)Will Huang
 
twMVC#43 C#10 新功能介紹
twMVC#43 C#10 新功能介紹twMVC#43 C#10 新功能介紹
twMVC#43 C#10 新功能介紹twMVC
 

What's hot (19)

Node js实践
Node js实践Node js实践
Node js实践
 
Web scraping入門1
Web scraping入門1Web scraping入門1
Web scraping入門1
 
Nosql七种武器之长生剑 mongodb的使用介绍
Nosql七种武器之长生剑 mongodb的使用介绍Nosql七种武器之长生剑 mongodb的使用介绍
Nosql七种武器之长生剑 mongodb的使用介绍
 
浮云脱水小说站的搭建
浮云脱水小说站的搭建浮云脱水小说站的搭建
浮云脱水小说站的搭建
 
Autorelease pool
Autorelease poolAutorelease pool
Autorelease pool
 
Communication with python_http_module
Communication with python_http_moduleCommunication with python_http_module
Communication with python_http_module
 
Python包管理工具介绍
Python包管理工具介绍Python包管理工具介绍
Python包管理工具介绍
 
【Android终端安全分享】之android程序打包过程分析
【Android终端安全分享】之android程序打包过程分析【Android终端安全分享】之android程序打包过程分析
【Android终端安全分享】之android程序打包过程分析
 
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
 
RxJS 6 新手入門
RxJS 6 新手入門RxJS 6 新手入門
RxJS 6 新手入門
 
Elastic stack day-2
Elastic stack day-2Elastic stack day-2
Elastic stack day-2
 
Java_07:Thread
Java_07:ThreadJava_07:Thread
Java_07:Thread
 
伪静态
伪静态伪静态
伪静态
 
Continuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CIContinuous Delivery with Ansible x GitLab CI
Continuous Delivery with Ansible x GitLab CI
 
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
[Talk] 2013 06-02-hadoop整合應用-crawlzilla@hadoop q2
 
Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)Automate with Ansible basic (2/e)
Automate with Ansible basic (2/e)
 
课题二:Node.js那些事儿
课题二:Node.js那些事儿课题二:Node.js那些事儿
课题二:Node.js那些事儿
 
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
 
twMVC#43 C#10 新功能介紹
twMVC#43 C#10 新功能介紹twMVC#43 C#10 新功能介紹
twMVC#43 C#10 新功能介紹
 

Viewers also liked

Node.js從無到有 基本課程
Node.js從無到有 基本課程Node.js從無到有 基本課程
Node.js從無到有 基本課程Simon Su
 
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例Shau-Hung Hsieh
 
Build a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaBuild a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaTheFamily
 
Android x 網路爬蟲
Android x 網路爬蟲Android x 網路爬蟲
Android x 網路爬蟲Engine Bai
 
Introduction to Guzzle
Introduction to GuzzleIntroduction to Guzzle
Introduction to GuzzleDQNEO
 
新手無痛入門Apk逆向
新手無痛入門Apk逆向新手無痛入門Apk逆向
新手無痛入門Apk逆向hackstuff
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binaryFred Chien
 
使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式Will Huang
 
Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Fred Chien
 
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介NodeJS基礎教學&簡介
NodeJS基礎教學&簡介GO LL
 
Node.js 進攻桌面開發
Node.js 進攻桌面開發Node.js 進攻桌面開發
Node.js 進攻桌面開發Fred Chien
 
用十分鐘瞭解 《人工智慧的那些問題與方法》
用十分鐘瞭解  《人工智慧的那些問題與方法》 用十分鐘瞭解  《人工智慧的那些問題與方法》
用十分鐘瞭解 《人工智慧的那些問題與方法》 鍾誠 陳鍾誠
 
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907NodejsFoundation
 

Viewers also liked (14)

Cyber Attack
Cyber AttackCyber Attack
Cyber Attack
 
Node.js從無到有 基本課程
Node.js從無到有 基本課程Node.js從無到有 基本課程
Node.js從無到有 基本課程
 
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例
Nik Collection產品的安裝與使用-以Adobe Photoshop CS6及Adobe Lightroom 4為例
 
Build a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS LambdaBuild a mobile app serverless with AWS Lambda
Build a mobile app serverless with AWS Lambda
 
Android x 網路爬蟲
Android x 網路爬蟲Android x 網路爬蟲
Android x 網路爬蟲
 
Introduction to Guzzle
Introduction to GuzzleIntroduction to Guzzle
Introduction to Guzzle
 
新手無痛入門Apk逆向
新手無痛入門Apk逆向新手無痛入門Apk逆向
新手無痛入門Apk逆向
 
我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary我編譯故我在:誰說 Node.js 程式不能編成 binary
我編譯故我在:誰說 Node.js 程式不能編成 binary
 
使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式
 
Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險
 
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介NodeJS基礎教學&簡介
NodeJS基礎教學&簡介
 
Node.js 進攻桌面開發
Node.js 進攻桌面開發Node.js 進攻桌面開發
Node.js 進攻桌面開發
 
用十分鐘瞭解 《人工智慧的那些問題與方法》
用十分鐘瞭解  《人工智慧的那些問題與方法》 用十分鐘瞭解  《人工智慧的那些問題與方法》
用十分鐘瞭解 《人工智慧的那些問題與方法》
 
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907