mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-09 06:09:00 -06:00
ipv4 only fix for youtube 429 ratelimiting
probably not gonna work in the long run
This commit is contained in:
@@ -3,7 +3,6 @@ from flask_login import UserMixin
|
||||
from datetime import datetime
|
||||
from app import db, login
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
import os
|
||||
|
||||
# Just a note, my role system is really quite terrible, but I've implemented as good as a system as I can for a simple RBAC without Hierarchy.
|
||||
# Once could create a complex system, but it would be better to properly work with SQLAlchemy to create proper permissions, hierarchy, parent/child etc. rather than to work with simple strings.
|
||||
|
||||
@@ -35,11 +35,11 @@ class YouTubeAudio(db.Model):
|
||||
print(f'Filling out metadata for {self.id}')
|
||||
# Use stdout=PIPE, [Python 3.6] production server support instead of 'capture_output=True' => 'process.stdout'
|
||||
self.url = f'https://www.youtube.com/watch?v={self.id}'
|
||||
processFilename = subprocess.Popen(['youtube-dl', '-x', '--audio-format', 'mp3', '--restrict-filenames', '--get-filename', self.url],
|
||||
processFilename = subprocess.Popen(f'youtube-dl -4 -x --audio-format mp3 --restrict-filenames --get-filename {self.url}'.split(' '),
|
||||
encoding='utf-8', stdout=subprocess.PIPE)
|
||||
self.filename = processFilename.communicate()[0].split('.')[0] + '.mp3'
|
||||
print(f'Filename acquired for {self.id}')
|
||||
processJSON = subprocess.Popen(['youtube-dl', '-x', '--audio-format', 'mp3', '--restrict-filenames', '--dump-json', self.url],
|
||||
processJSON = subprocess.Popen(f'youtube-dl -4 -x --audio-format mp3 --restrict-filenames --dump-json {self.url}'.split(' '),
|
||||
encoding='utf-8', stdout=subprocess.PIPE)
|
||||
data = json.loads(processJSON.communicate()[0])
|
||||
print(f'JSON acquired for {self.id}, beginning to fill.')
|
||||
|
||||
Reference in New Issue
Block a user