Skip to content

Instantly share code, notes, and snippets.

@LulzAugusto
Created July 1, 2017 16:37
Show Gist options
  • Save LulzAugusto/eefb39812d7dc4994dfd154a0b2c0840 to your computer and use it in GitHub Desktop.
Save LulzAugusto/eefb39812d7dc4994dfd154a0b2c0840 to your computer and use it in GitHub Desktop.
Scraps movie titles and ratings from your filmow profile and exports them to a .csv file. https://filmow.com/usuario/<your_username>/ja-vi/
const movies = []
$('#movies-list li').each(function () {
console.log('scrapping this:', this)
const $ratingEl = $(this).find('.star-rating')
const rating = $ratingEl.length > 0 ? $ratingEl.data('originalTitle').split(' ')[1] : ''
const title = $(this).find('a.cover img').attr('alt').split('(')[1].split(')')[0]
movies.push([title, rating])
})
console.log(movies)
let csvContent = 'data:text/csv;charset=utf-8,'
movies.forEach((movie, index) => {
const dataString = movie.join(',')
csvContent += index < movies.length ? `${dataString}\n` : dataString
})
const encodedUri = encodeURI(csvContent)
window.open(encodedUri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment