71 lines
1.9 KiB
Markdown
71 lines
1.9 KiB
Markdown
# Missing Link
|
|
|
|
A Wikipedia tool that finds articles which mention a topic by name but don't
|
|
link to it, then lets you add the missing wikilink directly from your browser.
|
|
|
|
Live at: https://edwardbetts.com/missinglink/
|
|
|
|
## How it works
|
|
|
|
1. Enter a Wikipedia article title.
|
|
2. The tool searches Wikipedia for articles that mention the title but don't
|
|
include a wikilink to it.
|
|
3. For each candidate, a diff shows the proposed edit in context.
|
|
4. Save the edit to Wikipedia with one click (requires a Wikipedia account),
|
|
or skip to the next candidate.
|
|
|
|
Redirect targets are handled automatically — if the title is a redirect,
|
|
the tool produces a piped link (e.g. `[[Possession of stolen goods|handling stolen goods]]`)
|
|
and excludes articles that already link to the redirect target.
|
|
|
|
## Setup
|
|
|
|
### Dependencies
|
|
|
|
```
|
|
pip install flask requests requests-oauthlib simplejson flipflop
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Copy `config/default.py` and add your Wikipedia OAuth credentials:
|
|
|
|
```python
|
|
SECRET_KEY = 'your-flask-secret-key'
|
|
CLIENT_KEY = 'your-oauth-consumer-key'
|
|
CLIENT_SECRET = 'your-oauth-consumer-secret'
|
|
```
|
|
|
|
Register an OAuth 1.0a consumer at
|
|
https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose
|
|
|
|
### Running locally
|
|
|
|
```
|
|
python web_view.py
|
|
```
|
|
|
|
The app listens on `http://0.0.0.0:8000`.
|
|
|
|
### Running under Apache mod_fcgid
|
|
|
|
The `run.fcgi` entry point is used by Apache. Touch it to reload the app
|
|
after code changes:
|
|
|
|
```
|
|
touch run.fcgi
|
|
```
|
|
|
|
## Project layout
|
|
|
|
```
|
|
web_view.py Flask application and routes
|
|
add_links/
|
|
api.py Wikipedia API client (read, search, diff)
|
|
match.py Link-finding and wikitext editing logic
|
|
core.py Search and candidate ranking
|
|
mediawiki_oauth.py OAuth session management
|
|
mediawiki_api.py Authenticated write API calls
|
|
templates/ Jinja2 HTML templates
|
|
static/ CSS and assets
|
|
```
|