Giter VIP home page Giter VIP logo

tweet-conf-dash's People

Contributors

gadenbuie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tweet-conf-dash's Issues

Tweets are garbled

Hi,

Today I opened the app in Chrome, and found that the tweets are garbled. Attached is the snapshot. Checked with other browser like Firefox, there seems fine. Was anything changed?

https://gofile.io/d/n0Nuas

Permission to deploy on R Studio cloud?

Hi, and thanks for a great app! I am trying to deploy a version of the app for a conference I'm at, #AERA19, via R Studio Cloud, but receive this message: Sorry, you do not have access. I tried to deploy other apps which received awards for the 1st Shiny Competition and was able; I left a comment on RStudio's blog asking about this, too (see here. Thanks!

Error in gzfile(file, "rb") : invalid 'description' argument

Hi Garrick,

This is amazing app. I tried run in my pc (Linux) and gave following error:
Using tweets from: NA
Getting Tweet oembed HTML, this may take a minute...
Using {furrr} to speed up the process
Error in gzfile(file, "rb") : invalid 'description' argument

It seems to be in the function

 tweets <- import_tweets(
    TWEETS_FILE,
    tz_global   = tz_global(),
    topic_terms = TOPIC$terms,
    start_date  = TWEETS_START_DATE,
    blocklist   = BLOCKLIST
)

> 
> 15.
> gzfile(file, "rb") 
> 14.
> readRDS(file) 
> 13.
> eval(lhs, parent, parent) 
> 12.
> eval(lhs, parent, parent) 
> 11.
> readRDS(file) %>% mutate(created_at = lubridate::with_tz(created_at, 
>     tz_global())) %>% tweets_since(TWEETS_START_DATE) %>% tweets_not_hashdump() %>% 
>     tweets_block(blocklist$status_id, blocklist$screen_name) %>% 
>     arrange(desc(created_at)) %>% is_topic_tweet(topic_terms) at functions.R#10
> 10.
> import_tweets(TWEETS_FILE, tz_global = tz_global(), topic_terms = TOPIC$terms, 
>     start_date = TWEETS_START_DATE, blocklist = BLOCKLIST) 
> 9.
> eval(lhs, parent, parent) 
> 8.
> eval(lhs, parent, parent) 
> 7.
> import_tweets(TWEETS_FILE, tz_global = tz_global(), topic_terms = TOPIC$terms, 
>     start_date = TWEETS_START_DATE, blocklist = BLOCKLIST) %>% 
>     filter(is_topic) %>% tweet_cache_oembed() at global.R#57
> 6.
> ..stacktraceon..({
>     library(shiny)
>     library(shinydashboard)
>     library(forcats) ... 
> 5.
> eval(exprs, envir) 
> 4.
> eval(exprs, envir) 
> 3.
> sourceUTF8(file.path.ci(appDir, "global.R")) 
> 2.
> appParts$onStart() 
> 1.
> runApp() 

Just one question what mean %||%? ( I never saw nothing like this).
I found in %||% <- function(x,y)

Tried to replicate the GUI of 'Media Tweets' but not successful completely

Hi,

I was trying to replicate the 'Media Tweets' tab of the App to get the Twitter window as follows -

Note - the tweets.rds file used here is available in [https://gofile.io/?c=3pcjhp]

Loading required libraries

library(shiny)
library(shinyThings)
library(shinycssloaders)
library(plotly)
library(lubridate)
library(stringr)
library(tidyr)
library(purrr)
library(dplyr)

The UI page with applicable CSS

ui <- fluidPage(
  tags$head(
    tags$style(HTML("
.masonry {
  margin: 1.5em auto;
  max-width: 100%;
  column-gap: 1.5em;
}

/* The Masonry Brick */
.tweet-item {
  /*background: #fff;*/
  padding: 0;
  border-radius: 5px;
  margin: auto;
  max-width: 500px;
}

/* Masonry on large screens */
@media only screen and (min-width: 1561px) {
  .masonry {
    column-count: 4;
  }
}

@media only screen and (min-width: 1024px) and (max-width: 1560px)  {
  .masonry {
    column-count: 3;
  }
}

/* Masonry on medium-sized screens */
@media only screen and (max-width: 1023px) and (min-width: 701px) {
  .masonry {
    column-count: 2;
  }
}

/* Masonry on small screens */
@media only screen and (max-width: 700px) and (min-width: 540px) {
  .masonry {
    column-count: 1;
  }
}"))),

  shinyThings::paginationUI("pic_tweets", width = 12, offset = 0),
  uiOutput("pic_tweets_wall"),
  shinyThings::pagerUI("pic_tweets", centered = TRUE)
)

The Server page

server <- function(input, output, session) {
	## Few important functions
		masonify_tweets <- function(tweets, id = NULL, class = NULL) {
			  stopifnot("status_id" %in% names(tweets))

			  t_embed <-
			    tweets %>%
			    pmap(get_tweet_blockquote) %>%
			    map(HTML) %>%
			    map(tags$div, class = "tweet-item")

			  tagList(
			    tags$div(id = id,
			             class = paste("masonry text-left", class),
			             t_embed
			    )
			  )
			}

			get_tweet_blockquote <- function(screen_name, status_id, ..., null_on_error = TRUE, theme = "light") {
			  oembed <- list(...)$oembed
			  if (!is.null(oembed) && !is.na(oembed)) return(unlist(oembed))
			  oembed_url <- glue::glue("https://publish.twitter.com/oembed?url=https://twitter.com/{screen_name}/status/{status_id}&omit_script=1&dnt=1&theme={theme}")
			  bq <- possibly(httr::GET, list(status_code = 999))(URLencode(oembed_url))
			  if (bq$status_code >= 400) {
			    if (null_on_error) return(NULL)
			    '<blockquote style="font-size: 90%">Sorry, unable to get tweet ¯\\_(ツ)_/¯</blockquote>'
			  } else {
			    httr::content(bq, "parsed")$html
			  }
			}

	tweets_all <- reactiveFileReader(1 * 60 * 1000, session, 'tweets.rds', function(file) {
						    x <- readRDS(file)
						    x
						  })

	tweets <- reactive({
	    req(tweets_all())
	    tweets_all()
	  })

	  	Break <- 20	  

		tweets_pictures <- reactive({
		    tweets() %>%
		      select(created_at, status_id, screen_name, media_url)
		  })
		
		pic_tweets_n_items <- reactive({ nrow(tweets_pictures()) })	  

		pic_tweets_page <- shinyThings::pager("pic_tweets", pic_tweets_n_items, Break)	

		output$pic_tweets_wall <- renderUI({
		    s_page_items <- pic_tweets_page() %||% 1L

		    tweets_pictures() %>%
	      slice(s_page_items) %>%
	      masonify_tweets()
		  })
}

However as you see, with this I not getting complete styling of the actual Twitter page. For example, in Twitter if we see the tweet with 'Arranging stacked bar graph by a plot order', we see a snapshot as in https://gofile.io/?c=0DmEY1

Any pointer if it is possible to get Tweet information just like in the Twitter page, will be highly helpful.

Thanks,

Seeing no media by loading tweets

First of all, thank you for such a nice example of a webapp analyzing tweets!
I tried to include some of those things within another project but I had some struggles about streaming the tweets.
I succeeded in seeing the text, within the typical twitter layout, of a tweet but there are no images displaying...
I have the following code:

output$tweet_random <- renderUI({ tweets_most() %>% arrange(desc(favorite_count)) %>% slice(2) %>% pmap(get_tweet_blockquote) %>% .[[1]] %>% HTML() })

Am I doing something wrong?
Thank you in advance for your help!

Self- contained app gets Twitter data but UI crashes

Hi,
this is a great app. I wanted to to take a closer look. I like how you present the metrics.

I am using the self-contained version of your app. The master is giving me different sort of troubles I cannot follow. From the self- contained app I am getting this error:

image

I was able to get all the tweets gathered running first the 00-first-run.R file.
image

The error seems to be coming from ui.r, here:

dashboardPage(
  # Dashboard Page Setup ----------------------------------------------------
  title = META$name,
  skin  = META$skin_color,
  theme = c(META$theme_css, "custom.css"),
  sidebar_mini = TRUE,
  dashboardHeader(
    title = HTML(glue::glue(
      '<span class="logo-mini">{META$logo_mini}</span>
      <span class="logo-lg">{META$logo_lg}</span>'
    ))
  ),

Any hints?

Thanks.

Almost there ... GUI works but something wrong with the dataset

Hi Garrick,
I am almost done. I think I got it right after giving me some clues about your version of shinydashboard. Also installed the respective version of shinyThings.
This is where I am:
image

I cannot get the value boxes populated. I am getting an error:
image

image

Any other place I should look into?

BTW, I like your package shinyThings. It makes development and presentation better.

Use your version of dashboard

Hi, Thanks for the great looking app.

I have been using official shinydashboard for a few years now and it looks a bit tired. I searched for some fresh look shiny UI and came upon your app. It looks very clean and your choice of color appears calm-inducing.

I read through the open and closed issues before I try to stand up your app. It is not entirely clear which branch I should use. I wonder if it is possible to provide a sample tweets_oembed.rds so the app could be stood up without going through getting twitter downloaded which I saw a few people having trouble to get it going.

I read in one of the issue response you planed to pull request your modification to shinydashboard, not sure if you managed to do that?

Thanks much.

Authenticating rtweet within shiny

Hi Garrick, thanks for the app - it has been really useful for me as I learn shiny.

I can run the app locally, which collects tweets from a list of users, updates an .rds containing all the tweets, and uses these throughout the app. I'm not sure if my issue is with shiny-rtweet authentication, or reading an RDS file in shiny.

When running on the shinyapps.io server, I get stopped at this error:

I have tried to use this and this advice, without luck.

The log file I'm getting shows:

2019-09-01T14:17:51.765485+00:00 shinyapps[1133712]: Warning: Error in readRDS: error reading from connection
2019-09-01T14:17:51.769828+00:00 shinyapps[1133712]:   68: readRDS
2019-09-01T14:17:51.769831+00:00 shinyapps[1133712]:   67: is_tokenfile
2019-09-01T14:17:51.769832+00:00 shinyapps[1133712]:   66: twitter_pat
2019-09-01T14:17:51.769833+00:00 shinyapps[1133712]:   63: get_tokens
2019-09-01T14:17:51.769834+00:00 shinyapps[1133712]:   62: rate_limit
2019-09-01T14:17:51.769835+00:00 shinyapps[1133712]:   61: get_timeline_unlimited
2019-09-01T14:17:51.769836+00:00 shinyapps[1133712]:   60: get_user_tweets
2019-09-01T14:17:51.769838+00:00 shinyapps[1133712]:   59: server [/srv/connect/apps/candidates-2019-dash/server.R#9]
2019-09-01T14:17:51.770060+00:00 shinyapps[1133712]: Error in readRDS(x) : error reading from connection

You can see the function I use to collect the tweets here:

Not sure if this is the right place to add this question, not really an issue with your app - will migrate to SO if more suitable there!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.