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
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
170
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
230
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
140
AmebaブログはKMPから卒業します
kmars0605
0
220
Domain-Driven Transformation
hschwentner
2
2.3k
ジョジョの世界をXRで再現する
mofurune
0
180
Next.js: The final boss of Web Performance
guaca
0
310
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
440
No More NoSuchMethodError
exoego
1
110
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
350
Featured
See All Featured
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
My Coaching Mixtape
mlcsv
0
360
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Test your architecture with Archunit
thirion
2
2.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
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~❤️