Fix URL parsing
This commit is contained in:
parent
d739df71a4
commit
0f92053046
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@ import logging
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
from urllib.parse import urlparse, parse_qs
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
logger = logging.getLogger("musik.list")
|
logger = logging.getLogger("musik.list")
|
||||||
|
@ -28,7 +29,7 @@ def generate_list(args):
|
||||||
logger.debug("Lecture de la liste")
|
logger.debug("Lecture de la liste")
|
||||||
with q.open() as f:
|
with q.open() as f:
|
||||||
_raw_musiks = [
|
_raw_musiks = [
|
||||||
(re.compile(r"[\?\&]v=(\w+)").search(_musik) or ("", _musik))[1]
|
parse_qs(urlparse(_musik).query).get("v", [None])[0] or _musik
|
||||||
for _musik in f.read().splitlines()
|
for _musik in f.read().splitlines()
|
||||||
]
|
]
|
||||||
_musiks = list(set(filter(lambda _m: _m not in blacklist, _raw_musiks)))
|
_musiks = list(set(filter(lambda _m: _m not in blacklist, _raw_musiks)))
|
||||||
|
|
Loading…
Reference in a new issue