Kanna在解析HTML时删除节点
我使用Kanna遍历网站的HTML,查找Kanna在解析HTML时删除节点,html,swift,kanna,Html,Swift,Kanna,我使用Kanna遍历网站的HTML,查找 我遇到的问题是,在一些网站上,let document=try HTML(HTML:HTML!,编码:.utf8)步骤以某种方式删除了节点符号,但在其他网站上没有 例如:原始HTML: <!DOCTYPE html> <html lang="en-US"> <head> <meta charset="UTF-8"/> <meta name=&qu
我遇到的问题是,在一些网站上,let document=try HTML(HTML:HTML!,编码:.utf8)
步骤以某种方式删除了节点符号,但在其他网站上没有
例如:原始HTML:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name='robots' content='max-image-preview:large, index, follow, max-snippet:-1, max-video-preview:-1'/>
<script>
(function(w, d) {
w.adthrive = w.adthrive || {};
w.adthrive.cmd = w.adthrive.cmd || [];
w.adthrive.plugin = 'adthrive-ads-1.0.43';
w.adthrive.host = 'ads.adthrive.com';
var s = d.createElement('script');
s.async = true;
s.referrerpolicy = 'no-referrer-when-downgrade';
s.src = 'https://' + w.adthrive.host + '/sites/55cb7e3b4bc841bd0c4ea577/ads.min.js?referrer=' + w.encodeURIComponent(w.location.href);
var n = d.getElementsByTagName('script')[0];
n.parentNode.insertBefore(s, n);
})(window, document);
</script>
<!-- This site is optimized with the Yoast SEO Premium plugin v15.9.1 - https://yoast.com/wordpress/plugins/seo/ -->
<title>Apple Salad with Candied Walnuts and Cranberries | RecipeTin Eats</title>
<meta name="description" content="This Apple Salad is a celebration of textures and flavours! Crispy juicy apple, leafy salad, candied walnuts, plumped cranberries with a vinaigrette."/>
<link rel="canonical" href="https://www.recipetineats.com/apple-salad-candied-walnuts-cranberries/"/>
<meta name="twitter:label1" content="Written by">
<meta name="twitter:data1" content="Nagi">
<meta name="twitter:label2" content="Est. reading time">
<meta name="twitter:data2" content="5 minutes">
<script type="application/ld+json" class="yoast-schema-graph">{ ... }</script>
…
是我想要提取的内容,但由于节点消失,我无法调用此块。为了这篇文章的清晰,我把它缩写了
在使用Kanna时,是否有其他人仅在某些网站上遇到过这种情况?上述swift代码适用于10个网站中的9个
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name='robots' content='max-image-preview:large, index, follow, max-snippet:-1, max-video-preview:-1'/>
<script>
(function(w, d) {
w.adthrive = w.adthrive || {};
w.adthrive.cmd = w.adthrive.cmd || [];
w.adthrive.plugin = 'adthrive-ads-1.0.43';
w.adthrive.host = 'ads.adthrive.com';
var s = d.createElement('script');
s.async = true;
s.referrerpolicy = 'no-referrer-when-downgrade';
s.src = 'https://' + w.adthrive.host + '/sites/55cb7e3b4bc841bd0c4ea577/ads.min.js?referrer=' + w.encodeURIComponent(w.location.href);
var n = d.getElementsByTagName('script')[0];
n.parentNode.insertBefore(s, n);
})(window, document);
</script>
<!-- This site is optimized with the Yoast SEO Premium plugin v15.9.1 - https://yoast.com/wordpress/plugins/seo/ -->
<title>Apple Salad with Candied Walnuts and Cranberries | RecipeTin Eats</title>
<meta name="description" content="This Apple Salad is a celebration of textures and flavours! Crispy juicy apple, leafy salad, candied walnuts, plumped cranberries with a vinaigrette."/>
<link rel="canonical" href="https://www.recipetineats.com/apple-salad-candied-walnuts-cranberries/"/>
<meta name="twitter:label1" content="Written by">
<meta name="twitter:data1" content="Nagi">
<meta name="twitter:label2" content="Est. reading time">
<meta name="twitter:data2" content="5 minutes">
<script type="application/ld+json" class="yoast-schema-graph">{ ... }</script>
(function(w, d) {
w.adthrive = w.adthrive || {};
w.adthrive.cmd = w.adthrive.cmd || [];
w.adthrive.plugin = 'adthrive-ads-1.0.43';
w.adthrive.host = 'ads.adthrive.com';
var s = d.createElement('script');
s.async = true;
s.referrerpolicy='no-referrer-when-downgrade';
s.src = 'https://' + w.adthrive.host + '/sites/55cb7e3b4bc841bd0c4ea577/ads.min.js?referrer=' + w.encodeURIComponent(w.location.href);
var n = d.getElementsByTagName('script')[0];
n.parentNode.insertBefore(s, n);
})(window, document);
Apple Salad with Candied Walnuts and Cranberries | RecipeTin Eats
{ ... }