You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently get_video only returns "videoPrimaryInfoRenderer" part from "ytInitialData". although for some other applications having "ytInitialPlayerResponse" would be useful. like storyboards thumbnails.
defget_video(
id: str,
) ->dict:
"""Get a single video. Parameters: id (``str``): The video id from the video you want to get. """session=get_session()
url=f"https://www.youtube.com/watch?v={id}"html=get_initial_data(session, url)
client=json.loads(
get_json_from_html(html, "INNERTUBE_CONTEXT", 2, '"}},') +'"}}'
)["client"]
session.headers["X-YouTube-Client-Name"] ="1"session.headers["X-YouTube-Client-Version"] =client["clientVersion"]
data=json.loads(
get_json_from_html(html, "var ytInitialData = ", 0, "};") +"}"
)
ytInitialPlayerResponse=json.loads(
get_json_from_html(html, "var ytInitialPlayerResponse = ", 0, "};") +"}"
)
returning=next(search_dict(data, "videoPrimaryInfoRenderer"))
returning['ytInitialPlayerResponse'] =ytInitialPlayerResponsereturnreturning
something like this would be appreciated.
The text was updated successfully, but these errors were encountered:
currently get_video only returns "videoPrimaryInfoRenderer" part from "ytInitialData". although for some other applications having "ytInitialPlayerResponse" would be useful. like storyboards thumbnails.
something like this would be appreciated.
The text was updated successfully, but these errors were encountered: