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
株式会社Curious Vehicle
February 07, 2025
46
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webスクレイピング
株式会社Curious Vehicle
February 07, 2025
More Decks by 株式会社Curious Vehicle
See All by 株式会社Curious Vehicle
AI Agent Harness 入門
curicle
0
6
クネビンフレームワークで考える最初の一歩
curicle
0
6
AIガバナンス
curicle
0
7
PQCが変える暗号の世界
curicle
0
49
最近流行ってるClaudeについて
curicle
0
17
ElasticsearchのHA構成について
curicle
0
27
機械学習で絶対音感になりたかった
curicle
0
20
BQにおけるSQLアンチパターンとslot消費削減策
curicle
0
35
VibeKanbanについて
curicle
0
16
Featured
See All Featured
Bash Introduction
62gerente
615
220k
Docker and Python
trallard
47
4.2k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
Done Done
chrislema
187
17k
Everyday Curiosity
cassininazir
0
350
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Skip the Path - Find Your Career Trail
mkilby
1
260
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Transcript
第46回勉強会 Webスクレイピング 2019/06/25 安齋 佑司 1 — Curious Vehicle Confidential
—
もくじ • Webスクレイピングとは • 環境構成 • 処理概要 • 実行結果 •
まとめ 2 — Curious Vehicle Confidential —
Webスクレイピングとは インターネットから情報を抽出すること — Curious Vehicle Confidential — 3
Webスクレイピングとは • 用途 1. 競合分析 2. データ補充 3. データマイニング —
Curious Vehicle Confidential — 4
Webスクレイピングとは • スクレイピングの流れ 1. Webクローリング 2. 抽出対象箇所の情報抽出 (ノイズを削除) 3. 整形
— Curious Vehicle Confidential — 5 今回は、ある目的でとあるWebサイトから情報を抽出したので その方法と結果を紹介します。
環境構成 1. インターネットに接続した端末 (クラウド推奨) 2. crawler4j (Java) 3. 整形用のスクリプト (Python)
4. 分析用ライブラリ (Python, gensim) — Curious Vehicle Confidential — 6 クローリングされたサイトからアクセスが遮断されても 影響が出ないようにクラウドからクローリングをかけている。 ※ サイト側からはDoSと見分けがつかないため。
処理概要 1. クローリング 2. 情報抽出 3. クレンジング 4. 分析 —
Curious Vehicle Confidential — 7
処理概要 1. クローリング https://github.com/yasserg/crawler4j — Curious Vehicle Confidential — 8
処理概要 — Curious Vehicle Confidential — 9 テキスト情報を取得するため More Examples
の Basic crawler を利用した
処理概要 — Curious Vehicle Confidential — 10 テキスト情報を取得するため More Examples
の Basic crawler を利用した
処理概要 — Curious Vehicle Confidential — 11 並列数、インターバル、階層の深さ、最大取得ページ数、URLを設定
処理概要 — Curious Vehicle Confidential — 12 フィルタ情報を設定し、ファイルに出力する処理を追記
処理概要 — Curious Vehicle Confidential — 13 Installation に従って pom.xml
を記述して Maven でビルド (面倒)
処理概要 — Curious Vehicle Confidential — 14 プログラムを実行して目的のページ数が取得されるまで待つ 1秒インターバル、4並列 *1ページ表示にかかる時間
→ 2万ページを取得するまで放置した。
処理概要 2. 情報抽出 — Curious Vehicle Confidential — 15 使わずにタグの文字列で当てに行った
処理概要 2. 情報抽出 — Curious Vehicle Confidential — 16
処理概要 3. クレンジング — Curious Vehicle Confidential — 17 英語以外の言語のページを除外
(2万 → 13270に減少) コンテンツに混ざっているHTMLタグを除外
処理概要 3. クレンジング — Curious Vehicle Confidential — 18 文章から特徴を抽出するために、以下の情報を削除
• Stop words • 前置詞、接続詞、代名詞、数詞 など 単語の正規化 • 複数形を単数形に寄せる • 原形に寄せる ※ この辺は vi マクロでコードを書いたが NLP系のライブラリを使えばよかった
処理概要 4. 分析 — Curious Vehicle Confidential — 19 各ページのトピックを
LDAで出力
処理概要 4. 分析 — Curious Vehicle Confidential — 20 全ページから
Word Count を出力
実行結果 — Curious Vehicle Confidential — 21 LDA 1コンテンツ1行でトピックを出力
実行結果 — Curious Vehicle Confidential — 22 Word Count 頻度順に出力
まとめ • WebスクレイピングはWeb上の資源を抽出できる • クローリングはサイトに迷惑をかけないように • 他の方法もあるので今回の方法が最善ではない • やってみると発見があるから面白い —
Curious Vehicle Confidential — 23
おしまい ご清聴ありがとうございました。 — Curious Vehicle Confidential — 24