Newsworthy And Non-Newsworthy Searches

I stumbled upon this interesting article from The Verge, where YouTube modified its search results by tagging Brie Larson as part of the news: https://www.theverge.com/2019/3/8/18255265/brie-larson-youtube-captain-marvel-mcu-algorithm-review-bomb-trolls .

In short, YouTube searches for Brie Larson were initially returning videos about boycotting the movie Captain Marvel. By tagging Larson as a news item, the search results immediately changed to reflect videos from authoritative news services: ABC, CBS, Entertainment Tonight, and so forth. This is a useful function for most people searching, as most users will be looking for late night interviews, news media reports, and so forth.

A search for Brie Larson on YouTube returns videos from news services – note the Top news notice on the top of the image.

As this article demonstrates, search context can be very important. To fully learn about a topic, it’s vitally important to search Google, review the results, then make more searches that are informed by your previous searches. Let’s say you’re a journalist, and want to write about Brie Larson. You’d start out with a general Google and YouTube search about Larson. Then by reviewing the search results (at least the first 2-3 pages of results) you’d learn that there was controversy over Larson playing Captain Marvel. Then you could search for Brie Larson Captain Marvel. Then Brie Larson controversy.

Possibly you might dig a bit deeper and search for Brie Larson boycott. After you’ve exhausted that route, follow other discussion threads: for example, searching for Brie Larson fans, or Captain Marvel box office numbers.

A search for Brie Larson boycott reveals further information for an aspiring journalist. Why is there a boycott? Further Google searching would help.

There are numerous ways that a good journalist could dig up even more information about this issue – for example, why not use Google’s date searching feature to exclude recent news reports and only search earlier postings?

Googling current-news topics can be difficult, as you’ll see many current news items pop up on your results. With intelligent Googling, you can extract useful knowledge about almost anything.

Extracting The Latest Video From YouTube’s Data API

Here’s a simple function demonstrating how to access the YouTube Data API. This code extracts the title and URL of the latest video uploaded by a given user, then records the information to logs.

The title and URL of the video are contained in the variables video_title and video_url . This code snippet pulls the latest video uploaded by the user TEDtalksDirector – this can be changed by editing the url variable.

/**
 * In this method, we'll pull the latest video uploaded 
 * from a specific user.
 * 
 * @throws IOException May be thrown by the low-level URLFetch service.
 */
public void getYouTubeVideo() {
    try {
        //This is the API url for videos uploaded by the user TEDtalksDirector
        URL url = new URL("http://gdata.youtube.com/feeds/api/users/TEDtalksDirector/uploads?prettyprint=true&v=2&alt=jsonc");
        //Have the URLFetch library grab the contents of the URL.
        HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(url);
        String response_contents = new String(response.getContent());
        //If the response was successful, process the returned JSON.
        //This line goes through the JSON tree to find and retrieve 
        //the JSON object representing the last uploaded video.
        JSONArray video_list = (new JSONObject(response_contents)).getJSONObject("data").getJSONArray("items");
        JSONObject latest_video = video_list.getJSONObject(0);
        //Pull out the video title and url.
        String video_title = latest_video.getString("title");
        String video_url = latest_video.getJSONObject("player").getString("default");
        System.out.println("Latest YouTube Video Title: " + video_title + " URL: " + video_url);
    }//end try 
    catch (IOException e) {
        System.err.println("IOException while retrieving YouTube data: " + e.getMessage());
    }
    catch (JSONException e) {
        System.err.println("JSONException while parsing YouTube response: " + e.getMessage());
    }
}//end getYouTubeVideo()

To use this code, you’ll need to add in the org.json library and import the following packages:

import java.net.URL;
import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
import org.json.*;
import java.io.IOException;