Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Webスクレイピングをしよう
Search
SIGMA1425
January 18, 2020
Programming
460
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webスクレイピングをしよう
SIGMA1425
January 18, 2020
Other Decks in Programming
See All in Programming
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
410
AWSに止められる覚悟してますか?
morizo_1984
2
500
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.3k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
330
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
3.9k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
6
1.7k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
160
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
150
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
700
Facilitating Awesome Meetings
lara
57
7.2k
We Are The Robots
honzajavorek
0
380
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Designing for Performance
lara
611
70k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
460
Making Projects Easy
brettharned
120
6.8k
Mind Mapping
helmedeiros
1
390
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
390
Docker and Python
trallard
47
4.2k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Transcript
Webスクレイピングをしよう 授業変更情報BOTの作成
自己紹介 ¡ SIGMA(@SIGMA_tkn) ¡ 苫小牧高専 情報系3年 ¡ ロボットテクノロジー部(いわゆるロボコン部) ¡ Pythonで画像解析
¡ 1年生にC言語の講習 ¡ 初めてのLT(がんばります)
初めてなので…
¡Webスクレイピングとは?
Webスクレイピングを一言で ¡ サイトから情報を抜き出す処理
スクレイピングの実用例 ¡ 天気予報のサイトからその日の天気を取り出す ¡ JRのサイトから運行情報を取り出す ¡ ニュースサイトからニュースを取り出す ¡ etc…
注意点 ¡ サイトによってはスクレイピングを禁止しているの もある ¡ 代表的なものとしてはTwitter
None
スクレイピングを利用して… ¡ 苫小牧高専のHPから授業変更を抜き出してみた
きっかけ ¡ ある日、たまたま授業変更を見忘れた
きっかけ 僕「まぁどうせ授業変更なんてないでしょ〜(フラグ)」
フラグ回収
None
使うライブラリ(Pythonを用いる) ¡ Requests →Webサイトの情報を取得する ¡ BeautifulSoup →Webサイトを解析する
None
基本的には… ¡ requests.getにURLを渡し、BeautifulSoupでパース処理 ¡ あとはテキスト属性のみ取り出して必要な情報のみ抜き 出したり、整形するなど
None
苫小牧高専HPの授業変更情報(自分のクラス)の データを取得する ↓ パースする ↓ <td>タグのみ抜き出す ↓ 「科目名」というキーワードがあれば授業変更を探索、 テキスト属性のみ抜き出す ↓
出力
実行結果
ラズパイのcrontabを用いて毎日、定時に実行 授業変更は毎日見たいので…
さらにクラスの人たちにも共有するために… 実行結果をクラスのSlackに出力
None
まとめ ¡ スクレイピングは簡単にできる ¡ 毎日、サイトを訪れる手間が省ける ¡ 他の人たちも見るような情報はSlackなどに流すと喜ばれ る ¡ スクレイピングは素晴らしい!
ありがとうございました!