Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import requests
import re
import os
import time
import json
from datetime import datetime, timezone
import random
// ==UserScript==
// @name Search Hobune for unavailable video IDs
// @namespace hobune.stream
// @match https://www.youtube.com/watch
// @grant GM_xmlhttpRequest
// @connect hobune.stream
// @version 1.1
// @author Rebane
// @description 10/31/2020, 3:47:50 PM
// ==/UserScript==
@rebane2001
rebane2001 / daily_metadata.py
Created July 17, 2021 19:56
Somewhat hastily written script to pull metadata for every video in an archive (recommended to cronjob to every day)
import requests
import re
import os
import time
import json
from datetime import datetime, timezone
import random
# Put your YouTube API keys here, the more the merrier (one key can do 500k vids a day)
youtube_api_keys = ["YOUR_API_KEYS_HERE"]
@rebane2001
rebane2001 / patch.py
Last active July 6, 2021 11:11
matterport-dl expiration patch
import re
import os.path
for p in ["showcase.js","js/showcase.js"]:
if os.path.isfile(p):
with open(p,"r",encoding="UTF-8") as f:
j = f.read()
with open(p,"w",encoding="UTF-8") as f:
f.write(re.sub(r"\&\&\(!e.expires\|\|.{1,10}\*e.expires>Date.now\(\)\)","",j))
print("Patched!")
Archive what you'll never see twice
Whatever you did years ago, it changed you. For the better, and that's nothing you can throw away, delete, or unlist.
(from https://flowny.bandcamp.com/track/stand-alone-by-combine-feat-feather)
The reality is that things you want will disappear and things you don’t will be around for forever.
(from https://www.bbc.com/future/article/20210715-the-online-data-thats-being-deleted)
@rebane2001
rebane2001 / bilibiliextract.py
Created June 2, 2021 10:06
Simple script to extract bilibili video IDs/URLs from a channel ID/URL
# Simple script to extract all video IDs from a bilibili channel
# Not properly cleaned up for public release, so you're on your own
import requests
import json
import re
def getChannelPageVideos(channelid,page):
print("Getting page",page)
headers = {
'authority': 'api.bilibili.com',
# Simple script to convert trs files to srt. May not be perfect, so edit this script as necessary.
# Warning, this script is unsafe to use against untrusted data.
# See for more info: https://docs.python.org/3/library/xml.html#xml-vulnerabilities
from datetime import timedelta
from xml.dom import minidom
import srt
subs = []
@rebane2001
rebane2001 / README.md
Last active June 29, 2024 01:01 — forked from corentinbettiol/README.md
Tiny js code that will simulate a 3D view of your elements, like firefox used to do.

example gif

Explanations

This script will get the computed background color of your body, and then will create shadows darker than your background (if you have a light background), or lighter than your background (if you have a dark background). If the body does not have a background, the script will take 160 as the default value for red, green and blue.

It will then add a border, a box-shadow, a padding and a margin to each element of your page, and will use the cool rotate3d css function to tilt your website.

Install

import json
import sys
if len(sys.argv) < 2:
print("infojsonredact - A simple script to redact private information from ytdl info.json files")
print("Output will be saved in info.json.redacted files")
print("Usage: infojsonredact.py file1.info.json [file2.info.json, file3.info.json...]")
sys.exit(2)
redacted = ["url","manifest_url","fragment_base_url","fragments","http_headers","User-Agent","Accept-Charset","Accept","Accept-Encoding","Accept-Language","player_url","playlist","playlist_id","playlist_title","playlist_uploader","playlist_uploader_id","playlist_index","thumbnail","_filename","downloader_options","http_chunk_size","initialization_url","annotations", "playlist_count","version","_version","repository","release_git_head","filesize_approx","_format_sort_fields"]
@rebane2001
rebane2001 / fotoalbum-dl.py
Created September 30, 2020 13:07
Laeb alla fotoalbum.ee albumeid
import urllib.request
import re
base_url = "http://fotoalbum.ee"
album = input("Sisesta fotoalbum.ee albumi link:")
album = album.split("?")[0]
if not "/sets/" in album:
print("Hoiatus: Link pole album ning võib seetõttu valesti toimida")
pildid = []