Last active
June 6, 2017 14:35
-
-
Save digitalWestie/727edadd5ee179062fa02c70abba2705 to your computer and use it in GitHub Desktop.
An example of using the Blob / createObjectURL web API: bundles tweets as a CSV and presents a download link;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var csvDownload = function(){ | |
var t = $('p.TweetTextSize'); | |
var CSV = []; | |
for (i = 0; i < t.length; i++) { | |
CSV.push('"' + t[i].innerText + '"'); | |
} | |
CSV = CSV.join('\n'); | |
window.URL = window.webkitURL || window.URL; | |
var contentType = 'text/csv'; | |
var csvFile = new Blob([CSV], {type: contentType}); | |
var a = document.createElement('a'); | |
a.download = 'my.csv'; | |
a.href = window.URL.createObjectURL(csvFile); | |
a.textContent = 'Download CSV'; | |
a.style = "position:fixed; top:100px; left:100px; z-index:100000; background-color:black; color:white" | |
a.dataset.downloadurl = [contentType, a.download, a.href].join(':'); | |
document.body.appendChild(a); | |
}; | |
csvDownload(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go to twitter.com, hit F12, and copy pasta this into the console, et voila, csv download link with the current tweet texts.