Advertisement
Guest User

SCALA GEN FILTRAGE URL

a guest
Jan 18th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.63 KB | None | 0 0
  1. package filtrageURLs
  2. import library._
  3.  
  4. object main extends FiltrageURLs {
  5.   private var result : List[String] = List()
  6.  
  7.   def filtreAnnonce(h:Html):List[String] = {
  8.       h match {
  9.         case Tag("a",attributes,_) => {
  10.           result = result :+ extraireLien(attributes)
  11.         }
  12.         case Tag(_,_,courant) => {
  13.           for (e <- courant) {
  14.             if (e != List()) filtreAnnonce(e)
  15.           }
  16.         }
  17.         case _ => ()
  18.       }
  19.    }
  20.  
  21.   def extraireLien(a : List[(String, String)]) : String = {
  22.       for (p <- a) {
  23.         if(p._1 == "href")  p._2
  24.        
  25.       }
  26.      
  27.       "yo"
  28.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement