Skip to content

Instantly share code, notes, and snippets.

@SophieShears
SophieShears / add_metavids_to_ads.py
Created September 2, 2025 21:31
Add MetaAdVid videos to MetaAds
import json
from submissions.models import MetaAd, MetaAdVid
from tools.meta_ads import MetaAds
meta_ads_no_vid = MetaAd.objects.filter(metaad_vids__isnull=True, direct_ad_full_md__isnull=False)
total_added = 0
for meta_ad in meta_ads_no_vid:
ad_json = json.loads(meta_ad.direct_ad_full_md)
try:
content_url = ad_json['snapshot']['cards'][0]['video_sd_url']
@SophieShears
SophieShears / dl_m3u8.py
Created July 15, 2025 18:43
file to complile as binary for m3u8 download with hang timeout error handling
# pip install m3u8_To_MP4
# Code to download m3u8 links as mp4 files
import signal
import sys
import m3u8_To_MP4
def handler(signum, frame):
@SophieShears
SophieShears / dl_m3u8_err_on_hang.py
Last active July 15, 2025 17:28
Download m3u8 links as mp4 and will raise error if the download process hangs.
# pip install m3u8_To_MP4
# Code to download m3u8 links as mp4 files
import m3u8_To_MP4
import os
import signal
def handler(signum, frame):
raise Exception('Function timed out')
@SophieShears
SophieShears / dl_m3u8_multithreaded.py
Last active February 16, 2025 02:21
Download m3u8 links as mp4 multithreaded to decrease download time
# pip install m3u8_To_MP4
# Code to download m3u8 links as mp4 files
import m3u8_To_MP4
import os
def dl_m3u8(url, directory, filename):
# Note directory should be the filepath to save the file ex: '/home/username/bin'
# Directory can be a relative or absolute path
# Filename should end with an .mp4 ex: 'test.mp4'
@SophieShears
SophieShears / dl_m3u8.py
Last active April 11, 2024 21:53
Download m3u8 links as mp4 with python
# First have to pip install "ffmpeg-python"
# Code to download m3u8 links as mp4 files
import ffmpeg
def dl_m3u8(dl_url, filepath):
try:
stream = ffmpeg.input(dl_url)
stream = ffmpeg.output(stream, f'{filepath}.mp4')
ffmpeg.run(stream)
@SophieShears
SophieShears / openAll.js
Last active July 18, 2025 20:31
Click All Links Then Scroll to the Bottom
class OpenAll {
constructor() {
this.seenUrls = new Set();
}
openWindows() {
const links = document.getElementsByTagName('a');
const url = 'crm.kuhnlawgroup.com';
for (let i = 0; i < links.length; i ++) {
if (!links[i].href.includes(url) && links[i].href.includes('.com')) {