Created
January 8, 2021 03:58
-
-
Save WWelna/0f4bdf4474ca390d2e1f1f3e3991968b to your computer and use it in GitHub Desktop.
How to mess with twitter via webdev console.
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
function getCookie(cname) { // Stolen From -> https://www.w3schools.com/js/js_cookies.asp | |
var name = cname + "="; | |
var decodedCookie = decodeURIComponent(document.cookie); | |
var ca = decodedCookie.split(';'); | |
for(var i = 0; i <ca.length; i++) { | |
var c = ca[i]; | |
while (c.charAt(0) == ' ') { | |
c = c.substring(1); | |
} | |
if (c.indexOf(name) == 0) { | |
return c.substring(name.length, c.length); | |
} | |
} | |
return ""; | |
} | |
test = new XMLHttpRequest(); | |
test.open('GET', 'https://api.twitter.com/1.1/users/show.json?screen_name=SCREEN_NAME', true); | |
test.withCredentials = true | |
test.setRequestHeader("authorization", "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"); | |
test.setRequestHeader("x-csrf-token", getCookie('ct0')); | |
test.setRequestHeader("x-twitter-auth-type", 'OAuth2Session') | |
test.onreadystatechange = function () { if(test.readyState == 4) alert(test.responseText) }; | |
test.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment