'''
Created on Jan 29, 2016

@author: Martin Koerner <info@mkoerner.de>
'''

# https://github.com/Mimino666/langdetect
from langdetect import detect 
from bs4 import BeautifulSoup
import urllib

url = 'http://bund.de'
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
html_body = soup.body.get_text(" ")


print detect(html_body)

@@ -191,32 +191,568 @@
 lib%0A
-%0Aurl = 'http://bund.de'%0A
+import argparse%0A%0A# generate help text for arguments%0Aparser = argparse.ArgumentParser(description='Extracts languages from a list of Websites given by their URL')%0Aparser.add_argument('input',%0A                   help='a file path to the output file generated by this program')%0Aparser.add_argument(%22--output%22, dest=%22output%22, metavar='output path', type=str)%0Aargs = parser.parse_args()%0A%0Ainputfile_path=args.input%0Aoutputfile_path=args.output%0A%0Aoutput = open(outputfile_path, 'w')%0A%0Afor line in open(inputfile_path,'r'):%0A    line=line.rstrip('%5Cn')%0A%0A    url = line%0A    
 html
@@ -781,16 +781,20 @@
 .read()%0A
+    
 soup = B
@@ -812,16 +812,20 @@
 p(html)%0A
+    
 html_bod
@@ -856,16 +856,21 @@
  %22)%0A
-%0A%0Aprint 
+    language=
 dete
@@ -883,8 +883,123 @@
 l_body)%0A
+    print line+%22 --%3E %22+language%0A%0A    # TODO write as json%0A    output.write(line+%22%5Ct%22+language+%22%5Cn%22)%0A%0Aoutput.close()

Add argparse and file iteration to website_language_extraction