Skip to content

Commit

Permalink
Fix no download when private account (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu1845 committed Sep 28, 2022
1 parent 7fad013 commit 2ddd150
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions twspace_dl/twspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ def __init__(self, metadata: dict) -> None:
)
if metadata:
root = defaultdict(str, metadata["data"]["audioSpace"]["metadata"])
creator_info = root["creator_results"]["result"]["legacy"] # type: ignore
if creator_info := root["creator_results"]["result"].get("legacy"):# type: ignore
self["creator_name"] = creator_info["name"] # type: ignore
self["creator_screen_name"] = creator_info["screen_name"] # type: ignore
self["creator_id"] = twitter.user_id(
"https://twitter.com/" + creator_info["screen_name"]
)

self.source = metadata
self.root = root
self["id"] = root["rest_id"]
self["url"] = "https://twitter.com/i/spaces/" + self["id"]
self["title"] = root["title"]
self["creator_name"] = creator_info["name"] # type: ignore
self["creator_screen_name"] = creator_info["screen_name"] # type: ignore
try:
self["start_date"] = datetime.fromtimestamp(
int(root["started_at"]) / 1000
Expand All @@ -56,9 +59,6 @@ def __init__(self, metadata: dict) -> None:
self["state"] = root["state"]
self["available_for_replay"] = root["is_space_available_for_replay"]
self["media_key"] = root["media_key"]
self["creator_id"] = twitter.user_id(
"https://twitter.com/" + creator_info["screen_name"]
)

@staticmethod
def _metadata(space_id) -> dict:
Expand Down

0 comments on commit 2ddd150

Please sign in to comment.