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
Introduction for Brownant
Search
Jiangge Zhang
April 11, 2014
Programming
210
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction for Brownant
Jiangge Zhang
April 11, 2014
Other Decks in Programming
See All in Programming
AIに “答え“を書かせるのを やめてみた
___akari11
0
130
Event is what happens
moro
2
1.2k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
210
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
2
1.2k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
290
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
160
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
140
Simple Storage Service(S3) is not simple
iwatsukayura
0
310
golang-bob.pdf
iwatsukayura
0
130
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
120
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
180
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
600
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
6.1k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Building AI with AI
inesmontani
PRO
1
1.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
Abbi's Birthday
coloredviolet
4
10k
Producing Creativity
orderedlist
PRO
348
41k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Agile that works and the tools we love
rasmusluckow
331
22k
WENDY [Excerpt]
tessaabrams
14
40k
Transcript
(´ŋ_ŋ`)
贴⼀一个 URL,得到数据 “抓”
需要结构化的数据 • ⽤用统计学⽅方法猜测 —— Readability、Pocket、搜索引擎 • ⽤用约定的协议(如 schema.org、OpenGraph) —— Facebook、Twitter
Card、搜索引擎 • 抓取者定制规则 —— ⾖豆瓣东⻄西
⽐比较笨的实现 写⼀一个函数去匹配和分解 URL
⽐比较笨的实现 ⼜又写⼀一个函数去抽取信息
其实⼤大部分规则 都是可以 ⽤用配置⽂文件写出来的
配置⽂文件就是这样 。。。。。。
静态配置的问题 • 原来 title_pattern = `//*[@id=info]/h2/text()` • 后来这个⺴⽹网站改版了,需要请求另⼀一个 API 才能拿
到标题 • 我们就 。。。。。。
如果需要能伸能缩 DSL
最好的例⼦子 DSL with Ruby
既是语⾔言,也是配置
Brownant 基于 Python 的 descriptor 特性
Python 的 descriptor • 拦截 getattr、setattr、delattr • 能访问宿主对象 • “元属性”
None
Pipeline o.title o.etree o.text_response o.http_client o.url
Pipeline o.title o.etree o.text_response o.http_client o.ajax_response o.ajax_json o.price o.url o.ajax_url
借助了其他开源库 • Werkzeug —— URL 分发 • lxml 和 requests
—— 访问⺴⽹网络、解析 HTML • six —— 兼容 Python 2 / Python 3
接下来希望解决的问题 • ⽂文档太简陋 • 内置 PipelineProperty 类型太少 • 不会画蚂蚁,所以没 Logo
github.com:douban/brownant Waiting your pull request tonight~❤️