WikiCrawler/Tasks/Commons/RequestMassCatMove.cs
/// <summary>
/// Produces Commons Delinker move commands for a large list of categories.
/// </summary>
Produces Commons Delinker move commands for a large list of categories.
Produces Commons Delinker move commands for a large list of categories .
[BatchTask]
		public static void Do()
		{
			MediaWiki.Api commonsApi = new MediaWiki.Api(new Uri("https://commons.wikimedia.org"));
			List<string> output = new List<string>();
			foreach (string catname in File.ReadAllLines("C:/Users/Brian/Desktop/revival3.csv", Encoding.Default))
			{
				string catnameReal = catname.Replace('_', ' ');
				Console.WriteLine(catnameReal);
				MediaWiki.Article catpage = commonsApi.GetPage("Category:" + catnameReal);
				EasyWeb.crawlDelay = 0.1f;
				if (!catpage.missing && catpage.revisions != null && !catpage.revisions[0].text.Contains("{{Category redirect|"))
				{
					output.Add("{{move cat|" + catnameReal + "|" + catnameReal.Replace("revival", "Revival") +
						"|3=[[Commons:Categories for discussion/2012/01/Revival architectural styles]]|user=BMacZero}}");
				}
			}
			File.WriteAllLines("C:/Users/Brian/Desktop/requests3.txt", output.ToArray(), Encoding.Default);
		}
[ BatchTask ] public static void Do ( ) { MediaWiki . Api commonsApi = new MediaWiki . Api ( new Uri ( " " ) ) ; List < string > output = new List < string > ( ) ; foreach ( string catname in File . ReadAllLines ( " " , Encoding . Default ) ) { string catnameReal = catname . Replace ( ' ' , ' ' ) ; Console . WriteLine ( catnameReal ) ; MediaWiki . Article catpage = commonsApi . GetPage ( " " + catnameReal ) ; EasyWeb . crawlDelay = 0.1f ; if ( ! catpage . missing && catpage . revisions != null && ! catpage . revisions [ 0 ] . text . Contains ( " " ) ) { output . Add ( " " + catnameReal + " " + catnameReal . Replace ( " " , " " ) + " " ) ; } } File . WriteAllLines ( " " , output . ToArray ( ) , Encoding . Default ) ; }
Produces Commons Delinker move commands for a large list of categories.
Produces Commons Delinker move commands for a large list of categories .