User:Chlod/Tools

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

I make tools that are primarily for Wikipedia, and I've released majority of them as open-source. This page details the tools I've made and how to use them.


Tool Status Description Code Operation
Chlod's Wikipedia Tools     Active Used to host all tools on this page. See infobox Persistent
PAGASA Parser     Active Parses information from PAGASA's Severe Weather Bulletin (SWB) page and turns it into various formats. See infobox Persistent
JTWC Archiver     Active Parses information from the Joint Typhoon Warning Center's RSS feed and archives whichever version is available. See infobox Persistent (products)
Every 10 minutes (archiving)
Stroke Order Resolver     Active Takes a Kanji, Hiragana, or Katakana character, and returns the stroke order for that character. See infobox Persistent


Chlod's Wikipedia Tools[edit]

Chlod's Wikipedia Tools
Original author(s)Chlod Alejandro
Developer(s)Chlod Alejandro
Initial releaseJanuary 6, 2020; 13 months ago (2020-01-06)
Written inJavaScript, HTML
EngineModular Express Server using Node.js
Apache HTTP Server (for static files)
TypeStatic file server, Application programming interface
License
Websitehttps://wiki.chlod.net

wiki.chlod.net or Chlod's Wikipedia Tools (CWT) is the website where I host my rapid-testing userscript, and the tools I use for Wikipedia. Although it uses mostly open-source components, I see no use in exposing the modules I use to operate the web server. Thus, I keep the modules and managers of the server closed-source. However, if you would like a copy, feel free to send me an email or a message on my talk page.

CWT uses the Modular Express Server, a rapid-deployment Express server template I use to quickly make services available on the internet. The web server itself is open-source, and is available on GitHub. All userscripts found under /userscripts, namely my testing userscript, are also open-source. Getting the source is tedious, however, since I don't host the userscripts on GitHub. You will have to download them manually using cURL or wget.

History[edit]

CWT was initially hosted on my Apache HTTP Server, and only fed the main page and the test userscript. On 14 May 2020, I created and released the Modular Express Server, and transferred all the files onto the new Node-based server. This allowed me to execute JavaScript files as well, which meant I can use libraries I built for Wikipedia, and pipe them through specific endpoints.

Why not Toolforge[edit]

I prefer to use my own website rather than Toolforge, because I can make as much mistakes as I want without anyone looking at a revision history and calling me out for it, and so that I have a lot of freedom in making projects that benefit Wikipedia.

UPDATE (4 Jul 2020): I forgot my LDAP username and password. I literally can't use Toolforge at all.

UPDATE (31 Aug 2020): It turns out I have to register for Toolforge. I don't want to though, so I'll just keep everything inside of open-source repositories.

Feedback[edit]

If you found a security issue, please inform me through Special:Email, or by sending an email to wiki@chlod.net. I'll reply as soon as I can.

If you have any questions regarding the site, feel free to use my User talk:Chlod talk page. I'm open to suggestions and comments about my projects and tools. Please don't write hosting requests, though, since I only host projects I'm a part of or projects that I started.

PAGASA Parser[edit]

PAGASA Parser
Original author(s)Chlod Alejandro
Developer(s)Contributors to the PAGASA Parser project
Initial releaseMay 15, 2020; 9 months ago (2020-05-15)
Stable release
1.0.21 / October 21, 2020; 4 months ago (2020-10-21)
Repositoryhttps://github.com/ChlodAlejandro/PAGASA-parser
Written inJavaScript
EngineNode.js
TypeWeb scraper
LicenseApache 2.0 License

The PAGASA Parser is a Node.js library that parses information from PAGASA's Severe Weather Bulletin (SWB) page and turns it into various formats. Although its primary purpose is to convert the SWB into JSON, there is also an option to generate a TyphoonWarningsTable for the 2020 Pacific typhoon season page.

A live version of this project that runs as a website is available on https://wiki.chlod.net. The endpoints available are shown below. Sometimes the output of the endpoints appear incorrect. This is mostly due to inconsistencies with the Severe Weather Bulletin (grammatical or formatting errors), and these must be corrected manually.

Endpoints[edit]

Format Endpoint Description
JSON (link) Returns the SWB in JSON format.
TyphoonWarningsTable as JSON (link) Returns the SWB as a TyphoonWarningsTable, in JSON. This endpoint contains two fields, issues which detail the issues encountered while parsing the bulletin, and the actual template, template.
TyphoonWarningsTable (link) Returns the SWB as a TyphoonWarningsTable. This one returns it as text instead of JSON.
Atomfeed (link) Returns the SWB summary as an Atom feed, along with quick links.

Note: You can add wiki as a parameter to get a TyphoonWarningsTable instead.

JTWC Archiver[edit]

