Explorer
/tmp/patch_aa021_youtube_sort.py
← Zurück ↓ Download
from pathlib import Path
p=Path('/opt/struktur/social-media-radar/intake/multi_intake.py')
s=p.read_text()
old='''    html_bytes = _get(f"https://www.youtube.com/results?search_query={q}")
'''
new='''    # CAI= is YouTube's public upload-date sort; keep the search source fresh.
    html_bytes = _get(f"https://www.youtube.com/results?search_query={q}&sp=CAI%253D")
'''
assert old in s
p.write_text(s.replace(old,new,1))