daily pastebin goal
32%
SHARE
TWEET

twitter_api_1.1

baptx Mar 5th, 2013 (edited) 151 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Access Twitter API 1.1 in browser.
  2. ** Get your access keys to use Twitter API 1.1: https://dev.twitter.com/docs/auth/tokens-devtwittercom
  3. ** Format JSON in Firefox: https://addons.mozilla.org/EN-us/firefox/addon/jsonview/
  4. ** You can change Twitter API URL and Twitter screen_name, then execute script from a trusted web page without CSP protection like about:blank in Firefox Scratchpad or any other browser console.
  5. */
  6.  
  7.  
  8. var script = document.createElement("script");
  9. script.setAttribute("src", "https://pastebin.com/raw/HFjqYLdG"); // http://oauth.googlecode.com/svn/code/javascript/oauth.js (down)
  10. document.body.appendChild(script);
  11. script.addEventListener("load", function() {
  12.     var script2 = document.createElement("script");
  13.     script2.setAttribute("src", "https://pastebin.com/raw/M0N8JKwf"); // http://pajhome.org.uk/crypt/md5/sha1.js
  14.     document.head.appendChild(script2);
  15.     script2.addEventListener("load", function() {
  16.         var url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
  17.         var accessor = {
  18.             token: "XXX",
  19.             tokenSecret: "XXX",
  20.             consumerKey : "XXX",
  21.             consumerSecret: "XXX"
  22.         };
  23.         var message = {
  24.             action: url,
  25.             method: "GET",
  26.             parameters: {screen_name: "baptx"}
  27.         };
  28.         OAuth.completeRequest(message, accessor);
  29.         OAuth.SignatureMethod.sign(message, accessor);
  30.         document.location = url + '?' + OAuth.formEncode(message.parameters);
  31.     });
  32. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top