Code Monkey home page Code Monkey logo

tumblr-liked-photos-export's Introduction

Tumblr Liked Photos Export

Export the images from your liked posts in Tumblr.

Installation

  1. Clone the repo:

     $ git clone [email protected]:javierarce/tumblr-liked-photos-export.git
    
  2. Install dependencies:

     $ gem install httparty
    
  3. Enable the option "Share posts you like" in the settings page of your blog.

  4. Register a new app:

     https://www.tumblr.com/oauth/apps
    
  5. Copy the OAuth Consumer Key of the app.

  6. Now you have two options:

  • Add two keys to your bash/zsh:

      export TUMBLR_USERNAME="MY_FANTASTIC_TUMBLR_USERNAME"  
      export TUMBLR_API_KEY="MY_DAUNTING_OAUTH_CONSUMER_KEY"  
    
  • Or simply update the export.rb file with your credentials:

      # Configuration
      username = "MY_COOL_TUMBLR_USERNAME"
      api_key  = "MY_OH_SO_NICE_OAUTH_CONSUMER_KEY"
    

Usage

Go to the app directory and run:

ruby export.rb

Your favorite images from Tumblr will be downloaded to the folder images.

Optionally, you can specify a username param:

ruby export.rb username

Or a username and a name for the download directory:

ruby export.rb username download_dir

Output

This is what it looks like when it runs:

$ ruby export.rb username

URL
http://api.tumblr.com/v2/blog/username.tumblr.com/likes?api_key=API_KEY

USERNAME
username

DIR
images

Downloading 1234 posts

blog-a
   https://66.media.tumblr.com/8262342342318fcaaae94770923093/tumblr_klmsadflkldsk1_500.jpg
blog-b
   https://66.media.tumblr.com/8262342342318fcaaae94770923093/tumblr_klmsadflkldsk1_500.jpg
   https://66.media.tumblr.com/8262342342318fcaaae94770923093/tumblr_klmsadflkldsk1_500.jpg
blog-c
  https://66.media.tumblr.com/8262342342318fcaaae94770923093/tumblr_klmsadflkldsk1_500.jpg
...

Rate limits

Newly registered consumers are rate limited to 1,000 requests per hour, and 5,000 requests per day. If your application requires more requests for either of these periods, you'll need request a rate limit removal on the app (there's a link for that in the app directory page).

Troubleshooting

  • If you get the an Unauthorized error message, open the URL http://api.tumblr.com/v2/blog/USERNAME.tumblr.com/likes?api_key=API_KEY in your browser (replacing USERNAME and API_KEY with your own values). You should see a list of posts.

  • If you get the error cannot load such file -- httparty, use gem to install dependencies.

  • It seems that old keys (before the Automattic era?) always return an Unauthorized error… the solution for this problem is to create a new app.

Contributors

Javier Arce
Sergi Meseguer

More

Hey there, digital Diogenes, do you need to export more? Then check out the tumblr-full-backup repo by zigotica.

tumblr-liked-photos-export's People

Contributors

javierarce avatar kevinrob avatar simplgy avatar zigotica 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

Watchers

 avatar  avatar  avatar  avatar

tumblr-liked-photos-export's Issues

rate limit / incremental download

Does the program deal gracefully with tumblr's rate limit (1000 requests per hour, 5000 requests per day for new keys)? If not, can I restart the program so that checks whether a file already exists and doesn't download it again?

please help us

I'm really new about those things. I actually tried to use this yesterday for 4 hours
but still having problems. :( below
export.rb:5:in <main>': undefined local variable or method [redacted API KEY]' for main:Object (NameError)
got this error. please save us I think so many people are looking for your git now because of their terrible decision but some of them cannot use this like me. I really hope you check this ASAP
thanks

nokogiri problem

I am using the script on Windows 10 64 bit with Ruby 2.5.0

When running the script, I get the following error

1: from C:/Program Files/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)

Installing nokogiri again does not solve the problem

