Remplace les liens vers Allociné en utilisant les modèles {{Allocine name}} ou {{Allocine title}}.
Buts :

  1. Uniformiser/Harmoniser
  2. Ajouter (automatiquement, par le modèle), l'attribut nopub=1 dans l'URL, ce qui permet de sauter la page de pub intersticielle visible à la première visite.


(type 1 seulement, pour l'instant)
Tools > Make Module. Cocher Enabled, C# 2.0 sélectionné, rentrer code, cliquer sur Make Module, puis sur Done si pas d'erreur. Ensuite, lancer en désactivant le Find and replace.

public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
        {
            Regex title = new Regex (@"([^\(]+) \((films?|[0-9]{4}|films?, [0-9]{4}|saga)\)", RegexOptions.IgnoreCase);
            Match myMatch = title.Match (ArticleTitle);
            String Title = myMatch.Groups[1].ToString ();
            String Title2 = "|titre="+Title;
            if (Title == String.Empty)
               Title2 = "";
            Regex film = new Regex(@"^\*\040?(\{\{[^\}]+\}\})?\040?('')?\[?http://www\.allocine\.fr/film/fichefilm_gen_cfilm=([0-9]+)\.html?/?\040?.*\]?[^\n]*", RegexOptions.Multiline);
            ArticleText = film.Replace(ArticleText, "* {{Allocine title|id=$3"+Title2+"}}"); 
            Skip = false;
            Summary = "Remplacement lien Allociné par modèle {{Allocine title}} — ";
 
            return ArticleText;
        }

Personnes

modifier
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
        {
            Regex title = new Regex (@"([^\(]+) \((acteur|actrice|réalisateur|réalisatrice).*\)");
            Match myMatch = title.Match (ArticleTitle);
            String Name = myMatch.Groups[1].ToString ();
            String Name2 = "|nom="+Name;
            if (Name == String.Empty)
               Name2 = "";
            Regex personne = new Regex(@"^\*\040?(\{\{[^\}]+\}\})?\040?('')?\[?http://www\.allocine\.fr/personne/fichepersonne_gen_cpersonne=([0-9]+)\.html?/?\040?.*\]?[^\n]*", RegexOptions.Multiline);
            ArticleText = personne.Replace(ArticleText, "* {{Allocine name|id=$3"+Name2+"}}");
 
            Skip = false;
            Summary = "Remplacement lien Allociné par modèle {{Allocine name}} — ";
 
            return ArticleText;
        }





(Films)

modifier
1) Find →     \*\s?(\{\{[^\}]+\}\})?\s?('')?\[http://www\.allocine\.fr/film/fichefilm_gen_cfilm=([0-9]+)\.html? .*\].*
2) Replace →  * {{Allocine title|id=$3}}

(Personnes)

modifier
1) Find →     \*\s?(\{\{[^\}]+\}\})?\s?('')?\[http://www\.allocine\.fr/personne/fichepersonne_gen_cpersonne=([0-9]+)\.html? .*\].*
2) Replace →  * {{Allocine name|id=$3}}


La Règle (obsolète)

modifier
1) Find →     http://www\.allocine\.(fr|com)/([a-z]+)/([a-z]+)_gen_c([a-z]+)=([0-9]+)\.html?
2) Replace →  http://www.allocine.$1/$2/$3_gen_c$4=$5&nopub=1.html
           
✔️ OK pour tout.
1) Find →     http://www\.allocine\.(fr|com)/([a-z]+)/([a-z]+)\.html?c([a-z]+)=([0-9]+)
2) Replace →  http://www.allocine.$1/$2/$3.html?c$4=$5&nopub=1.html
✔️ OK pour tout.

Général

modifier

http://www.allocine.fr/***/***_gen_c***=***.htmlhttp://www.allocine.fr/***/***_gen_c***=***.html

http://www.allocine.fr/***/***.html?c***=***http://www.allocine.fr/***/***.html?c***=***