Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
vk.com - big Russian social network.
Including videos from there should also be possible by video_filter
Thanks for nice hooks, it did not make much time to write a hook adding this functionality:
function customsite_codec_info() {
$codecs = array();
$codecs['vk'] = array(
'name' => t('VK'),
'callback' => 'customsite_vk',
'regexp' => '/vk\.com\/video([0-9]+)\_([0-9]+)\?hash=([a-z0-9]+)/i',
'ratio' => 607 / 360,
);
return $codecs;
}
function customsite_vk($video) {
$video['source'] = 'http://vk.com/video_ext.php?oid='.$video['codec']['matches'][1]."&id=".$video['codec']['matches'][2]."&hash=".$video['codec']['matches'][3]."&hd=1";
return video_filter_iframe($video);
}
Transformation:
http://vk.com/video92267979_164947616?hash=bb7c2f9646236401
->
http://vk.com/video_ext.php?oid=92267979&id=164947616&hash=bb7c2f9646236...
However, I think this could be added to the main branch.
Comments
Comment #1
TheMystique CreditAttribution: TheMystique commentedHello __Sander_
Can you tell me how to add this to the video filter i mean wich files i need to edit and where
Note i am a 2 days user of drupal :) used only wp till now
Comment #2
ultimateboy CreditAttribution: ultimateboy commentedMoving to 7.x-3.x
Comment #3
OFF CreditAttribution: OFF commentedGood News Guys!
Comment #4
OFF CreditAttribution: OFF commentedHow i can make it work?
I try to put this code:
[video:http://vk.com/video_ext.php?oid=92267979&id=164947616&hash=bb7c2f9646236...
But video is not show
Please help!
Comment #5
OFF CreditAttribution: OFF commentedAny body here?
Comment #6
OFF CreditAttribution: OFF commentedI am added 2 parts of code in the video_field.codecs.inc
line 227:
$codecs['vk'] = array(
'name' => t('VK'),
'sample_url' => 'http://vk.com/video92267979_164947616',
'callback' => 'video_filter_vk',
'regexp' => array(
'/vk\.com\/video([0-9]+)\_([0-9]+)\?hash=([a-z0-9]+)/i',
),
'ratio' => 16 / 9,
'control_bar_height' => 25,
);
line 244:
/**
* Callback for vk.com codec.
*
* @see video_filter_codec_info()
*/
function video_filter_vk($video) {
$video['source'] = 'http://vk.com/video_ext.php?oid='.$video['codec']['matches'][1]."&id=".$video['codec']['matches'][2]."&hash=".$video['codec']['matches'][3]."&hd=1";
return video_filter_iframe($video);
}
And it's working!
Please add to the dev version
Comment #7
ultimateboy CreditAttribution: ultimateboy commentedPlease read the documentation on how to create and submit a patch : https://www.drupal.org/node/707484
With a working patch (that adheres to drupal coding standards), I'll gladly add this to the module.
Comment #8
OFF CreditAttribution: OFF commentedBut its not working without this part of url:
?hash=bb7c2f9646236401
Comment #9
minnur CreditAttribution: minnur at Chapter Three commentedit looks like this might require some VK API integration and simple URL parse won't work.
Comment #10
minnur CreditAttribution: minnur at Chapter Three commentedClosing this issue. No working patch provided and no activity in 2 years. Feel free to re-open if you have working patch.