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
470
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webスクレイピングをしよう
SIGMA1425
January 18, 2020
Transcript
24 slides
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などに流すと喜ばれ る ¡ スクレイピングは素晴らしい!
ありがとうございました!
Other Decks in Programming
See All in Programming
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
200
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
220
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
410
ruby/uri meets WHATWG
jinroq
0
120
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
450
Debian JP Projectのサーバー構成
uwabami
1
180
LLM 101
dalinaum
0
540
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
AIエージェントの「テストは通るのに本番で壊れる」を減らす
shibuiwilliam
3
120
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
900
AppFunctionsの内部実装を紐解く
hiroaki404
1
120
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
GitHub's CSS Performance
jonrohan
1033
470k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Rails Girls Zürich Keynote
gr2m
96
14k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
640
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Designing Powerful Visuals for Engaging Learning
tmiket
1
660
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450