This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Auteur : Jean Rochard - http://terredigitale.fr - et merci stackoverflow :) | |
// 1) Obtenir la librairie PHP Google API | |
// git clone https://github.com/google/google-api-php-client.git | |
// 2) Paramétrer l'authentification | |
// Aller sur Google Cloud Console https://console.developers.google.com/ | |
// Créer un projet si besoin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.xml.* | |
// Méthode : | |
// 1) avec le plugin Export Featured Images, produire le fichier xml2 à partir du site source (liste d'images anciennes) | |
// 2) Puis les importer (sans rien changer au fichier) dans le site cible avec wp CLI : | |
// 2.1) wp plugin install wordpress-importer --activate | |
// 2.2) wp import fichier.xml --authors=skip (l'importer WP peut planter si temps de réponse trop long) | |
// 3) Puis produire avec le plugin WP Attachment Export le fichier xml1 (liste d'images nouvelles) sur le site cible | |
// 4) Produire avec l'exporter sur le site source la liste des posts (fichier xml3) | |
// Ce script compare et remplace dans le fichier xml3 l'ancienne valeur de l'id par la nouvelle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') | |
@Grab(group = 'net.sf.opencsv', module = 'opencsv', version = '2.3') | |
import au.com.bytecode.opencsv.* | |
import groovyx.net.http.HTTPBuilder | |
//URL du sitemap, même avec des sous pages XML (comme avec wordpress SEO) | |
def urlSitemap = 'http://www.domain.tld/sitemap_index.xml' | |
//Fichier csv de sortie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') | |
@Grab(group = 'net.sf.opencsv', module = 'opencsv', version = '2.3') | |
import au.com.bytecode.opencsv.* | |
import groovyx.net.http.AsyncHTTPBuilder | |
import groovy.json.JsonSlurper | |
//API KEY -> remplacer ligne 33 par votre clé personnelle à créer sur https://console.developers.google.com | |
//Fichier csv provenant de screaming frog (ou autre), il faut juste que l'URL soit dans la première colonne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') | |
import groovyx.net.http.AsyncHTTPBuilder | |
import groovyx.net.http.HTTPBuilder | |
//Requete initiale - A personnaliser | |
def query = ['agence','web','nantes'] | |
//Etude sur N premiers elements - A personnaliser | |
def nbRes = 10 |