<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/by-request-retrieving-your-feedly-saved-for-later-entries/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rud.is/b/2018/04/16/by-request-retrieving-your-feedly-saved-for-later-entries/"> R – rud.is</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="http://twitter.com/mkjcktzn" target="_blank">@mkjcktzn</a> <a rel="nofollow" href="https://rud.is/b/2018/04/04/exploring-r-bloggers-posts-with-the-feedly-api/#comment-19163" target="_blank">asked</a> if one can access Feedly “Saved for Later” items via the API. The answer is “Yes!”, and it builds off of that previous post. You’ll need to <a rel="nofollow" href="https://rud.is/b/2018/04/04/exploring-r-bloggers-posts-with-the-feedly-api/" target="_blank">read it</a> and get your authentication key (still no package <img alt="😞" src="https://i1.wp.com/s.w.org/images/core/emoji/2.4/72x72/1f61e.png?w=456&ssl=1" class="wp-smiley" data-recalc-dims="1">) before continuing.</p>
<p>We’ll use most (I think “all”) of the code from the previous post, so let’s bring that over here:</p>
<pre><code>library(httr)
library(tidyverse)

.pkgenv &lt;- new.env(parent=emptyenv())
.pkgenv$token &lt;- Sys.getenv(&quot;FEEDLY_ACCESS_TOKEN&quot;)

.feedly_token &lt;- function() return(.pkgenv$token)

feedly_stream &lt;- function(stream_id, ct=100L, continuation=NULL) {
  
  ct &lt;- as.integer(ct)
  
  if (!is.null(continuation)) ct &lt;- 1000L
  
  httr::GET(
    url = &quot;https://cloud.feedly.com/v3/streams/contents&quot;,
    httr::add_headers(
      `Authorization` = sprintf(&quot;OAuth %s&quot;, .feedly_token())
    ),
    query = list(
      streamId = stream_id,
      count = ct,
      continuation = continuation
    )
  ) -> res
  
  httr::stop_for_status(res)
  
  res &lt;- httr::content(res, as=&quot;text&quot;)
  res &lt;- jsonlite::fromJSON(res)
  
  res
  
}</code></pre>
<p>According to the <a rel="nofollow" href="https://developer.feedly.com/cloud/" target="_blank">Feedly API Overview</a> there is a “global resource id” which is formatted like <code>user/:userId/tag/global.saved</code> and defined as <em>“Users can save articles for later. Equivalent of starring articles in Google Reader.”</em>.</p>
<p>The “Saved for Later” feature is quite handy and all we need to do to get access to it is substitute our user id for <code>:userId</code>. To do that, we’ll build a helper function:</p>
<pre><code>feedly_profile &lt;- function() {
  
  httr::GET(
    url = &quot;https://cloud.feedly.com/v3/profile&quot;,
    httr::add_headers(
      `Authorization` = sprintf(&quot;OAuth %s&quot;, .feedly_token())
    )
  ) -> res
  
  httr::stop_for_status(res)
  
  res &lt;- httr::content(res, as=&quot;text&quot;)
  res &lt;- jsonlite::fromJSON(res)
  
  class(res) &lt;- c(&quot;feedly_profile&quot;)
  
  res
  
}</code></pre>
<p>When that function is called, it returns a ton of user profile information in a <code>list</code>, including the <code>id</code> that we need:</p>
<pre><code>me &lt;- feedly_profile()

str(me, 1)
## List of 46
##  $ id                          : chr &quot;9b61e777-6ee2-476d-a158-03050694896a&quot;
##  $ client                      : chr &quot;feedly&quot;
##  $ email                       : chr &quot;...@example.com&quot;
##  $ wave                        : chr &quot;2013.26&quot;
##  $ logins                      :'data.frame': 4 obs. of  6 variables:
##  $ product                     : chr &quot;Feedly...&quot;
##  $ picture                     : chr &quot;https://...&quot;
##  $ twitter                     : chr &quot;hrbrmstr&quot;
##  $ givenName                   : chr &quot;...&quot;
##  $ evernoteUserId              : chr &quot;112233&quot;
##  $ familyName                  : chr &quot;...&quot;
##  $ google                      : chr &quot;1100199130101939&quot;
##  $ gender                      : chr &quot;...&quot;
##  $ windowsLiveId               : chr &quot;1020d010389281e3&quot;
##  $ twitterUserId               : chr &quot;99119939&quot;
##  $ twitterProfileBannerImageUrl: chr &quot;https://...&quot;
##  $ evernoteStoreUrl            : chr &quot;https://...&quot;
##  $ evernoteWebApiPrefix        : chr &quot;https://...&quot;
##  $ evernotePartialOAuth        : logi ...
##  $ dropboxUid                  : chr &quot;54555&quot;
##  $ subscriptionPaymentProvider : chr &quot;......&quot;
##  $ productExpiration           : num 2.65e+12
##  $ subscriptionRenewalDate     : num 2.65e+12
##  $ subscriptionStatus          : chr &quot;Active&quot;
##  $ upgradeDate                 : num 2.5e+12
##  $ backupTags                  : logi TRUE
##  $ backupOpml                  : logi TRUE
##  $ dropboxConnected            : logi TRUE
##  $ twitterConnected            : logi TRUE
##  $ customGivenName             : chr &quot;...&quot;
##  $ customFamilyName            : chr &quot;...&quot;
##  $ customEmail                 : chr &quot;...@example.com&quot;
##  $ pocketUsername              : chr &quot;...@example.com&quot;
##  $ windowsLivePartialOAuth     : logi TRUE
##  $ facebookConnected           : logi FALSE
##  $ productRenewalAmount        : int 1111
##  $ evernoteConnected           : logi TRUE
##  $ pocketConnected             : logi TRUE
##  $ wordPressConnected          : logi FALSE
##  $ windowsLiveConnected        : logi TRUE
##  $ dropboxOpmlBackup           : logi TRUE
##  $ dropboxTagBackup            : logi TRUE
##  $ backupPageFormat            : chr &quot;Html&quot;
##  $ dropboxFormat               : chr &quot;Html&quot;
##  $ locale                      : chr &quot;en_US&quot;
##  $ fullName                    : chr &quot;...&quot;
##  - attr(*, &quot;class&quot;)= chr &quot;feedly_profile&quot;</code></pre>
<p><em>(You didn’t think I wouldn’t redact that, did you? Note that I made up a unique <code>id</code> as well.)</em></p>
<p>Now we can call our stream function and get the results:</p>
<pre><code>entries &lt;- feedly_stream(sprintf(&quot;user/%s/tag/global.saved&quot;, me$id))

str(entries$items, 1)
# output not shown as you don't really need to see what I've Saved for Later</code></pre>
<p>The structure is the same as in the previous post.</p>
<p>Now, you can go to town and programmatically access your Feedly “Saved for Later” entries.</p>
<p>You an also find more “Resource Ids” and “Global Resource Ids” formats on the <a rel="nofollow" href="https://developer.feedly.com/cloud/" target="_blank">API Overview page</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://rud.is/b/2018/04/16/by-request-retrieving-your-feedly-saved-for-later-entries/"> R – rud.is</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/0w9d5RIdjP8" height="1"></a></div>