• NodeRED中使用html节点爬取HTML网页资料之爬取NodeRED的最新版本


    场景

    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"
                ]
            ]
        }
    ]
  • 相关阅读:
    DrawerLayout Demo
    解析没有key的Json
    Actionbar Demo
    Fragment 创建及替换
    Android 图片在SD卡及包下的存储
    获取SD卡下Android/data/下文件
    判断软键盘的弹出
    Volley
    HttpClient Post请求
    Git .gitignore 设置为全局global
  • 原文地址:https://www.cnblogs.com/badaoliumangqizhi/p/16146643.html
Copyright © 2020-2023  润新知