在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):syrusakbary/gdom开源软件地址(OpenSource Url):https://github.com/syrusakbary/gdom开源编程语言(OpenSource Language):Python 100.0%开源软件介绍(OpenSource Introduction):GDOMGDOM is the next generation of web-parsing, powered by Install it typing in your console: pip install gdom DEMO: Try GDOM online UsageYou can either do gdom QUERY_FILE This command will write in the standard output (or other output if specified
via Your {
page(url:"http://news.ycombinator.com") {
items: query(selector:"tr.athing") {
rank: text(selector:"td span.rank")
title: text(selector:"td.title a")
sitebit: text(selector:"span.comhead a")
url: attr(selector:"td.title a", name:"href")
attrs: next {
score: text(selector:"span.score")
user: text(selector:"a:eq(0)")
comments: text(selector:"a:eq(2)")
}
}
}
} Advanced usageIf you want to generalize your gdom query to any page, just rewrite your
query file adding the query ($page: String) {
page(url:$page) {
# ...
}
} And then, query it like: gdom QUERY_FILE http://news.ycombinator.com |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论