Skip to content

Instantly share code, notes, and snippets.

View insin's full-sized avatar
⚠️
Cannot read property 'status' of undefined

Jonny Buchanan insin

⚠️
Cannot read property 'status' of undefined
View GitHub Profile
@insin
insin / README.md
Last active December 19, 2025 20:51
Preview "Popular" sort for the Following timeline in Twitter Web
  1. Go to a page other than Home (e.g. Notifications)
  2. Refresh the tab so you don't have any Home timeline Tweets cached
  3. Paste the code from patch.js into the F12 developer Console
  4. Your Following feed will now be sorted by "Popular" until you next refresh the tab
@insin
insin / script.js
Created August 13, 2025 18:13
Disable a feature flag on Twitter
let $reactRoot = document.querySelector('#react-root')
let wrapped = $reactRoot.firstElementChild.wrappedJSObject || $reactRoot.firstElementChild
let reactPropsKey = Object.keys(wrapped).find(key => key.startsWith('__reactProps'))
let featureSwitches = wrapped[reactPropsKey].children?.props?.children?.props?.contextProviderProps?.featureSwitches
let isTrue = featureSwitches.isTrue
featureSwitches.isTrue = (flag) => {
if (flag == 'rweb_age_assurance_flow_enabled') return false
return isTrue(flag)
}
@insin
insin / download-transcript.js
Last active July 25, 2025 18:30
Download YouTube Transcript - open the Transcript panel on a video then execute this function in the developer tools console
function downloadTranscript() {
let $segments = document.querySelector('.ytd-transcript-search-panel-renderer #segments-container')
let sections = []
let parts = []
for (let $el of $segments.children) {
if ($el.tagName == 'YTD-TRANSCRIPT-SECTION-HEADER-RENDERER') {
if (parts.length > 0) {
sections.push(parts.join(' '))
parts = []
@insin
insin / 1 - proxy to log translations.js
Created May 24, 2025 06:31
Going from "I am so S.M.R.T!" to "how have I been so stupid?" just like that
window.fetch = new Proxy(window.fetch, {
apply(target, thisArg, argArray) {
let promise = Reflect.apply(target, thisArg, argArray)
let url = argArray[0] instanceof Request ? argArray[0].url : argArray[0]
if (url.includes('reel_item_watch')) {
console.log('intercepting reel_item_watch')
return promise.then(response => {
response.clone().json().then(json => {
let menuItems = json.overlay.reelPlayerOverlayRenderer.menu.menuRenderer.items
let openAppItem = menuItems.find(item =>

YouTube Audio Track Translations

{
  "runSettings": {
    "temperature": 0.5,
    "model": "models/gemini-2.5-pro-preview-05-06",
    "topP": 0.95,
    "topK": 64,
    "maxOutputTokens": 65536,
@insin
insin / temp.js
Created May 9, 2025 01:46
Get YouTube language codes (with language menu open)
Array.from(
document.querySelectorAll('#items.yt-multi-page-menu-section-renderer ytd-compact-link-renderer[compact-link-style="compact-link-style-type-selection-menu"]'),
el => el.data.serviceEndpoint.signalServiceEndpoint.actions[0].selectLanguageCommand.hl
)
@insin
insin / manifest.json
Last active April 30, 2025 17:14
Personal Hide YouTube Shorts Extension - load as an unpacked extension in Chrome or in about:debugging in Firefox - style rules extracted from https://soitis.dev/control-panel-for-youtube
{
"manifest_version": 3,
"name": "Hide YouTube Shorts",
"description": "Hides YouTube Shorts",
"version": "1.0",
"content_scripts": [
{
"matches": [
"https://www.youtube.com/*",
"https://m.youtube.com/*"
@insin
insin / getState.js
Last active May 1, 2025 03:30
getState() / Get Twitter React state
function getState() {
let $reactRoot = document.querySelector('#react-root')
let wrapped = $reactRoot.firstElementChild['wrappedJSObject'] || $reactRoot.firstElementChild
let reactPropsKey = Object.keys(wrapped).find(key => key.startsWith('__reactProps'))
if (reactPropsKey) {
let state = wrapped[reactPropsKey].children?.props?.children?.props?.store?.getState()
if (state) return state
warn('React state not found')
} else {
warn('React prop key not found')
🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵
🔵🟡🟡🟡🔵🔵🟡🔵🔵🔵🟡🟡🔵🟡🔵🟡🔵
🔵🟡🔵🔵🔵🟡🔵🟡🔵🟡🔵🔵🔵🟡🔵🟡🔵
🔵🟡🟡🟡🔵🟡🟡🟡🔵🔵🟡🔵🔵🔵🟡🔵🔵
🔵🟡🔵🔵🔵🟡🔵🟡🔵🔵🔵🟡🔵🔵🟡🔵🔵
🔵🟡🟡🟡🔵🟡🔵🟡🔵🟡🟡🔵🔵🔵🟡🔵🔵
🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵
@insin
insin / README.md
Last active May 15, 2024 14:58
An Astro <Tweet> component for hardcoding static Tweets

An Astro <Tweet> component for hardcoding static Tweets

Dependencies

Tailwind

Setup

  1. Add the following colours to your Tailwind config