1
0

Site_meta.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html dir="ltr">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  5. <title>Dev/Command-line/Site meta - XOWA</title>
  6. <link rel="shortcut icon" href="https://gnosygnu.github.io/xowa/xowa_logo.png" />
  7. <link rel="stylesheet" href="https://gnosygnu.github.io/xowa/xowa_common.css" type="text/css">
  8. <style data-source="xowa" type="text/css">
  9. .console {font-family: monospace; color: #EEEEEE ; background-color: black ; border: medium solid black;}
  10. .code
  11. ,.path
  12. ,.url {font-family: monospace; color: black ; background-color: #f9f9f9 ; border: medium solid #f9f9f9;}
  13. .bold {font-weight: 900;}
  14. </style>
  15. </head>
  16. <body class="mediawiki ltr sitedir-ltr ns-0 ns-subject skin-vector action-submit vector-animateLayout" spellcheck="false">
  17. <div id="mw-page-base" class="noprint"></div>
  18. <div id="mw-head-base" class="noprint"></div>
  19. <div id="content" class="mw-body">
  20. <h1 id="firstHeading" class="firstHeading"><span>Dev/Command-line/Site meta</span></h1>
  21. <div id="bodyContent" class="mw-body-content">
  22. <div id="siteSub">From XOWA: the free, open-source, offline wiki application</div>
  23. <div id="contentSub"></div>
  24. <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr">
  25. <div id="toc" class="toc">
  26. <div id="toctitle" class="toctitle">
  27. <h2>
  28. Contents
  29. </h2>
  30. </div>
  31. <ul>
  32. <li class="toclevel-1 tocsection-1">
  33. <a href="#Background"><span class="tocnumber">1</span> <span class="toctext">Background</span></a>
  34. </li>
  35. <li class="toclevel-1 tocsection-2">
  36. <a href="#Process"><span class="tocnumber">2</span> <span class="toctext">Process</span></a>
  37. </li>
  38. </ul>
  39. </div>
  40. <p>
  41. XOWA can download the metadata for the Wikimedia wikis
  42. </p>
  43. <h2>
  44. <span class="mw-headline" id="Background">Background</span>
  45. </h2>
  46. <p>
  47. Wikimedia exposes an API for accessing the meta-data for a given wiki. For example, for English Wikipedia, the following will return most of the meta-data around the wiki installation.
  48. </p>
  49. <pre class='code'>
  50. https://en.wikipedia.org/w/api.php?action=query&amp;meta=siteinfo&amp;siprop=general|namespaces|statistics|interwikimap|namespacealiases|specialpagealiases|libraries|extensions|skins|magicwords|functionhooks|showhooks|extensiontags|protocols|defaultoptions|languages
  51. </pre>
  52. <p>
  53. XOWA can call this API to download metadata for each wiki and save them in a database for data-processing. XOWA uses this info to resolve namespaces, but it will also incorporate other metadata from this API in future releases.
  54. </p>
  55. <h2>
  56. <span class="mw-headline" id="Process">Process</span>
  57. </h2>
  58. <p>
  59. Assuming you are on a Windows system with XOWA installed at <code>C:\xowa</code>
  60. </p>
  61. <ul>
  62. <li>
  63. Create a plain text-file called "C:\xowa\build_site_meta.gfs"
  64. </li>
  65. <li>
  66. Save the following text to the file:
  67. </li>
  68. </ul>
  69. <pre class='code'>
  70. app.bldr.pause_at_end_('n');
  71. app.scripts.run_file_by_type('xowa_cfg_app');
  72. app.bldr.cmds {
  73. // NOTE: wiki doesn't matter; just use any wiki name that is on your system
  74. add('simple.wikipedia.org', 'util.site_meta') {
  75. // path of the database to generate; default is C:\xowa\bin\any\xowa\cfg\wiki\site_meta.sqlite3
  76. db_url = 'C:\xowa\site_meta__enwiki.sqlite3';
  77. // skip any wikis which have been downloaded after this time. default is now() - 1 day
  78. // the purpose of this argument is to avoid recalling the api if it's already been called recently.
  79. // for example, if the script runs for 800 wikis and fails for 3 wikis,
  80. // you can rerun the script again and it will only download the 3 failed ones; not all 800
  81. cutoff_time = '2015-07-01';
  82. // list of wikis to download; note that each wiki must be separated by a new-line. default is all wikis listed in [[Dashboard/Import/Online]]
  83. wikis =
  84. 'en.wikipedia.org
  85. en.wiktionary.org';
  86. }
  87. }
  88. app.bldr.run;
  89. </pre>
  90. <ul>
  91. <li>
  92. Run the file with the following:
  93. </li>
  94. </ul>
  95. <pre class='code'>
  96. java -jar xowa_windows.jar --app_mode cmd --cmd_file C:\xowa\build_site_meta.gfs
  97. </pre>
  98. <ul>
  99. <li>
  100. Open C:\xowa\site_meta__enwiki.sqlite3 in a sqlite shell and run the following:
  101. </li>
  102. </ul>
  103. <pre class='code'>
  104. SELECT * FROM site_statistic;
  105. </pre>
  106. </div>
  107. </div>
  108. </div>
  109. <div id="mw-head" class="noprint">
  110. <div id="left-navigation">
  111. <div id="p-namespaces" class="vectorTabs">
  112. <h3>Namespaces</h3>
  113. <ul>
  114. <li id="ca-nstab-main" class="selected"><span><a id="ca-nstab-main-href" href="index.html">Page</a></span></li>
  115. </ul>
  116. </div>
  117. </div>
  118. </div>
  119. <div id='mw-panel' class='noprint'>
  120. <div id='p-logo'>
  121. <a style="background-image: url(https://gnosygnu.github.io/xowa/xowa_logo.png);" href="http://xowa.org/" title="Visit the main page"></a>
  122. </div>
  123. <div class="portal" id='xowa-portal-home'>
  124. <h3>XOWA</h3>
  125. <div class="body">
  126. <ul>
  127. <li><a href="http://xowa.org/index.html" title='Visit the main page'>Main page</a></li>
  128. <li><a href="http://xowa.org/screenshots.html" title='See screenshots of XOWA'>Screenshots</a></li>
  129. <li><a href="https://www.youtube.com/watch?v=q0qbXYXEH6M" title="See a video of XOWA Desktop in action">Video</a></li>
  130. <li><a href="http://xowa.org/home/wiki/Help/Download_XOWA.html" title='Download the XOWA application'>Download XOWA</a></li>
  131. <li><a href="http://xowa.org/home/wiki/Dashboard/Image_databases.html" title='Download offline wikis and image databases'>Download wikis</a></li>
  132. </ul>
  133. </div>
  134. </div>
  135. <div class="portal" id='xowa-portal-started'>
  136. <h3>Getting started</h3>
  137. <div class="body">
  138. <ul>
  139. <li><a href="http://xowa.org/home/wiki/App/Setup/System_requirements.html" title='Get XOWA&apos;s system requirements'>Requirements</a></li>
  140. <li><a href="http://xowa.org/home/wiki/App/Setup/Installation.html" title='Get instructions for installing XOWA'>Installation</a></li>
  141. <li><a href="http://xowa.org/home/wiki/App/Import/Simple_Wikipedia.html" title='Learn how to set up Simple Wikipedia'>Simple Wikipedia</a></li>
  142. <li><a href="http://xowa.org/home/wiki/App/Import/English_Wikipedia.html" title='Learn how to set up English Wikipedia'>English Wikipedia</a></li>
  143. <li><a href="http://xowa.org/home/wiki/App/Import/Other_wikis.html" title='Learn how to set up other Wikipedias'>Other Wikipedias</a></li>
  144. </ul>
  145. </div>
  146. </div>
  147. <div class="portal" id='xowa-portal-android'>
  148. <h3>Android</h3>
  149. <div class="body">
  150. <ul>
  151. <li><a href="http://xowa.org/home/wiki/Android/Setup.html" title='Setup XOWA on your Android device'>Setup</a></li>
  152. <li><a href="https://www.youtube.com/watch?v=jsMTBxGweUw" title="See a video of XOWA Android in action">Video</a></li>
  153. </ul>
  154. </div>
  155. </div>
  156. <div class="portal" id='xowa-portal-help'>
  157. <h3>Help</h3>
  158. <div class="body">
  159. <ul>
  160. <li><a href="http://xowa.org/home/wiki/Help/About.html" title='Get more information about XOWA'>About</a></li>
  161. <li><a href="http://xowa.org/home/wiki/Help/Contents.html" title='View a list of help topics'>Contents</a></li>
  162. <li><a href="http://xowa.org/home/wiki/Help/Media.html" title='Read what others have written about XOWA'>Media</a></li>
  163. <li><a href="http://xowa.org/home/wiki/Help/Feedback.html" title='Questions? Comments? Leave feedback for XOWA'>Feedback</a></li>
  164. </ul>
  165. </div>
  166. </div>
  167. <div class="portal" id='xowa-portal-blog'>
  168. <h3>Blog</h3>
  169. <div class="body">
  170. <ul>
  171. <li><a href="http://xowa.org/home/wiki/Blog.html" title='Follow XOWA''s development process'>Current</a></li>
  172. </ul>
  173. </div>
  174. </div>
  175. <div class="portal" id='xowa-portal-links'>
  176. <h3>Links</h3>
  177. <div class="body">
  178. <ul>
  179. <li><a href="http://dumps.wikimedia.org/backup-index.html" title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
  180. <li><a href="https://archive.org/search.php?query=xowa" title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
  181. <li><a href="http://en.wikipedia.org" title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
  182. </ul>
  183. </div>
  184. </div>
  185. <div class="portal" id='xowa-portal-donate'>
  186. <h3>Donate</h3>
  187. <div class="body">
  188. <ul>
  189. <li><a href="https://archive.org/donate/index.php" title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->
  190. <li><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector" title="Support Wikipedia!">Wikipedia</a></li>
  191. <li><a href="http://xowa.org/home/wiki/Help/Donate.html" title="Support XOWA!">XOWA</a></li>
  192. </ul>
  193. </div>
  194. </div>
  195. </div>
  196. </body>
  197. </html>