C:\Tools\Web\tumblr-full-backup-master>gem install nokogiri -f
Nokogiri is built with the packaged libraries: libxml2-2.9.5, libxslt-1.1.30, zlib-1.2.11, libiconv-1.15.
Successfully installed nokogiri-1.8.1-x64-mingw32
Parsing documentation for nokogiri-1.8.1-x64-mingw32
Done installing documentation for nokogiri after 1 seconds
1 gem installed

Limit 9999 - Saves only 1109 images

I am using the recent version of your script on OSX 10.11.4. I have over 2400 liked posts but your script only saves 1109 images. The strange thing is that the terminal output looks like it's continuing with download, but the images folder stays at 1109 images.

cannot load such file -- httparty

~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- httparty (LoadError)
	from ~/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from export.rb:2:in `<main>'

Probably my ruby version, I'll update and report back.

Thanks for making this btw, very useful.

Unauthorized

I tried to download my 493 likes, but only got this error:

C:\Ruby23-x64\bin>ruby export.rb
Downloading 500 posts
Unauthorized
Aaaaand we're done, parsed 20

My username and OAuth Consumer Key is correct, is there any problem with the API?

Unhandled 404 response

Upon running ruby.exe export.rb I got this:

Error: no implicit conversion of String into Integer
Error: ["export.rb:61:in []'", "export.rb:61:in get_liked_count'", "export.rb:130:in start'", "export.rb:179:in

'"]

If I print parsed_response with puts parsed_response.inspec on line 62 this is the result:

{"meta"=>{"status"=>404, "msg"=>"Not Found"}, "response"=>[], "errors"=>[{"title"=>"Not Found", "code"=>0, "detail"=>"Minor hiccup. Try again."}]}

Error on downloaded - undefined method

Hi Everyone,

Getting an error on downloading the files,
URL
XXXXX

USERNAME
-me-

DIR
images

Downloading 65276 posts
:( undefined method `[]' for nil:NilClass

which repeats over and over. Tips?

-- Env

  • ruby 2.5, ruby 2.3, installed gem for each
  • Mac 10.13.6

-James

Doesn't adhere to offset

One of the parameters of Tumblr is the offset, where you can start at a certain liked photo.

Your code doesn't support this. It seems to set the offset to 0 and will always start there.

In order to get around the 1000 image limit set by Tumblr, it seems as though you would need to take into account the offset, so people could download images 0-1000, or 1001-2000 etc.

I changed line offset = i*@limit to offset = 1000 and that worked, and it seems Tumblr only allows the last 1000 images. If you set it this way, it won't download any more images.

So this appears to be a limitation of Tumblr, not the script code. The script is really only good if you have less than 1000 likes. I suppose to get around it, you can run the script, unlike 1000 likes, then run again.. until you have all your likes.

Undefined method error in get_photos

Love the script. It was working great for the first 1,204 images (it reported a total of 5K in the beginning), until I was thrown this:

export.rb:55:in get_photos': undefined method [] for nil:NilClass (NoMethodError)
from export.rb:133:in block in download
from export.rb:127:in times
from export.rb:127:in download
from export.rb:145:in main

Stops at around 814 images

Canceling my comment. It looks like there is a 1000 image limit on Tumblr that this code can't get around.

If you try downloading more than 1000, it will start to re-download the first few images over and over again once you hit the limit.

Actually the second update to this code worked better, as it would at least stop downloading the last X images over and over again. The third update broke that again.

Is there a way to start the script in the second 1000 likes, or is the 1000 limit always the latest 1000?

Unauthorized

After following all the steps I get this Unauthorized issue.

screen shot 2016-06-27 at 12 26 43

Share posts you like

Hi Javier,
am I doing something wrong, or tumblr changed how you can access the Likes?

I am receiving the following response from the api:
{"meta":{"status":403,"msg":"Forbidden"},"response":[],"errors":[{"title":"Forbidden","code":0,"detail":"Hit a snag. Try again."}]}
If I try the link https://api.tumblr.com/v2/blog/NAME.tumblr.com/info?api_key=KEY
It's working.

I noticed that in the Blog settings, the link is different: tumblr.com/liked/by/NAME

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.