Skip to content

Instantly share code, notes, and snippets.

Avatar
🦊

Jasper Rebane rebane2001

🦊
View GitHub Profile
View api_filter.py
#!/usr/bin/env python3
import requests
import re
import os
import time
import json
from datetime import datetime, timezone
import random
View search_hobune_for_unavailable.js
// ==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.0
// @author Rebane
// @description 10/31/2020, 3:47:50 PM
// ==/UserScript==
@rebane2001
rebane2001 / daily_metadata.py
Created Jul 17, 2021
Somewhat hastily written script to pull metadata for every video in an archive (recommended to cronjob to every day)
View daily_metadata.py
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 Jul 6, 2021
matterport-dl expiration patch
View patch.py
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!")
View quotes.txt
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 Jun 2, 2021
Simple script to extract bilibili video IDs/URLs from a channel ID/URL
View bilibiliextract.py
# 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',
View trs2srt.py
# 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 Oct 20, 2021 — forked from corentinbettiol/README.md
Tiny js code that will simulate a 3D view of your elements, like firefox used to do.
View README.md

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

View infojsonredact.py
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"]
@rebane2001
rebane2001 / fotoalbum-dl.py
Created Sep 30, 2020
Laeb alla fotoalbum.ee albumeid
View fotoalbum-dl.py
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 = []