πŸŽ’

Right-click Google Scholar Search (3 min)

🚧

Under construction: this tutorial is currently being updated for PixieBrix release 1.4.0

🍎

Before you begin this tutorial, make sure you've completed the Quick Start Guide

In this tutorial, we'll automate a simple process: searching text you highlight in Google Scholar.

We'll use this PBS page to develop our workflow. There is a video at the end of of this tutorial demonstrating what’s covered in the text.

1. Configure a Right-click Button

Open the Page Editor

Start by navigating your browser to this PBS article: A Duke Named Ellington. Then, open the PixieBrix Page Editor, and grant PixieBrix access to the page.

Configure a Context Menu Item

  • Click Add in the top left of the Page Editor and choose Context Menu
  • In the Menu Item tab, replace "Context Menu Item" with "%s - Google Scholar"
πŸ’‘

The "%s" portion will configure the caption so it dynamically changes based on the text you highlight. Note this convention is different than the mustache braces {{ used in other places in PixieBrix. It's because for context menu items, Chrome is filling in the selected text, not PixieBrix.

  • To test your context menu configuration:
    • Highlight Duke Ellington on the webpage
    • Right click to expand the context menu. It should look like this
    • image

Configure Where the Context Menu Appears

  • Go to the Location tab
  • In the Document URL Pattern section, click All URLs. This tells PixieBrix to show the context menu item on any webpage you visit
  • Scroll down to the Advanced Configuration. In the Automatic Permissions Match Pattern section, click All URLs. This gives PixieBrix access to a page without you first clicking the context menu

2. Identify the Target Data

  • Go to the Data tab
  • Scroll down to where you see two pieces of information:
  • image
ℹ️

Context Menus always include a "Context menu reader" that provides the documentUrl and information about the selected element. In our case selectionText will provide the selected text

  • In the next step we'll configure an action to search the text selection in Google Scholar
πŸ’‘

You can click the πŸ“ƒ icon next to the property path to copy it to your clipboard. This will come in handy when configuring the Search action in the next section of this tutorial.

3. Search Google Scholar

Define Your Search Parameters

Next we'll figure out how to construct a search URL for Google Scholar.

In a separate tab, go to the Google Scholar homepage and search for "Louis Armstrong"

image

After you click "Enter" you will be taken to search results page, which has this URL:

https://scholar.google.com/scholar?hl=en&as_sdt=0%2C33&q=Louis+Armstrong&btnG=

Toward the end of the URL you will see q=Louis+Armstrong. Google Scholar uses "q" as the search parameter.

Configure the Search

  • Go to the Action tab
  • Under Recommended Bricks, select Open a tab
    • image
    • In the URL put https://scholar.google.com/scholar?
    • Click Add a Property. Delete "property1" and replace it with "q", the search parameter we identified in the URL
    • In the Value text box type "sectionText".
    • image

4. Test Your Search

To test your Search, highlight "Duke Ellington" in the PBS article, and click. A new tab should open to the following URL: https://scholar.google.com/scholar?q=Duke+Ellington. Click Save in the Page Editor, and try different searches on different web pages.