HTML5教程

Node-RED中使用html节点爬取HTML网页资料之爬取Node-RED的最新版本

本文主要是介绍Node-RED中使用html节点爬取HTML网页资料之爬取Node-RED的最新版本,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

场景

Node-RED简介与Windows上安装、启动和运行示例:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/121884766

Node-RED怎样导出导入流程为json文件:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/124130985

我们可以使用浏览器的开发人员工具获取指定HTML网页资料的CSS选择器后,使用html

节点以CSS选择器来获取资料。

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

1、拖拽一个http request并编辑

 

 

2、访问Node-RED官网,打开开发者工具,找到版本号对应元素,右键选择复制-Copy selector,复制获取此资料的CSS选择器字符。

 

 

3、拖拽一个html解析组件并编辑

 

 

选取项就是上面复制的选择器字符

4、json数据

[
    {
        "id": "f4a4d8eab7935bc8",
        "type": "tab",
        "label": "流程 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "d88dd470.0ac7b8",
        "type": "inject",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "topic": "",
        "payloadType": "date",
        "x": 190,
        "y": 160,
        "wires": [
            [
                "874a3d4e.9b666"
            ]
        ]
    },
    {
        "id": "874a3d4e.9b666",
        "type": "http request",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://nodered.org",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "credentials": {},
        "x": 340,
        "y": 200,
        "wires": [
            [
                "a2a2d3f.7a16f3"
            ]
        ]
    },
    {
        "id": "7403c68f.21d7c8",
        "type": "debug",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 180,
        "wires": []
    },
    {
        "id": "a2a2d3f.7a16f3",
        "type": "html",
        "z": "f4a4d8eab7935bc8",
        "name": "",
        "property": "payload",
        "outproperty": "payload",
        "tag": "body > div.title > div > div > div > p > a > span",
        "ret": "html",
        "as": "single",
        "x": 580,
        "y": 120,
        "wires": [
            [
                "7403c68f.21d7c8"
            ]
        ]
    }
]

 

这篇关于Node-RED中使用html节点爬取HTML网页资料之爬取Node-RED的最新版本的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!