-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathTweet-Simple.json
91 lines (91 loc) · 2.41 KB
/
Tweet-Simple.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[
{
"id": "48e7f9c.bb73308",
"type": "tab",
"label": "Tweet Simple",
"disabled": false,
"info": ""
},
{
"id": "2baf5713.a4d9b",
"type": "twitter in",
"z": "48e7f9c.bb73308",
"twitter": "",
"tags": "",
"user": "false",
"name": "Listen to twitter feed",
"topic": "tweets",
"inputs": 1,
"x": 110,
"y": 100,
"wires": [
[
"45eea513.1f5ddc",
"b4a49bec.566bc",
"673ab097.f6d64"
]
]
},
{
"id": "45eea513.1f5ddc",
"type": "debug",
"z": "48e7f9c.bb73308",
"name": "msg.tweet details",
"active": true,
"console": "false",
"complete": "tweet",
"x": 490,
"y": 60,
"wires": []
},
{
"id": "b4a49bec.566bc",
"type": "function",
"z": "48e7f9c.bb73308",
"name": "Remove URLS and replace #",
"func": "// var tweet = msg.tweet.text;\nvar tweet = msg.payload;\nvar newtweet = tweet.replace(/#/g, \" Hash tag \");\n\n// regex from https://stackoverflow.com/questions/1500260/detect-urls-in-text-with-javascript\nmsg.payload = newtweet.replace( /(([a-z]+:\\/\\/)?(([a-z0-9\\-]+\\.)+([a-z]{2}|biz|com|co|edu|gov|info|net|org|ly))(:[0-9]{1,5})?(\\/[a-z0-9_\\-\\.~]+)*(\\/([a-z0-9_\\-\\.]*)(\\?[a-z0-9+_\\-\\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\\s+|$)/gi, \"see short URL \" );\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 140,
"wires": [
[
"34a2442.ccef13c"
]
]
},
{
"id": "34a2442.ccef13c",
"type": "debug",
"z": "48e7f9c.bb73308",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 790,
"y": 140,
"wires": []
},
{
"id": "673ab097.f6d64",
"type": "debug",
"z": "48e7f9c.bb73308",
"name": "",
"active": true,
"console": "false",
"complete": "tweet.text",
"x": 480,
"y": 100,
"wires": []
},
{
"id": "c5b35fdd.61425",
"type": "comment",
"z": "48e7f9c.bb73308",
"name": "Pick a #hashtag to follow",
"info": "",
"x": 120,
"y": 60,
"wires": []
}
]