Save Snapchat files (Android) – Part 1

SnapchatIf you’re using Snapchat, chances are you want to save some of the pictures and/or videos you receive. Now you can.

Edit: This post is now obsolete! Snapchat have upgraded their app, and since the time of writing, many free apps have appeared on the Google Play and Apple App Stores.

I should start with a preface: You probably shouldn’t do this. Half the fun of Snapchat is knowing it’s a one-off, and there’s a sort of “honour among thieves” type of policy between users. That being said, I do like a challenge, even if a solution does make me look creepy.

What you’ll need

  1. I assume that if you’re reading this, you have Snapchat. If you don’t, you can grab it from one of the links on their website.
  2. An Android phone. So far, this solution only applies to Android. I’m currently playing around with a solution for Apple devices.
  3. A rooted phone. I probably haven’t thought hard enough about the problem, but from what I can tell, you need to have root access for this to work.
  4. The most useful tool of all – a Terminal Emulator. There are heaps of apps out there for changing permissions and fiddling with the filesystem, but nothing is better than the ol’ terminal.

The Script

Most of what does the work is inside this shell script:

When executed (before viewing anything), the script checks the two storage locations for Snapchat (images and video), loop through the list of files, and copies the data to a safe location (a place the app can’t touch). The unusual part of the script is the use of the cat command, which we need due to some filesystem limitations within Android. Also, keep in mind that the paths above are for my device (Samsung Galaxy SIII, running Jelly Bean 4.1). You may need to update them if the script is returning errors.

Setting up the script

If you are Unix-savvy, you probably already know how to do this. You can jump down to the “how-to” section below for some notes.

If you’re a little Unix-rusty, here’s what you need to do to get this script working.

  1. First, copy/paste the script above into a new text file. Save it as whatever you like and add the extension .sh. I called mine snapchat.sh.
  2. Transfer the script onto your phone using Android File Transfer (Mac) or just in Explorer (Windows). I usually just stick it in the sdcard’s “Downloads” folder. It actually doesn’t matter, as this location is temporary anyway.
  3. Open the Terminal Emulator. First switch to the root user by running the su command.

    Then, make the internal system writable by running:

    If this step isn’t working, you can try this app instead. It’s what I use, as it offers a one-click solution.

  4. Now that you’re root, we need to move the script to a place on the system to allow us to execute it without any permission errors. Thanks to an Android limitation, this will need to be done using cat. Note: Some people appeared to be having problems copying to /etc. I’m now using /data instead to avoid any difficulties. Everything except the path is the same.

    This outputs the contents of the script into a new copy located in /data. Feel free to change this location to basically anything on the phone’s internal storage.

  5. Remove the temporary copy of the script (not essential, just tidy):

  6. Once this is done, navigate to the folder you copied the script into (on the phone’s storage), and add execute permissions using chmod.

  7. All that’s left is a bit of cleanup:

    This will remount the internal storage as read-only (as it was before).

As far as set-up is concerned, that’s (thankfully) it!

How to

Now for the best part – saving files. You will need to use Terminal Emulator (or equivalent) to do this. Be aware that you need to use su, otherwise the script won’t find the files due to permission restrictions.

  1. “Snap received!”
  2. Open Snapchat and wait until your snaps are loaded. Do not open them. I can’t stress this enough. If you open them, the script will not find them.
  3. Jump to your Terminal Emulator and run:

    This will execute the script and tell you what it does (as it’s doing it).

  4. Once that’s complete (assuming no errors), you can view your snaps as normal. A copy should have been made in the location specified by the script (in my example, this is /storage/extSdCard/snapchat/)

And that’s all there is to it! Unfortunately, this process needs to be repeated every time new snaps come in. However, in part 2, we’ll be automating the whole process using Tasker, meaning that once you open the app, your files are saved. Very sneaky.

Update: Part 2 is now available!

Note: Feel free to add comments/suggestions or point out errors in the comments section below. I will be maintaining this post.

Remove extra RSS feeds in WordPress

Here’s a WordPress snippet to remove RSS feeds for comments while keeping the main one available.

RSS Icon

RSS is super nifty. It’s a great way to keep on top of breaking news and articles from your favourite blogs and/or aggregators (I’ve got over 100 subscriptions in my feedly reader).

So it’s a wonder then that WordPress offers RSS feeds for comments on all your posts. I presume there’s a group of people who really like to track conversations, but in my experience, it’s the minority. This functionality should really be an additional (and not core) part of WordPress. If you want to prevent your site serving pointless additional RSS feeds, you’ll need to remove them from wp_head.

Removing them, however, is a two-step process. Add the following to your functions.php file:

And that’s it. The first two actions strip the RSS using remove_action with a high priority. The final add_action call tells WordPress to load our function when processing wp_head. This will go through and reinsert the main feed, leaving the comment feed out.

Congratulations! Your post conversations are now untrackable.

WordPress: Add page slug to body class (including parents!)

Are you using WordPress as a CMS? Do you want to style pages with CSS logically? You might want to try this.

By default, WordPress will inject the page and its ID into the body class. That’s great if you’re only running a single install, or if you really really don’t care what your CSS looks like.

Let’s face it – you care. Otherwise, you wouldn’t be here. Here’s a snippet that will inject the current page’s slug and all slugs of its parents into the body class of your HTML.

Add this to functions.php

And that’s it! You can then start chaining together page classes to target little overrides that your clients are probably hassling you about.