Extract Direct Blogger URL (Token URL)

Asked

Viewed 1,930 times

4

I’m trying to extract the URL directly from Blogger by php or the page source code

the URL I want to extract is:

https://www.blogger.com/video-play.mp4?contentId=3506042769269f95

the direct URL (Token URL) I want to get is:

https://www.blogger.com/video.g?token=AD6v5dz0uwopNrKXORmGgs7ejV3_FJScdWnQvWz_DhYSuw8vReBV2Yhy12AAGhNWcshcza0dhVKqaiq2mgdFKG8ZPg9vQKpsU5gQVab4FzYeJTT9gMg81c679_k1TZevU2abOH8ad6Rn

v

$string = "https://www.blogger.com/video-play.mp4?contentId=3506042769269f95";

preg_match_all('https://www.blogger.com/video.g?token=', $string, $match);

echo "<pre>";
print_r($match[0]); 
echo "</pre>";

v

Array
(
    [0] => https://www.blogger.com/video.g?token=AD6v5dz0uwopNrKXORmGgs7ejV3_FJScdWnQvWz_DhYSuw8vReBV2Yhy12AAGhNWcshcza0dhVKqaiq2mgdFKG8ZPg9vQKpsU5gQVab4FzYeJTT9gMg81c679_k1TZevU2abOH8ad6Rn
)

Or extract the URL from the page’s source code:

view-source:https://www.blogger.com/video-play.mp4?contentId=3506042769269f95

and get the URL token:

Array ( 
    [error] => O vídeo esta indisponível 
    [extract] => https://www.blogger.com/video.g?token=AD6v5dz0uwopNrKXORmGgs7ejV3_FJScdWnQvWz_DhYSuw8vReBV2Yhy12AAGhNWcshcza0dhVKqaiq2mgdFKG8ZPg9vQKpsU5gQVab4FzYeJTT9gMg81c679_k1TZevU2abOH8ad6Rn 
)

Note: I don’t want to extract >> "AD6v5dz0uwopNrKXORmGgs7ejV3_FJScdWnQvWz_DhYSuw8vReBV2Yhy12AAGhNWcshcza0dhVKqaiq2mgdFKG8ZPg9vQKpsU5gQVab4FzYeJTT9gMg81c679_k1TZevU2abOH8ad6Rn"

and yes >>

"https://www.blogger.com/video.g?token=AD6v5dz0uwopNrKXORmGgs7ejV3_FJScdWnQvWz_DhYSuw8vReBV2Yhy12AAGhNWcshcza0dhVKqaiq2mgdFKG8ZPg9vQKpsU5gQVab4FzYeJTT9gMg81c679_k1TZevU2abOH8ad6Rn"

OF THE URL:

"https://www.blogger.com/video-play.mp4?contentId=3506042769269f95"
  • Any idea how I can do this?
  • All help is welcome!
  • Thank you!

1 answer

1

The url https://www.blogger.com/video-play.mp4?contentId=3506042769269f95 was a Google redirector that unfortunately no longer exists, the new links are coming in the model www.blogger.com/video.g?token with the Youtube player, there is a method to get the link(s) video(s), and its qualities with the preg_match_all PHP, but I decided to make it a little easier, but the flawed part is that will use the server IP to generate the link, and if you try to pass the client ,the video server will return not found, follows below:

if(isset($_REQUEST['token'])){
    $data = file_get_contents('https://www.blogger.com/video.g?token='.$_REQUEST['token']);
    $data = preg_replace('/<\s*style.+?<\s*\/\s*style.*?>/si', ' ', $data);
    $data = strip_tags($data);
    $data = str_replace("var VIDEO_CONFIG = ", "", $data);
    $data = json_decode($data, true);
    $data = json_encode($data);
    echo $data;
    unset($data);
}

This will return you a JSON that is in the script tag inside the head tag on the page, in step by step what I did was:
1° Take the page in text.
2° Remove the style tag and all its contents
3° Remove all remaining tags but leaving your content
4° The remaining content is just a javascript tag that is in the head tag where JSON is located
5° I removed the javascript variable that pointed to JSON
6° I decoded the JSON by transforming it into an array and also decoding special characters like: u0026 = & and etc...
7° Transformed again into array
8° I wrote the text
9° I cleaned the variable

To be a little faster:

if(isset($_REQUEST['token'])){
    echo json_encode(json_decode(str_replace("var VIDEO_CONFIG = ", "", strip_tags(preg_replace('/<\s*style.+?<\s*\/\s*style.*?>/si', ' ', file_get_contents('https://www.blogger.com/video.g?token='.$_REQUEST['token'])))), true));
    exit();
}
  • I’m looking for something similar to access the blogger’s videos, but since the old function stopped working, I only found this site that can access the videos with this URL https://tudogostoso.blog/make/check/? list=e6dac2f91a67e518?

  • Some sites have the built-in API to get these videos (or even directly from Google Drive), which they keep up to date, but to find out how they did it just by contacting the site owner, if they want to give you the knowledge

  • I can’t get information from the site owner, but it is possible to see the API that was used by changing the last letters of the list= that the api appears. but I haven’t yet deciphered how I asked the question here https://answall.com/questions/414450/acessar-conte%C3%bado-atr%C3%a1ves-de-api-blogger the data I was able to extract from the url

Browser other questions tagged

You are not signed in. Login or sign up in order to post.