Reorganise le code et ajoute la doc

This commit is contained in:
Shikiryu 2016-10-10 23:25:21 +02:00
parent 18f9d44410
commit 869c57b7f3
45 changed files with 85 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

18
README.md Normal file
View File

@ -0,0 +1,18 @@
# Tumblr2Shaarli
This project is just about saving your tumblr into a shaarli instance (new or used)
## Why?
Because I don't use Tumblr anymore, but used it a lot to bookmark and wanted to save it, self-hosted style.
I don't want to be dependant of an app anymore.
And Tumblr's API is easy to use, so, why not?
## How?
See the doc in [english](docs/EN.md)
Voir la documentation en [français](docs/FR.md)

33
docs/EN.md Normal file
View File

@ -0,0 +1,33 @@
# Install and use this script
1. Copy the content of `src` into your shaarli instance (at its root with index.php)
2. Copy `tumblr.ini.dev` to `tumblr.ini`
3. Fill the `tumblr.ini`'s variables
```ini
tumblr = xxx.tumblr.com # your tumblr URL (can be another domain if you paid for it)
api_key = xxx # your tumblr's API key (see below)
private = true # if links should be private or public
shaarli_dir = # leave blank if you followed this tutorial, else, the path to shaarli
```
4. Check if you got write right on the folder containing `import.php`
5. Launch : via browser or via command line
### Tumblr API key
You need to register an app in tumblr :
1. Log in your tumblr account
2. Go to https://www.tumblr.com/oauth/apps
3. Click `Register an application`
4. Fill all mandatory fields + `website` (even if it's not marked as mandatory, trust me, it is)
5. You got it ! **OAuth Consumer Key** !
6. Tips : you can find it again in https://www.tumblr.com/settings/apps
### Limitations
Tumblr's API can *only* retrieve 20 × 250 posts (I did the math, it's 5000)
This script does not resume import, so if you got more than 5k posts, it won't work.

32
docs/FR.md Normal file
View File

@ -0,0 +1,32 @@
# Installer et utiliser ce script
1. Copier le contenu de `src` dans votre instance Shaarli (à sa racine où il y a `index.php`)
2. Copier `tumblr.ini.dev` vers `tumblr.ini`
3. Remplir les variables de `tumblr.ini`
```ini
tumblr = xxx.tumblr.com # l'URL de votre tumblr (ça peut être un autre domaine si vous avez payé)
api_key = xxx # votre clef d'API tumblr (voir ci-dessous)
private = true # indique si les liens importés seront privés ou publiques
shaarli_dir = # laisser vide si vous avez suivi ce tuto, sinon, le chemin vers votre instance shaarli
```
4. Vérifier si vous avez les droits en écriture sur la base (datastore.php) et le dossier ou se trouve `import.php`
5. Lancer le script via votre navigateur ou par ligne de commande
### La clef d'API Tumblr
Vous avez besoin d'enrigistrer une app Tumblr :
1. Connectez vous sur votre compte tumblr
2. Allez sur https://www.tumblr.com/oauth/apps
3. Cliquez sur `Enregistrer une application`
4. Remplissez tous les champs obligatoires + `website` (même si c'est pas marqué obligatoire, ça l'est)
5. Vous l'avez votre clef ! **Clé du client (OAuth)** !
6. Astuce : vous pouvez la retrouver ici : https://www.tumblr.com/settings/apps
### Limitations
L'API de Tumblr ne peut récupérer *que* 20 × 250 posts (J'ai calculé, ça fait 5000)
Ce script ne permet pas de *compléter* un import depuis un post précis, donc si vous avez plus de 5k posts, ça ne fonctionnera pas (enfin, vous n'aurez pas tout)

1
src/vendor/bin/html-to-markdown vendored Normal file
View File

@ -0,0 +1 @@
../league/html-to-markdown/bin/html-to-markdown

View File

@ -1 +0,0 @@
../league/html-to-markdown/bin/html-to-markdown