fork download
  1. twoChannelPicker[url_,n_]:=Module[{urlToDat,txtToDisplay,txt},
  2.  
  3. urlToDat[urlx_]:=Module[{server,board,thread},
  4.  
  5. {server,board,thread}=StringSplit[urlx,"/"]//
  6. {#[[3]],#[[6]],#[[7]]}&;
  7.  
  8. "http://"<>server<>"/"<>board<>"/"<>"dat"<>"/"<>thread<>".dat"
  9. ];
  10.  
  11. txtToDisplay[txtx_,nx_]:=Module[{fmt1,fmt2},
  12.  
  13. fmt1[lst_]:=lst//
  14. ToString[nx]<>" "<>
  15. "名前: "<>#[[1]]<>" "<>
  16. "Mail: "<>#[[2]]<>" "<>
  17. "投稿日: "<>#[[3]]<>" "<>#[[4]]&;
  18.  
  19. fmt2[str_]:=str//
  20. StringReplace[#,
  21. {"<br> "->"\n\t",
  22. RegularExpression["<(\"[^\"]*\"|'[^']*'|[^'\">])*>"]->"",
  23. "&gt;"->">",
  24. "&lt;"->"<",
  25. "&amp;"->"&"}]&//
  26. StringReplace[#,
  27. RegularExpression["^"]->"\t"]&;
  28.  
  29. txtx//
  30. #[[nx]]&//
  31. {Append[StringSplit[#[[1]],"<>"],#[[2]]],
  32. Apply[StringJoin,
  33. Riffle[Map[ToString,#[[4;;Length[#]-1]]]," "]]}&//
  34. fmt1[#[[1]]]<>"\n"<>"\n"<>fmt2[#[[2]]]&
  35. ];
  36.  
  37. txt=url//
  38. urlToDat//
  39. Import[#,CharacterEncoding->"ShiftJIS"]&;
  40.  
  41. txt//
  42. txtToDisplay[#,n]&
  43. ];
Not running #stdin #stdout 0s 0KB
stdin
twoChannelPicker["http://t...content-available-to-author-only...h.net/test/read.cgi/tech/1357191974/", 419]
stdout
Standard output is empty