GithubHelp home page GithubHelp logo

vipulnaik / wikipediaviews Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 1.0 2.31 MB

Underlying code of https://wikipediaviews.org with sensitive parts redacted

Home Page: https://wikipediaviews.org

License: Other

PHP 94.38% Python 2.69% NASL 2.93%

wikipediaviews's People

Contributors

riceissa avatar vipulnaik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

riceissa

wikipediaviews's Issues

Detect redirects (Cumulative Facebook shares)

When submitting "Cumulative Facebook shares", the numbers for redirects are the same as those of the destination pages because Facebook merges redirects with the actual articles. This is confusing unless you can tell that a page is a redirect.

For instance submit the following pages:

Quora
Timeline of Quora

at http://wikipediaviews.org/multiplemonths.php (I would post a link but Wikipedia Views can't do this currently).

Notice that the "Cumulative Facebook shares" are the same because the timeline page redirects to the main page.

I would suggest coloring redirects in rgb(255, 137, 33) (#FF8921), which is the color Wikipedia uses in the "Display links to disambiguation pages in orange" gadget.

Redirects can be detected using the MediaWiki API. Compare https://en.wikipedia.org/w/api.php?action=query&titles=Timeline%20of%20Quora&redirects&format=jsonfm

{
    "batchcomplete": "",
    "query": {
        "redirects": [
            {
                "from": "Timeline of Quora",
                "to": "Quora",
                "tofragment": "Timeline"
            }
        ],
        "pages": {
            "26749224": {
                "pageid": 26749224,
                "ns": 0,
                "title": "Quora"
            }
        }
    }
}

with https://en.wikipedia.org/w/api.php?action=query&titles=Quora&redirects&format=jsonfm:

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "26749224": {
                "pageid": 26749224,
                "ns": 0,
                "title": "Quora"
            }
        }
    }
}

See https://www.mediawiki.org/wiki/API:Query#Resolving_redirects for more.

"There are no pages"

Using the "Alternative page specification", only the tag method works. The "category", "user" and 'linking page" methods return "There are no pages for the . . .-language combination."

ETA: I only tested this on http://wikipediaviews.org/

Fix quote escaping issues

Single quotes aren't properly escaped when making SQL insertions, causing some inconsistent behavior. Don't HTML-encode, just escape.

Add normalization option for non-HTML output

There is currently a normalization option, "Daily average (for days in the month when stats are available)", for HTML output. This option should be available for other output formats as well.

Switch to more hierarchical file inclusion to make dependencies between files clearer

Currently we have pretty much a giant pool of functions split across many files, and it's often not clear what file a given function being called belongs to. This is okay for the current codebase size but is not good software engineering practice. Figure out how to fix this within PHP, otherwise just add comments identifying function sources.

Switch function, variable names to camel case

This should require a 2-3 day concentrated stretch to make sure there is no break in dependencies/compatibility, but it will benefit the codebase by making it more human-readable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.