Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Google+ (plus.google.com) #202

Closed
ghost opened this issue Oct 26, 2011 · 3 comments
Closed

add support for Google+ (plus.google.com) #202

ghost opened this issue Oct 26, 2011 · 3 comments

Comments

@ghost
Copy link

@ghost ghost commented Oct 26, 2011

Google+ becomes more and more popular. Please support this host also. Thanks

youtube-dl -t https://plus.google.com/111962077049890418486/posts/EJxn8T21H5o
WARNING: Falling back on generic information extractor.
[generic] EJxn8T21H5o: Downloading webpage
[generic] EJxn8T21H5o: Extracting information
ERROR: Invalid URL: https://plus.google.com/111962077049890418486/posts/EJxn8T21H5o

@ghost
Copy link
Author

@ghost ghost commented Jun 23, 2012

any progress?

@kevinamadeus
Copy link
Contributor

@kevinamadeus kevinamadeus commented Aug 23, 2012

I personally use Google+ a lot, and I have written php script myself to extract the video link, and download using wget. I think this may be ported to Python...

/*
 * The post. By clicking the date of a post in a stream
 * Post has to be public
 * for example, $post_url = "https://plus.google.com/100853242536124656213/posts/EDSBssT7zLm"
 */
$post_html = file_get_contents($post_url);

    /* Time, for output file name */
    $time_pattern = '%title\="Timestamp"\>(.*?)\</a\>%';
    if (preg_match($time_pattern, $post_html, $matches)) {
        $time = date('ymd', strtotime($matches[1]));
    } else {
        $time = date('ymd') . 'F';
    }

    /* Description, for output file name */
    $desc_pattern = '%<meta name\="Description" content\="(.*?)[\s<"]%';
    if (preg_match($desc_pattern, $post_html, $matches)) {
        $desc = $matches[1];
    } else {
        $desc = 'No desc';
    }

    /* Author, for output file name */
    $author_pattern = '%rel\="author".*?>(.*?)</a>%';
    if (preg_match($author_pattern, $post_html, $matches)) {
        $author = $matches[1];
    } else {
        $author = 'No author';
    }
/*
 * Simulate clicking the image of a video post
 */
$image_box_pattern = '%"(https\://plus\.google\.com/photos/.*?)",,"image/jpeg","video"\]%';
if (preg_match($image_box_pattern, $post_html, $matches)) {
    $image_box_url = $matches[1];
    $image_box_html = file_get_contents($image_box_url);
} else {
    die('Cannot find the image box');
}

/*
 * Extract video links of all sizes
 */
if (preg_match_all('%\d+,\d+,(\d+),"(http\://redirector\.googlevideo\.com.*?)"%',$image_box_html,$matches)) {
    /* Prepare function to decode \u0026 like hex */
    function unescapeUTF8EscapeSeq($str) {
        return preg_replace_callback("/\\\u([0-9a-f]{4})/i",
            create_function('$matches',
                'return html_entity_decode(\'&#x\'.$matches[1].\';\', ENT_QUOTES, \'UTF-8\');'
            ), $str);
    }

    /* Put them into an array */
    $video_links = array();
    for ($i=0; $i<count($matches[1]); $i++) {
        $video_links[$matches[1][$i]] = unescapeUTF8EscapeSeq($matches[2][$i]);
    }

    /* Sort the best quality first*/
    krsort($video_links);
    foreach ($video_links as $video_link) {
        $video_to_download = $video_link;
        break; /* Only taking the first one */
    }
} else {
    die('No video found');
}

/*
 * Formulate command
 */
echo PHP_EOL . "screen wget -O \"Downloads/$time - $author - $desc.flv\" \"$video_link\"" . PHP_EOL . PHP_EOL;
@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Dec 17, 2012

We have it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.