JTWC Archiver
Original author(s)Chlod Alejandro
Developer(s)Contributors to the JTWC Archiver
Initial releaseSeptember 28, 2020; 4 months ago (2020-09-28)
Stable release
1.1.0 / October 6, 2020; 4 months ago (2020-10-06)
Repositoryhttps://github.com/ChlodAlejandro/jtwc-archiver
Written inJavaScript
EngineNode.js
TypeWeb scraper
License
Websitehttps://wiki.chlod.net/jtwc

The JTWC Archiver is a Node.js script that parses information from the Joint Typhoon Warning Center's RSS feed and archives whichever version is available. This way, warnings issued by the JTWC which are not immediately added to an article may still be used. The script is run once every 10 minutes and archives each new product. Warnings older than 6 months are deleted.

Since all of these files are pretty much analogous to the actual JTWC warnings (since they are archives straight from the source), you can use them as a basis for citation. Do note that warnings are deleted after 6 months, which means you'll have to put the archive link on the Wayback Machine or some other form of web archive. The JTWC Archiver only serves as a temporary location for warnings — not a permanent one.

Note: As of October 12, I'm deciding whether to hold the archives forever or not. If the size doesn't exceed 100 MB after a year, I'll probably just hold the warnings forever.
Update (21 February 2021): The result was keep forever.

Usage[edit]

You can browse the Tropical Cyclone Formation Alert and Tropical Cyclone Warning texts and images at https://wiki.chlod.net/jtwc.

To cite a JTWC warning, use the following:

Tropical Storm 15W (Kujira) Warning No. 10 (Report). United States Joint Typhoon Warning Center. 29 September 2020. Archived from the original on 29 September 2020. Retrieved 29 September 2020.
{{Cite web|last=|first=|date={{subst:date}}|title=Tropical Storm 15W (Kujira) Warning No. 10|url=https://www.metoc.navy.mil/jtwc/products/wp1520web.txt|url-status=dead|archive-url=https://wiki.chlod.net/jtwc/text/2020-09-29-0200-wp1520web.txt|archive-date={{subst:date}}|access-date={{subst:date}}|publisher=United States Joint Typhoon Warning Center}}

You may choose to drop the publisher entirely, like I do.

"Tropical Storm 15W (Kujira) Warning No. 10". United States Joint Typhoon Warning Center. 29 September 2020. Archived from the original on 29 September 2020. Retrieved 29 September 2020.
{{Cite web|last=|first=|date={{subst:date}}|title=Tropical Storm 15W (Kujira) Warning No. 10|url=https://www.metoc.navy.mil/jtwc/products/wp1520web.txt|url-status=dead|archive-url=https://wiki.chlod.net/jtwc/text/2020-09-29-0200-wp1520web.txt|archive-date={{subst:date}}|access-date={{subst:date}}|publisher=United States Joint Typhoon Warning Center}}

At the end of each year, most of the links are replaced with more resilient backups. Information for that can be found below.

For local use[edit]

If you have Node.js and npm, you can just use npx (which should already be included with npm) to instantly execute the archiver.

(Optional) To install npx, use the following command

npm install -g npx

To run the archiver, use the following command

npx jtwc-archiver

This will create the following files. In this tree, the JTWC Archiver is run with the hypothetical wp4220 system, and was archived on September 28, 2020 at 00:00 UTC.

  • Ic folder 48px.svg Working directory
    • Ic insert drive file 48px.svg jtwc.rss — The latest copy of the JTWC RSS. This is used to check if there were any updates to the JTWC bulletin.
    • Ic folder 48px.svg jtwc_products — The folder containing all archived JTWC products.
      • Ic folder 48px.svg gif — The folder containing graphics for TCFAs and TCWs.
        • Ic photo 48px.svg 2020-09-28-0000-wp4220.gif — The TCFA/TCW graphic for wp4220 exactly at the moment of archiving.
        • Ic photo 48px.svg latest-wp4220.gif — The latest TCFA/TCW graphic for wp4220. This file is overwritten when a new graphic is issued.
      • Ic folder 48px.svg prog — The folder containing tropical cyclone prognostic reasonings.
        • Ic insert drive file 48px.svg 2020-09-28-0000-wp4220prog.txt — The prognostic reasoning for wp4220 exactly at the moment of archiving.
        • Ic insert drive file 48px.svg latest-wp4220prog.txt — The latest prognostic reasoning for wp4220. This file is overwritten when a new version is issued.
      • Ic folder 48px.svg text — The folder containing the TCFA and TCW warnings. These are usually the ones you cite.
        • Ic insert drive file 48px.svg 2020-09-28-0000-abioweb.txt — The advisories for the ABIO sector (the Indian Ocean). Since this text file is always provided when a system in that sector is active, it will be archived as well.
        • Ic insert drive file 48px.svg 2020-09-28-0000-abpwweb.txt — The advisories for the ABPW sector (the Pacific Ocean). Since this text file is always provided when a system in that sector is active, it will be archived as well.
        • Ic insert drive file 48px.svg 2020-09-28-0000-wp4220web.txt — The TCFA/TCW text for wp4220 exactly at the moment of archiving.
        • Ic insert drive file 48px.svg latest-abioweb.txt — The latest ABIO advisory. This file is overwritten when a new advisory is issued.
        • Ic insert drive file 48px.svg latest-abpwweb.txt — The latest ABPW advisory. This file is overwritten when a new advisory is issued.
        • Ic insert drive file 48px.svg latest-wp4220.txt — The latest TCFA/TCW text for wp4220. This file is overwritten when a new warning is issued.

url-status[edit]

The url-status parameter in {{Cite web}} should always be either dead (which emphasizes the archived version over the original) or unfit (which hides the original entirely). This is because the links that lead to a specific warning are time-sensitive and will change, and that the archived version is preferred over the live version (which may already be a new system entirely.)

Periodic archiving[edit]

At the end of each year, all collected products will be uploaded to the Internet Archive for permanent storage. This is primarily due to three reasons:

  1. The Internet Archive is a more generally-known (and thus, generally-trusted) website, which helps alleviate some concerns regarding SELFPUB or privacy-related concerns (even though the archiver website is just an Apache directory browser).
  2. Though the total file sizes for a year of operation are not significant, there might be a time where I am forced to clear out space from the server. If that happens, those files would then be permanently Not Found, and may not be accessible anymore.
  3. The JTWC Archiver, despite being an archive, was initially designed to be a temporary gathering place for bulletins while parts of an article have not yet been written. Since bulletins are changed rapidly, while articles may not be, there are instances where an old version is no longer available due to it being overwritten. Though I can theoretically hold all bulletins up until, say 2030, I'd like to form a sense of assurance that the bulletins would be stored "forever" by a capable and established archiving service.

Though those bulletins will be archived, it does not mean that they will be removed from the website immediately. They're put on the Internet Archive for that exact reason: archiving. It's meant to be a backup in case things go south on my end.

A list of archives is provided below.

  • 2020 (ATNIPCWP) – Archived on January 12, 2021  – TXTGIFPROG
    Note: The archive project started on September 28, 2020, and thus, this year only has products beginning September 28, 2020.

Stroke Order Resolver[edit]

Stroke Order Resolver
Original author(s)Chlod Alejandro
Developer(s)Contributors to the Stroke Order Resolver project
Initial releaseAugust 31, 2020; 5 months ago (2020-08-31)
Stable release
1.0.0 / August 31, 2020; 5 months ago (2020-08-31)
Repositoryhttps://github.com/ChlodAlejandro/wiki-kanji-stroke-order
Written inJavaScript
EngineNode.js
TypeWeb scraper
LicenseApache 2.0 License

The Stroke Order Resolver (SOR) is a Modular Express Server module that takes a Kanji, Hiragana, or Katakana character, and returns the stroke order for that character. It automatically falls back to the Kangxi radical stroke orders if it does not find a stroke order meant for Japanese characters.

The images are taken from the Wikimedia Commons Stroke Order Project.

Endpoints[edit]

Format Endpoint Description
PNG (link for 「一」)

(link for 「前」)

URL 「一」: https://wiki.chlod.net/kanji/%E4%B8%80

URL 「前」: https://wiki.chlod.net/kanji/%E5%89%8D

Returns the stroke order for the given character.

For 「一」, which has both a Japanese version (File:一-jbw.png) and the other version (File:一-bw.png), the Japanese version will be shown.

一-bw.png

Since 「前」 does not have a Japanese version (the file File:前-jbw.png does not exist), it will fallback to the other version (File:前-bw.png). 前-bw.png

PNG (as parameter) (link for 「前」) URL: https://wiki.chlod.net/kanji/?character=%E5%89%8D

Returns the stroke order for the 前 character. This version takes the character from a URL parameter instead of the path.

前-bw.png

GIF (link for 「前」) URL: https://wiki.chlod.net/kanji/%E5%89%8D?animated=1

Returns the stroke order for the 前 character (as a GIF).

To get the animated version, the parameter animated must be passed with the value of 1.前-order.gif

Error cases[edit]

If the SOR experiences an issue, it will return the appropriate response code and an image describing the issue. For example, if a character was not provided, a 400 response code will be returned, along with a picture describing the issue. If a character did not have an available image, the 404 code is returned.

If a 500 error was returned, there was an internal error in attempting to retrieve the appropriate image. The error is logged on the server side, so if you ping me on my talk page, I'll be able to check out what went wrong.