Como recuperar valor de atributo data-bind em documento html

  • Autor Autor turcios
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
turcios

turcios

Dseda
Verificación en dos pasos activada
buenas amigos , esta vez vengo a molestar con esto, no se nada de desarrollo en javascript o jquerry por eso acudo a expertos en el tema

me surgio la necesida de obtener algunos valores desde el atributo data tengo el siguiente codigo:

HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

solo quiero obtener la parte del enlace
HTML:
http://gamovideo.com/9tbtyuoti8ae
no tengo ni idea de como podría ser espero que me puedan ayudar si necesitan mas pistas de lo que quiere realizar con gusto las daré
saludos.
 
Última edição:
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
El JS que necesitas:

Inserir CODE, HTML ou PHP:
var text = document.getElementById("img").getAttribute("data-bind"); // Obtiene el atributo "data-bind" como texto
var start = text.indexOf("('") + 2; // Para saber donde empieza la URL
var end = text.indexOf("')"); // Para saber donde termina la URL

text = text.substring(start, end); // Obtiene el segmento de texto del atributo data-bind

console.log(text); // Muestra en consola

Pero lo ideal es que le coloques un ID a la etiqueta <img> en el HTML, así:

HTML:
<img id="img" data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">
<script src="js/js.js"></script>

En la consola del navegador (Se abre con F12 > Pestaña Consola) puedes ver que te muestra la URL que pediste.

Si usas jQuery, es casi lo mismo.

Espero haberte ayudado, exitos!
 
Última edição:
Lo del user de arriba funciona, pero yo lo haría así:

PHP:
(function() {
	var img = document.getElementById('img'),
	url = img.getAttribute('data-bind').match(/\('(.*)'\)/i);
	console.info(url[1]);
}());
 
Va ser estatico o dinamico ?
 
es dinamido

- - - Actualizado - - -

es dinámico hay mas de un enlace a veces hasta 10

- - - Actualizado - - -

es dinámico hay mas de un enlace a veces hasta 10

- - - Actualizado - - -

Lo del user de arriba funciona, pero yo lo haría así:

PHP:
(function() {
	var img = document.getElementById('img'),
	url = img.getAttribute('data-bind').match(/\('(.*)'\)/i);
	console.info(url[1]);
}());

logre hacerlo de esta forma:
HTML:
const img = document.querySelector('img');
const bind = img.getAttribute('data-bind');
const regex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/;

if (regex.test(bind)) {
  const url = regex.exec(bind)[0];
  console.info(url);
}

pero el contenido es dinamico se necesita extraer todos los enlaces posibles saludos
 
es dinamido

- - - Actualizado - - -

es dinámico hay mas de un enlace a veces hasta 10

- - - Actualizado - - -

es dinámico hay mas de un enlace a veces hasta 10

- - - Actualizado - - -



logre hacerlo de esta forma:
HTML:
const img = document.querySelector('img');
const bind = img.getAttribute('data-bind');
const regex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/;

if (regex.test(bind)) {
  const url = regex.exec(bind)[0];
  console.info(url);
}

pero el contenido es dinamico se necesita extraer todos los enlaces posibles saludos

Cómo? te refieres a que puede haber varios enlaces en una sola imagen o a que puede haber varias imágenes en la misma página?
 
Cómo? te refieres a que puede haber varios enlaces en una sola imagen o a que puede haber varias imágenes en la misma página?

osea que puede haber varias imagenes con el data osea el código hasta 10 veces osea serian 10 link distintos
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

todo esta dentro de un contenedo

HTML:
<table class="table table-striped links-table dataTable no-footer" id="example2" role="grid" aria-describedby="example2_info">
            <thead>
                <tr role="row"><th class="name sorting_asc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Idioma: Activar para ordenar la columna de manera descendente" style="width: 452px;">Idioma</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Calidad: Activar para ordenar la columna de manera ascendente" style="width: 212px;">Calidad</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Uploader: Activar para ordenar la columna de manera ascendente" style="width: 142px;">Uploader</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Reportar: Activar para ordenar la columna de manera ascendente" style="width: 138px;">Reportar</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Ultima Actualización: Activar para ordenar la columna de manera ascendente" style="width: 301px;">Ultima Actualización</th></tr>
            </thead>
            <tbody>
                                                                                
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <!--<tr><td><div class="name"><button class="btn btn-primary" data-toggle="modal" data-target="#add-link-modal"><i class="fa fa-plus"></i> A&ntilde;adir Link</button></div></td><td></td><td></td><td></td><td></td></tr>-->
            <tr data-id="251682" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/tGvAS4eyqFqC', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/tGvAS4eyqFqC')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251682')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251683" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/kJpkh8bHWap8', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/kJpkh8bHWap8')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251683')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251684" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPVEUF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPVEUF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251684')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251685" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPRGMF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPRGMF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251685')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251686" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251686')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251687" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251687')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251688" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251688')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251689" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251689')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251690" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html', 'external')"><img id="img" data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251690')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251691" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251691')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr></tbody>
        </table>
 
Última edição:
osea que puede haber varias imagenes con el data osea el código hasta 10 veces osea serian 10 link distintos
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

Ah ok, con un bucle y el codigo que te di:

PHP:
(function() {
	var imgs = document.getElementsByTagName('img'), url;
	for(var i=0; i < imgs.length; i++) {
		url = imgs[i].getAttribute('data-bind').match(/\('(.*)'\)/i);
		console.info(url[1]);
	}
}());
 

Anexos

  • 893f5720e1c640448e82e69fd3cd820d.webp
    893f5720e1c640448e82e69fd3cd820d.webp
    13,1 KB · Visitas: 20
Creo que es porque no hay imágenes o ninguna tiene el attributo data-bind, intenta así:

PHP:
(function() {
	var imgs = document.getElementsByTagName('img'), url;
	for(var i=0; i < imgs.length; i++) {
		if (url = imgs[i].getAttribute('data-bind').match(/\('(.*)'\)/i)) {
			console.info(url[1]);
		}
	}
}());

tu codigo funciona cuando lo pruebo en un html que solo contiene
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

pero cuando lo ejecuto en la pagina que necesito aplicar con el siguiente html
Cómo? te refieres a que puede haber varios enlaces en una sola imagen o a que puede haber varias imágenes en la misma página?

osea que puede haber varias imagenes con el data osea el código hasta 10 veces osea serian 10 link distintos
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

todo esta dentro de un contenedo

HTML:
<table class="table table-striped links-table dataTable no-footer" id="example2" role="grid" aria-describedby="example2_info">
            <thead>
                <tr role="row"><th class="name sorting_asc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Idioma: Activar para ordenar la columna de manera descendente" style="width: 452px;">Idioma</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Calidad: Activar para ordenar la columna de manera ascendente" style="width: 212px;">Calidad</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Uploader: Activar para ordenar la columna de manera ascendente" style="width: 142px;">Uploader</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Reportar: Activar para ordenar la columna de manera ascendente" style="width: 138px;">Reportar</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Ultima Actualización: Activar para ordenar la columna de manera ascendente" style="width: 301px;">Ultima Actualización</th></tr>
            </thead>
            <tbody>
                                                                                
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <!--<tr><td><div class="name"><button class="btn btn-primary" data-toggle="modal" data-target="#add-link-modal"><i class="fa fa-plus"></i> A&ntilde;adir Link</button></div></td><td></td><td></td><td></td><td></td></tr>-->
            <tr data-id="251682" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/tGvAS4eyqFqC', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/tGvAS4eyqFqC')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251682')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251683" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/kJpkh8bHWap8', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/kJpkh8bHWap8')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251683')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251684" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPVEUF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPVEUF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251684')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251685" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPRGMF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPRGMF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251685')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251686" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251686')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251687" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251687')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251688" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251688')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251689" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251689')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251690" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html', 'external')"><img id="img" data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251690')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251691" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251691')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr></tbody>
        </table>


sale el este error
http://image.prntscr.com/image/e484149dede54a0484af6dddc7131f63.png
 
tu codigo funciona cuando lo pruebo en un html que solo contiene
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

pero cuando lo ejecuto en la pagina que necesito aplicar con el siguiente html


osea que puede haber varias imagenes con el data osea el código hasta 10 veces osea serian 10 link distintos
HTML:
<img data-bind="attr: {src: app.utils.getFavicon('http://gamovideo.com/9tbtyuoti8ae')}" src="http://www.google.com/s2/favicons?domain=gamovideo.com">

todo esta dentro de un contenedo

HTML:
<table class="table table-striped links-table dataTable no-footer" id="example2" role="grid" aria-describedby="example2_info">
            <thead>
                <tr role="row"><th class="name sorting_asc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Idioma: Activar para ordenar la columna de manera descendente" style="width: 452px;">Idioma</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Calidad: Activar para ordenar la columna de manera ascendente" style="width: 212px;">Calidad</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Uploader: Activar para ordenar la columna de manera ascendente" style="width: 142px;">Uploader</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Reportar: Activar para ordenar la columna de manera ascendente" style="width: 138px;">Reportar</th><th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Ultima Actualización: Activar para ordenar la columna de manera ascendente" style="width: 301px;">Ultima Actualización</th></tr>
            </thead>
            <tbody>
                                                                                
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <!--<tr><td><div class="name"><button class="btn btn-primary" data-toggle="modal" data-target="#add-link-modal"><i class="fa fa-plus"></i> Añadir Link</button></div></td><td></td><td></td><td></td><td></td></tr>-->
            <tr data-id="251682" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/tGvAS4eyqFqC', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/tGvAS4eyqFqC')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251682')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251683" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'https://www.bigfile.to/file/kJpkh8bHWap8', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('https://www.bigfile.to/file/kJpkh8bHWap8')}" src="http://www.google.com/s2/favicons?domain=www.bigfile.to"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251683')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251684" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPVEUF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPVEUF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251684')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251685" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVeU5EYzFPRGMF9', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVeU5EYzFPRGMF9')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251685')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251686" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.datafile.com/d/TWpVMk9USXlPVGcF9/1x01.Qsxyng.mHD720p.rar')}" src="http://www.google.com/s2/favicons?domain=www.datafile.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251686')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251687" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/2vso512nysk3/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251687')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251688" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/6mu8je45qnxb/CR4SH1NG.S01E01.HDRip.RAiDON.avi')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251688')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251689" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://www.filefactory.com/file/5h8h1mmargd3/1x01.Qsxyng.mHD720p.mkv')}" src="http://www.google.com/s2/favicons?domain=www.filefactory.com"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251689')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251690" role="row" class="odd">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html', 'external')"><img id="img" data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/511c550bbc9324c7d16c72f5266e7d81/CR4SH1NG.S01E01.m720p.WEBRip.RAiDON.mkv.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>Micro-HD-720p</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251690')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr><tr data-id="251691" role="row" class="even">
                            <td class="name hover sorting_1" data-bind="click: playVideo.bind($data, 'http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html', 'external')"><img data-bind="attr: {src: app.utils.getFavicon('http://rapidgator.net/file/d89717df8cf45e8108500620900eb80f/CR4SH1NG.S01E01.HDRip.RAiDON.avi.html')}" src="http://www.google.com/s2/favicons?domain=rapidgator.net"><strong>Español</strong></td>
							<td>DVDRIP</td>
                            <td>HD gratis</td>
                            <th><i text-primary"=""></i> <a href="#" data-bind="click: report.bind($data, '251691')"><i class="fa fa-chain-broken" aria-hidden="true"></i></a></th>
                            <th>2017-04-12 19:51:09</th>
                        </tr></tbody>
        </table>


sale el este error
http://image.prntscr.com/image/e484149dede54a0484af6dddc7131f63.png

Qué raro, a mí me funciona:

57Ia36m.png
 
PHP:
(function() {
	var imgs = document.getElementsByTagName('img'), url;
	for(var i=0; i < imgs.length; i++) {
		if (imgs[i].getAttribute('data-bind')) {
			url = imgs[i].getAttribute('data-bind').match(/\('(.*)'\)/i)
			console.info(url[1]);
		}
	}
}());

Excelente capo ahora si anda perfecto, ahora depende de mi, muchas gracias por tomarte tu tiempo muy agradecido le verdad, un gran abrazo y saludo
 
Voltar
Topo