All pastes #2048896 Raw Edit

asdf

public java v1 · immutable
#2048896 ·published 2011-04-21 06:24 UTC
rendered paste body
import java.net.HttpURLConnection;import java.net.URL;import java.util.Scanner;import java.io.*;public class main {		public static void main(String args[]){		Scanner text=new Scanner(System.in);		try{					URL url = new URL(text.nextLine());						HttpURLConnection huc = (HttpURLConnection) url.openConnection();				huc.setRequestMethod("GET");		if (huc.getResponseCode() != HttpURLConnection.HTTP_OK) {			System.out.println(huc.getResponseMessage());				} else {					System.out.println(huc.getResponseMessage());					InputStream is = huc.getInputStream();					Scanner in = new Scanner(is);										while(in.hasNextLine()){						String zeile = in.nextLine();						if(zeile.contains("href") && zeile.contains("application/rss+xml"))						{							int zahl = zeile.indexOf("href");							String link = zeile.substring(zahl);							link = link.substring(6, link.length()-1);							link = link.substring(0, link.indexOf("\""));							System.out.println(link);														URL rss = new URL(link);														HttpURLConnection rsc = (HttpURLConnection) rss.openConnection();							rsc.setRequestMethod("GET");							if(rsc.getResponseCode() != HttpURLConnection.HTTP_OK)								System.out.println(rsc.getResponseMessage()); 							else{								System.out.println(rsc.getResponseMessage());								InputStream rs = rsc.getInputStream();								//Scanner sr = new Scanner(rs);								//while(sr.hasNextLine()){								//	System.out.println(sr.nextLine());								}							}														}																}						}		}			catch(Exception e){			e.printStackTrace();					}			}}