-
I planned to run a simple script that adjast info.json from ytdl (yt-dlp).
Clearly I'm making some stupid mistake. Could you help me figure it out? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
You need to give it a name/type and you didn't specify the function name in json-regexp-yt.py: {
"name": "python",
"event": "finalize",
"function": "%APPDATA%/gallery-dl/ytdl/json-regexp-yt.py:function_name"
} |
Beta Was this translation helpful? Give feedback.
-
I still can’t get it to start from under:
Could there be a problem with the script itself. If I transfer a section from downloader to extractor (e.g. Artstation), the script will run, but with an error - it will try to process json files in windows/system32. This is understandable, if there was a simple opportunity to transfer the working folder to it, it could generally be attached to
json_regexp()
|
Beta Was this translation helpful? Give feedback.
-
ok, But on the second point there are more questions than answers. (I repeat once again, I am never a coder.) |
Beta Was this translation helpful? Give feedback.
-
Work like a charm. A little later I’ll tune regexps for vimeo and others - it will be absolutely great. |
Beta Was this translation helpful? Give feedback.
-
Short question here, if you use something like Which makes use of Python's own I've only tested this here locally in my Python interpreter, I don't want to touch my gallery-dl config yet with this, because this is basically productive data for me. Because the problem, at least on Windows, is that something like Which is a) good, but also means that b) Windows does not specify the pathnames consistently, even in its own default settings, e.g.
(Which should be the defaults, even on a fresh Windows installation, AFAIK) And because Python's own >>> os.path.expandvars('$APPDATA')
'C:\\Users\\Hrxn\\AppData\\Roaming'
>>>
>>> os.path.expandvars('${Example_Path_Env_Var}')
'C:\\Sources\\gallery-dl\\' So if a path coming from the environment ends with a trailing path separator, you'd ultimately have either a If, for example, the environment variable does not exist, Python does not bail immediately with an error >>> os.path.expandvars('${Does_not_exist}')
'${Does_not_exist}'
>>> But in such a case, the path would simply be invalid, and gallery-dl could stop operation here as soon as such an error occurs. |
Beta Was this translation helpful? Give feedback.
To run this script after every yt-dlp download, you'd have to enable
metadata-url
and then check if a URL starts withytdl:
, which means it got downloaded by yt-dlp from another extractor.(I'm using
event: after
to make sure yt-dlp is definitely done and has written all of its output files)Regarding paths and download locations, you can enable
meta…