![]() ![]() Doesn't work with videos that aren't embeddable, but works with age-restricted videos. YouTube uses this when requesting information for embedded videos. There are only a few that actually matter though, so I'll list them here: The el request parameter can take multiple values, and it affects what kind of data you will receive in the response. sts - a timestamp which identifies the version of the signature cipher used in stream URLs.In some cases, you will need to set this parameter to a certain value depending on the type of the video, in order to avoid errors. This decides what kind of information will be available in the response. el - the type of YouTube page that originated this request. ![]() Use hl=en to force the English language on all strings. If not set, it defaults to the locale inferred from your IP address. hl - the name of the locale used to localize some strings.Let's also look at some important optional query parameters that this request can take: Keywords=Icon,For,Hire,Make,Move,Tooth,Nail,(TNN),RockĪs you can see, there is quite a lot of information that can be extracted straight away. Some parameter values are nested objects themselves, so they can in turn be mapped to nested dictionaries. After that, you can map the parameter names to values in a dictionary for easier access. The response contains URL-encoded metadata, which has to be decoded first before it's usable. The request can take a lot of different parameters, but at minimum it needs a video ID - the value in the URL that comes after /watch?v=, for example e_S9VvJM1PI. There are a few ways to do it, but the most reliable one is by querying an AJAX endpoint used internally by YouTube's iframe embed API. ![]() In order to find and resolve the video's media streams, you need to first get its metadata. Instead of trying to continue updating the information here, I decided to write a completely new article altogether - Reverse-Engineering YouTube: Revisited Getting the video metadata Since this is a relatively popular discussion topic among many beginner developers, I thought that I could help out by sharing the knowledge I found by spending dozens of hours staring at Chrome Developer Tools.Īs of YoutubeExplode v6.0.7 (1), practically everything in this post has become outdated, and the highlighted approaches are no longer used by my library. Nowadays, YoutubeExplode is arguably the most consistent and robust. Originally, my main motivation for developing it was simply to gain experience, as the task involved a lot of research and reverse-engineering. Almost a year ago, I started developing YoutubeExplode, a library that scrapes information on YouTube videos and lets you download them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |