Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
add support for Google+ (plus.google.com) #202
Comments
|
any progress? |
|
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; |
|
We have it! |
Google+ becomes more and more popular. Please support this host also. Thanks