-
Notifications
You must be signed in to change notification settings - Fork 41
/
app.R
83 lines (60 loc) · 2.14 KB
/
app.R
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
library(shiny)
library(readr)
createLink <- function(link) {
paste0('<a href="http://wechatscope.jmsc.hku.hk:8000/html?fn=', link,
'" target="_blank" class="btn btn-primary">查看全文</a>')
}
createLink2 <- function(link, val) {
paste0('<a href="http://206.189.252.32:8081/', link, ".html",
'" target="_blank" class="btn btn-primary">', val, '</a>')
}
we_ui= c("此内容因违规无法查看", "此内容被投诉且经审核涉嫌侵权,无法查看。",
"此帐号已被屏蔽,", "该公众号已迁移", "该内容已被发布者删除")
# Define UI for data download app ----
ui <- function(input, output, session){
navbarPage(
title = 'Wechatscope',
tabPanel('Since 2018-07-06',
fluidRow(
column(4,
selectInput("msg",
"censored_msg",
c("All", we_ui))
)
),
DT::dataTableOutput("table1")
),
tabPanel('Account',
includeHTML("form.html"),
DT::dataTableOutput("table2")
),
tabPanel('Download', downloadButton("downloadData", "Download"))
)
}
# Define server logic to display and download selected file ----
server <- function(input, output, session) {
wechat = reactiveFileReader(120000, session, 'ceninfo.csv', read_csv)
output$table1 <- DT::renderDataTable({
we = wechat()
if (input$msg != "All") {
we <- we[we$censored_msg == input$msg,]
}
we$nickname = createLink2(we$archive, we$nickname)
we$archive = createLink(we$archive)
DT::datatable(we, escape = FALSE,
options = list(
order = list(5, 'desc'),
pageLength = 50))
})
output$table2 <- DT::renderDataTable({
DT::datatable(unique(wechat()[,2]), options = list(paging = FALSE))
})
output$downloadData <- downloadHandler(
filename = "wechatscope.csv",
content = function(file) {
write.csv(wechat(), file, row.names = FALSE)
}
)
}
# Create Shiny app ----
shinyApp(ui, server)