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 / 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
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 / hide-youtube-shorts.css
Last active June 21, 2024 18:45
Hide YouTube Shorts - use with the Stylus extension: https://github.com/openstyles/stylus#stylus
/* Nav item */
a[title="Shorts"],
/* Video shelf in Home and Subscriptions */
ytd-rich-shelf-renderer[is-shorts],
/* Video shelf in Search */
ytd-reel-shelf-renderer {
display: none !important;
}
@supports selector(:has(*)) {
@insin
insin / console.js
Created August 2, 2023 16:50
Get currently-loaded user entities on twitter.com
entities = $('#react-root')._reactRootContainer._internalRoot?.current?.memoizedState?.element?.props?.children?.props?.store?.getState()?.entities?.users?.entities
users = {}
for (let user of Object.values(entities)) {
users[user.screen_name] = user
}
@insin
insin / userstyle-for-new-tweetdeck.css
Last active June 21, 2024 18:46
Userstyle for New TweetDeck - use with the Stylus extension: https://github.com/openstyles/stylus#stylus
/* Hide... */
/* Views on list tweets */
[data-testid="tweet"][tabindex="0"] div[id^=id__][role=group] > div:nth-child(4):nth-last-child(2),
/* Views on focused tweet */
[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2),
[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2) + div[dir]:last-child,
/* Bookmark button on focused tweet */
[data-testid="tweet"][tabindex="-1"] div[id^=id__][role=group] > div:nth-child(4):nth-last-child(2),
/* Share button on all tweets */
div[id^=id__][role=group] > div:nth-child(5):last-child,
@insin
insin / YouYubeEmbed.astro
Created May 11, 2023 09:25
Lightweight YouTube embed component for Astro
---
export interface Props {
title: string
videoCode: string
}
let {title, videoCode} = Astro.props
let playButtonSvg = `<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg>`
let srcdoc = `<style>*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img{position:absolute;width:100%;top:0;bottom:0;margin:auto}.button{position:absolute;left:50%;top:50%;width:68px;height:48px;margin-left:-34px;margin-top:-24px;}.top{position:absolute;top:18px;left:18px;right:18px;display:flex;flex-wrap:nowrap}.title{color:#fff;font-size:18px;white-space:nowrap;word-wrap:normal;text-shadow:0 0 2px rgba(0,0,0,.5);font-fam