0
votes

I'm trying to write a google apps script application that continuously saves recorded Xbox game clips to google drive.

Solution

Using the Xbox API you can grab the data directly from them. Specifically game clips using

/v2/{xuid}/game-clips

Xbox API however requires authentication and google apps script doesn't directly support that so here is a recommended third party solution.

OAuth1 for apps script

To get this project done here are other helpful links I used:

Add Url file to drive - https://gist.github.com/denilsonsa/8134679

External APIs for apps script - https://developers.google.com/apps-script/guides/services/external

Xbox API - https://xboxapi.com/documentation

Previous Question

I've messed around with "UrlFetchApp.fetch" to check and find content on a webpage.

Here is an example: Google Apps Script to grab data from webpage

var page = UrlFetchApp.fetch('http://oldschool.runescape.com/slu').getContentText();
var number = page.match(/There are currently ([0-9,]+)/)[1];

This is great for getting existing data, but in order for this app to work as designed I want it to continuously check for new content. Even if it checks every so often, it needs to look at the website and see a difference or change in order to run.

My Question: How can I get google apps script to check a website content for a change?

What I'm trying to do:

I want to use, XboxClips.com on a specific user and check for when a new clip is added. That way from there I can download it and add it to google drive.

1

1 Answers

2
votes

Scraping a website for content is considered unethical. However the site you've referenced leverages a publicly available rest api called the XBox One API.

Sign up for the service to get access to the api. Then you can poll the requisite endpoints using a time-based trigger (for more info on time-based triggers check the apps script documentation).