fumiaki-yoshida / ytdlp-json2csv

convert yt-dlp's json to csv.
MIT License
0 stars 0 forks source link

条件式が多すぎて読みずらい。 #14

Open fumiaki-yoshida opened 3 months ago

fumiaki-yoshida commented 3 months ago

DataFrameを作るコード内に条件式が多すぎて読みずらい。

stateパターンを使うといいかもしれない。 https://nishi2.info/pydp/GoF_dp/behavior/20_State/index.html

fumiaki-yoshida commented 3 months ago

Facadeパターンかも。 https://nishi2.info/pydp/GoF_dp/structure/10_Facade/index.html

fumiaki-yoshida commented 2 months ago

条件式を関数化する 例

def _has_addChatItemAction(dat):
    return "addChatItemAction" in  dat["replayChatItemAction"]["actions"][0].keys()