You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For those of you who would also like to convert convert your "want to see" list into CSV format, this just requires a couple small tweaks to the index.js script. This also answers Issue #2 asked by @southisup.
If I get a response to this, I will submit a pull request which can allow for CSV for both myRatings and wts.
Otherwise you can just copy this gist into index.js. Cheers.
const rp = require('request-promise-native')
const fs = require('fs')
const { DateTime } = require('luxon')
const URI = 'https://www.rottentomatoes.com/napi/userProfile/wts/'
// Change to your Rotten Tomatoes user ID
const USER_ID = 'YOUR_ID'
async function getRatings(cursor) {
try {
let res = await rp({
uri: URI + USER_ID,
json: true,
qs: { endCursor: cursor },
})
console.log('Got a chunk.')
if (res.pageInfo.hasNextPage) {
let nextRatings = await getRatings(res.pageInfo.endCursor)
return res.wtsMedia.concat(nextRatings)
} else {
return res.wtsMedia
}
} catch (err) {
console.error('Oops, something went wrong!', err)
}
}
function createImportFile(ratings) {
let out = 'Title, Year'
ratings.forEach(r => {
if (!r) {
return
}
if (!r.item) {
return
}
let {
item: { title, releaseYear },
} = r
out += `"${title}",${releaseYear} \n`
})
fs.writeFile('importMeWTS.csv', out, 'utf8', err => {
if (err) console.log(err)
console.log('Import file created - importMeWTS.csv')
})
}
getRatings()
.then(ratings => {
fs.writeFileSync(
'rawRatings.json',
JSON.stringify(ratings, null, 2),
'utf8'
)
console.log('Raw ratings file created - rawRatings.json')
createImportFile(ratings)
})
.catch(err => console.error(err))
// let ratings = JSON.parse(fs.readFileSync('rawRatings.json'))
// createImportFile(ratings)
The text was updated successfully, but these errors were encountered:
For those of you who would also like to convert convert your "want to see" list into CSV format, this just requires a couple small tweaks to the index.js script. This also answers Issue #2 asked by @southisup.
If I get a response to this, I will submit a pull request which can allow for CSV for both myRatings and wts.
Otherwise you can just copy this gist into index.js. Cheers.
The text was updated successfully, but these errors were encountered: