From 6425000ce4de6b9a6b0cff0d8bf0a19ef74130f2 Mon Sep 17 00:00:00 2001 From: "mir.zhou" <17908471@qq.com> Date: Thu, 7 Apr 2022 23:18:10 +0800 Subject: [PATCH] example: fix the tuicool.com crawler example (changed html structure) (#13962) --- examples/web_crawler/web_crawler.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/web_crawler/web_crawler.v b/examples/web_crawler/web_crawler.v index 00d4dfa0ad..76aec55523 100644 --- a/examples/web_crawler/web_crawler.v +++ b/examples/web_crawler/web_crawler.v @@ -15,8 +15,9 @@ fn main() { // html.DocumentObjectModel.get_tag_by_attribute_value() retrieves all the tags in the document that has the given attribute name and value. tags := doc.get_tag_by_attribute_value('class', 'list_article_item') for tag in tags { - href := tag.children[0].attributes['href'] or { panic('key not found') } - title := tag.children[0].attributes['title'] or { panic('key not found') } + el := tag.children[1].children[0].children[0].children[0] + href := el.attributes['href'] or { panic('key not found') } + title := el.attributes['title'] or { panic('key not found') } println('href: $href') println('title: $title') println('')