1
$\begingroup$

I am trying to import Wikipedia Edit History. The code that I am using is the following:

 WikipediaComment = 
      Map[Last, 
       StringSplit[
        Rest@StringSplit[
          Import["https://it.wikipedia.org/w/index.php?title=Stephen_Wolfram&action=history"], "(corr|prec)"], ". ."]];

WikipediaCommentNew = 
 Reverse[Most[
   StringTrim /@ (Map[
      StringReplace[#, 
        "(annulla)" | "(" | ")" | "\[RightArrow]" | "\[LeftArrow]" -> 
         ""] &, WikipediaComment])]]

But it does not work. What I would like to do is splitting date and comments, creating an association between them, in order to plot them separately and try to do some sentiment analysis.

Also this part seems not working:

WikipediaDate = 
 Map[Take[#, 1] &, 
  StringSplit[StringSplit[Import["https://it.wikipedia.org/w/index.php?title=Stephen_Wolfram&&\offset=&limit=455&action=history"], "( corr | prec )"],  ". . "]]

WikipediaDateList = 
 Reverse[Interpreter[
    "Date"][(StringRiffle /@ (((StringSplit /@ WikipediaDate)[[All, 
          All, {2, 3, 4}]])[[All, 1]]))]]

Could you please tell me what I am doing wrong?

Many thanks

$\endgroup$
  • $\begingroup$ Remove Rest from the first code block and Most from the second? $\endgroup$ – kglr Jul 28 at 14:35
  • $\begingroup$ thanks kglr. Now it works, but the second part of the code (I just added in the post) does not work. This part should help me to extract information about the date of edits $\endgroup$ – Val Jul 28 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.