Merge pull request #214 from arabcoders/dev
fix params Impersonate target
This commit is contained in:
commit
3161fc0bb8
6 changed files with 12 additions and 8 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
|
@ -27,6 +27,7 @@
|
||||||
"libcurl",
|
"libcurl",
|
||||||
"libx",
|
"libx",
|
||||||
"matroska",
|
"matroska",
|
||||||
|
"mkvtoolsnix",
|
||||||
"mpegts",
|
"mpegts",
|
||||||
"msvideo",
|
"msvideo",
|
||||||
"muxdelay",
|
"muxdelay",
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ YTPTube started as a fork of [meTube](https://github.com/alexta69/metube), Since
|
||||||
# YTPTube Features.
|
# YTPTube Features.
|
||||||
* Multi-downloads support.
|
* Multi-downloads support.
|
||||||
* Handle live streams.
|
* Handle live streams.
|
||||||
* Schedule Channels or Playlists to be downloaded automatically at a specific time.
|
* Schedule channels or playlists to be downloaded automatically at a specified time.
|
||||||
* Send notification to targets based on specified events.
|
* Send notification to targets based on selected events.
|
||||||
* Support per link `yt-dlp JSON config or cli options`, `cookies` & `output format`.
|
* Support per link `yt-dlp JSON config or cli options`, `cookies` & `output format`.
|
||||||
* Queue multiple URLs separated by comma.
|
* Queue multiple URLs separated by comma.
|
||||||
* A built in video player that can play any video file regardless of the format. **With support for sidecar external subtitles**.
|
* A built in video player that can play any video file regardless of the format. **With support for sidecar external subtitles**.
|
||||||
|
|
|
||||||
|
|
@ -203,11 +203,6 @@ class Download:
|
||||||
|
|
||||||
self.logger.debug("Params before passing to yt-dlp.", extra=params)
|
self.logger.debug("Params before passing to yt-dlp.", extra=params)
|
||||||
|
|
||||||
if "impersonate" in params:
|
|
||||||
from yt_dlp.networking.impersonate import ImpersonateTarget
|
|
||||||
|
|
||||||
params["impersonate"] = ImpersonateTarget.from_str(params["impersonate"])
|
|
||||||
|
|
||||||
params["logger"] = NestedLogger(self.logger)
|
params["logger"] = NestedLogger(self.logger)
|
||||||
|
|
||||||
cls = yt_dlp.YoutubeDL(params=params)
|
cls = yt_dlp.YoutubeDL(params=params)
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,6 @@ def arg_converter(args: str) -> dict:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import yt_dlp.options
|
import yt_dlp.options
|
||||||
from yt_dlp.utils import DateRange
|
|
||||||
|
|
||||||
create_parser = yt_dlp.options.create_parser
|
create_parser = yt_dlp.options.create_parser
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,4 +137,9 @@ class YTDLPOpts(metaclass=Singleton):
|
||||||
|
|
||||||
data["daterange"] = DateRange(data["daterange"]["start"], data["daterange"]["end"])
|
data["daterange"] = DateRange(data["daterange"]["start"], data["daterange"]["end"])
|
||||||
|
|
||||||
|
if "impersonate" in data and isinstance(data["impersonate"], str):
|
||||||
|
from yt_dlp.networking.impersonate import ImpersonateTarget
|
||||||
|
|
||||||
|
data["impersonate"] = ImpersonateTarget.from_str(data["impersonate"])
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import json
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from yt_dlp.networking.impersonate import ImpersonateTarget
|
||||||
from yt_dlp.utils import DateRange
|
from yt_dlp.utils import DateRange
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,6 +23,9 @@ class Encoder(json.JSONEncoder):
|
||||||
if isinstance(o, date):
|
if isinstance(o, date):
|
||||||
return str(o)
|
return str(o)
|
||||||
|
|
||||||
|
if isinstance(o, ImpersonateTarget):
|
||||||
|
return str(o)
|
||||||
|
|
||||||
if isinstance(o, object):
|
if isinstance(o, object):
|
||||||
if hasattr(o, "serialize"):
|
if hasattr(o, "serialize"):
|
||||||
return o.serialize()
|
return o.serialize()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue