Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/04/2017, 16:22
American2010
 
Fecha de Ingreso: abril-2003
Mensajes: 1.129
Antigüedad: 21 años
Puntos: 34
Respuesta: Extraer cadena de valores desde URL

Yo no se por qué pero luego de 14 años en el Foro, me sigue pasando lo mismo, hago una consulta, y ni bien vuelvo al código y pruebo algo distinto, doy con la solución.

Con un poco de ayuda de Google y buscando algo distinto, di con algo que me solucionó el problema, dejo el código para los interesados

Código Java:
Ver original
  1. String theTitlePattern = "<title>  (.*?) - YouTube</title>";
  2.         String theImagePattern = "<link rel=\"image_src\" href=\"(.*?)\">";
  3.        
  4.         Pattern titlePattern = Pattern.compile(theTitlePattern);
  5.         Matcher titleMatcher = titlePattern.matcher(output);
  6.        
  7.         if (titleMatcher.find()){
  8.              System.out.println(titleMatcher.group(1));
  9.         }
  10.        
  11.         Pattern imagePattern = Pattern.compile(theImagePattern);
  12.         Matcher imageMatcher = imagePattern.matcher(output);
  13.        
  14.         if (imageMatcher.find()){
  15.              System.out.println(imageMatcher.group(1));
  16.         }

Perdón por las molestias, aunque es bueno estar de vuelta en el Foro :D Espero que esto quede de ayuda para alguien que lo pueda necesitar.
__________________
elGastronomo