GithubHelp home page GithubHelp logo

janosh / gatsby-source-google-scholar Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 3.0 429 KB

Gatsby source plugin that pulls metadata for scientific publications from Google Scholar

Home Page: https://npmjs.com/package/gatsby-source-google-scholar

License: MIT License

JavaScript 100.00%
gatsby google-scholar gatsby-source

gatsby-source-google-scholar's Introduction

gatsby-source-google-scholar

Gatsby source plugin for pulling metadata on scientific publications from Google Scholar.

See the example directory for the demo's source code.

Install

yarn add gatsby-source-google-scholar

Usage

Include the plugin in your gatsby-config and specify your queries.

// gatsby-config.js
module.exports = {
  siteMetadata: {
    ...
  },
  plugins: [
    {
      resolve: `gatsby-source-google-scholar`,
      options: {
        queries: [`richard feynman`, `albert einstein`],
      },
    },
  ],
}

Specify the metadata you need in a GraphQL query. Here's everything available.

{
  allGoogleScholar {
    nodes {
      id
      title
      url
      authors {
        name
        url
      }
      preEtAl
      postEtAl
      abstract
      year
      journal
      pdfUrl
      citedByCount
      citedByUrl
      relatedUrl
      allVersionsUrl
    }
  }
}

If you're only interested in the results for one of your queries, simply filter your results like so:

{
  pubs: allGoogleScholar(
    filter: { internal: { query: { eq: "richard feynman" } } }
  ) {
    nodes {
      title
      url
    }
  }
}

preEtAl and postEtAl are booleans indicating whether Google used ellipsis to signal additional authors before or after the list of authors matching your query, as in this example:

pre- and post et Al.

Here's an example of the data you'll get.

{
  "data": {
    "allGoogleScholar": {
      "nodes": [
        {
          "id": "3e2dc5b6-bab2-5b3f-a9be-a9c17c9a8b28",
          "title": "Can quantum-mechanical description of physical reality be considered complete?",
          "url": "https://journals.aps.org/pr/abstract/10.1103/PhysRev.47.777",
          "authors": [
            {
              "name": "A Einstein",
              "url": "https://scholar.google.com/citations?user=qc6CJjYAAAAJ&hl=en&oe=ASCII&oi=sra"
            },
            {
              "name": "B Podolsky",
              "url": null
            },
            {
              "name": "N Rosen",
              "url": null
            }
          ],
          "preEtAl": false,
          "postEtAl": false,
          "abstract": "In a complete theory there is an element corresponding to each element of reality. A sufficient condition for the reality of a physical quantity is the possibility of predicting it with certainty, without disturbing the system. In quantum mechanics in the case of two physical …",
          "year": 1935,
          "journal": "Physical review",
          "pdfUrl": "https://link.aps.org/pdf/10.1103/PhysRev.47.777",
          "citedByCount": 17404,
          "citedByUrl": "https://scholar.google.com/scholar?cites=8174092782678430881&as_sdt=2005&sciodt=0,5&hl=en&oe=ASCII",
          "relatedUrl": "https://scholar.google.com/scholar?q=related:odSh4BM2cHEJ:scholar.google.com/&scioq=albert+einstein&hl=en&oe=ASCII&as_sdt=0,5",
          "allVersionsUrl": "https://scholar.google.com/scholar?cluster=8174092782678430881&hl=en&oe=ASCII&as_sdt=0,5"
        },
        {
          "id": "32a662f0-142e-5f9b-b7fb-cb0d8b70bac6",
          "title": " Investigations on the Theory of the Brownian Movement",
          "url": "https://books.google.com/books?hl=en&lr=&id=X5iRDQAAQBAJ&oi=fnd&pg=PA139&dq=albert+einstein&ots=-VS5f8ayBe&sig=2bA1xJZq6QKA6htCxiKGsXV8a3o",
          "authors": [
            {
              "name": "A Einstein",
              "url": "https://scholar.google.com/citations?user=qc6CJjYAAAAJ&hl=en&oe=ASCII&oi=sra"
            }
          ],
          "preEtAl": false,
          "postEtAl": false,
          "abstract": "The\" Brownian movement\" was first described in 1828 by the botanist Robert Brown. While investigating the pollen of several different plants, he observed that pollen dispersed in water in a great number of small particles which he perceived to be in uninterrupted and …",
          "year": 1956,
          "journal": "",
          "pdfUrl": "https://www.hispacultur.org/book/516512150/download-investigations-on-the-theory-of-the-brownian-movement-albert-einstein.pdf",
          "citedByCount": 4345,
          "citedByUrl": "https://scholar.google.com/scholar?cites=13746912682491308133&as_sdt=2005&sciodt=0,5&hl=en&oe=ASCII",
          "relatedUrl": "https://scholar.google.com/scholar?q=related:Zeg0HkDYxr4J:scholar.google.com/&scioq=albert+einstein&hl=en&oe=ASCII&as_sdt=0,5",
          "allVersionsUrl": "https://scholar.google.com/scholar?cluster=13746912682491308133&hl=en&oe=ASCII&as_sdt=0,5"
        }
      ]
    }
  }
}

Known Issues

The HTTP response received from request seems to break HTML entity encoding. As a result some special characters (like German umlauts) are currently not displayed correctly. PRs welcome!

gatsby-source-google-scholar's People

Contributors

drakenza avatar janosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gatsby-source-google-scholar's Issues

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.