Auto copiar e colar
-
Olá pessoal, estou tentando fazer (buscar na internet) um código que auto copie e cole algo para uma outra página. A história é a seguinte.
Tenho um site com muitos videos do youtube e havia disposto os links para download através do plugin Catconvert . Mas este site catconvert foi fechado então editei o plugin e redirecionei a página para um outro site de baixar mp3 a partir de videos do youtube que é Youtube-Mp3. Até aqui tudo deu certo.
Mas o problema é que usando o Catconvert, ao clicar em “Baixar mp3” em meu site já era redirecionado para o site do catconvert com a id do video do youtube na url e começava o download automaticamente, mas no site youtube-mp3.org é necessário inserir o endereço do video em um campo de texto e assim clicar em download. Aqui vai a pergunta:
Como faço para ao clicar em baixar mp3 em meu site redirecionar para youtube-mp3.org com a id do video do youtube (Que já está sendo capturada para a url) e colar no campo descrito para inserir o endereço do video para download.
Vou mandar abaixo o endereço do meu site e um trecho do código que captura a id do video para a url.
Meu site Galeria Maluco Beleza
Link para pastebin
Abaixo o trecho do código
// support for
// – Default WordPress behavior without any wordpress plugin,
// – Smart Youtube PRO
// – YouTube
// – Advanced YouTube Embed by Embed Plus
foreach ($iframes as $iframe) {
$url = $iframe->getAttribute(‘src’);
$videoId = $this->get_youtube_id_from_url($url);$containerElement = $dom->createElement(‘div’);
$containerClassAttribute = $this->createAttribute($dom, ‘class’, $containerCssClass);
$containerElement->appendChild($containerClassAttribute);$linkElement = $dom->createElement(‘a’, $linkText);
$linkClassAttribute = $this->createAttribute($dom, ‘class’, $linkCssClass);
$linkElement->appendChild($linkClassAttribute);$linkNoFollowAttribute = $this->createAttribute($dom, ‘rel’, ‘nofollow’);
$linkElement->appendChild($linkNoFollowAttribute);$linkTargetAttribute = $this->createAttribute($dom, ‘target’, ‘_blank’);
$linkElement->appendChild($linkTargetAttribute);$Youtube2mp3Url = “http://www.yt-mp3.com/?url=http://www.youtube.com/watch?v=”.$videoId;
$linkHrefAttribute = $this->createAttribute($dom, ‘href’, $Youtube2mp3Url);
$linkElement->appendChild($linkHrefAttribute);$containerElement->appendChild($linkElement);
if($iframe->parentNode->nodeName != ‘object’){
$iframe->parentNode->appendChild($containerElement);
}else{
$iframe->parentNode->parentNode->appendChild($containerElement);
}
}// support for
// – viper plugin
$iframes = $xpath->query(“//span[contains(@class,’vvqbox’)]/span/a “);
foreach ($iframes as $iframe) {
$url = $iframe->getAttribute(‘href’);
$videoId = $this->get_youtube_id_from_url($url);$containerElement = $dom->createElement(‘div’);
$containerClassAttribute = $this->createAttribute($dom, ‘class’, $containerCssClass);
$containerStyleAttribute = $this->createAttribute($dom, ‘style’, ‘margin-top: -7px;’);
$containerElement->appendChild($containerStyleAttribute);
$containerElement->appendChild($containerClassAttribute);$linkElement = $dom->createElement(‘a’, $linkText);
$linkClassAttribute = $this->createAttribute($dom, ‘class’, $linkCssClass);
$linkElement->appendChild($linkClassAttribute);$linkNoFollowAttribute = $this->createAttribute($dom, ‘rel’, ‘nofollow’);
$linkElement->appendChild($linkNoFollowAttribute);$linkTargetAttribute = $this->createAttribute($dom, ‘target’, ‘_blank’);
$linkElement->appendChild($linkTargetAttribute);$Youtube2mp3Url = “http://www.youtube-mp3.org/get?video_id=”.$videoId;
$linkHrefAttribute = $this->createAttribute($dom, ‘href’, $Youtube2mp3Url);
$linkElement->appendChild($linkHrefAttribute);$containerElement->appendChild($linkElement);
$iframe->parentNode->parentNode->appendChild($containerElement);
}return utf8_decode($dom->saveHTML());
}function createAttribute($dom, $name, $value){
$attribute = $dom->createAttribute($name);
$attribute->value = $value;
return $attribute;
}function get_youtube_id_from_url($url)
{
if (preg_match(‘%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^”&?/ ]{11})%i’, $url, $match)) {
return $match[1];
}
}
}Desde já obrigado
- O tópico ‘Auto copiar e colar’ está fechado para novas respostas.