ipv4 only fix for youtube 429 ratelimiting

probably not gonna work in the long run
This commit is contained in:
Xevion
2019-12-24 19:22:51 -06:00
parent d6124698af
commit fd4ac8896d
2 changed files with 2 additions and 3 deletions

View File

@@ -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.

View File

@@ -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.')