File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,13 @@ Parameters:
101101 * -ld local directory
102102``` bash
103103python ftp_download_file.py
104- ```
104+
105+ * # ## Fetch HTML
106+ This script fetch html response from the provided url and parse xml tag to get only text content and print out.
107+
108+ ` ` ` bash
109+ python fetch_html.py https://github.com
110+ ` ` ` ` ` `
105111
106112* # ## Get External IP
107113Gets the external ip-address from the current machine and prints it to the console
@@ -312,6 +318,7 @@ In case your browser stoped working delete/comment the following line in the scr
312318#### _ Windows_
313319 ` os.system("TASKKILL /F /IM " + brow + ".exe") `
314320
321+
315322## Release History
316323
317324* 0.0.1
@@ -356,6 +363,7 @@ The following people helped in creating the above content.
356363* <a href =" https://github.com/SuryaThiru " target =" _blank " >Surya K</a >
357364* <a href =" https://github.com/szepnapot " target =" _blank " >Peter L.</a >
358365* <a href =" https://github.com/ehnydeel " target =" _blank " >Andreas K.</a >
366+ * <a href =" https://github.com/zinuzoid " target =" _blank " >Jetsada Machom</a >
359367* <a href =" https://github.com/pr0me " target =" _blank " >Lukas S.</a >
360368* <a href =" https://github.com/iyanuashiri " target =" _blank " >Iyanu Ashiri</a >
361369* <a href =" https://github.com/harshvardhan58 " target =" _blank " >Harshvardhan Singh</a >
Original file line number Diff line number Diff line change 1+ import urllib .request
2+ import sys
3+ from lxml import html
4+
5+ if len (sys .argv ) < 2 :
6+ print ('Usage example: python fetch_html.py https://github.com' )
7+ sys .exit (1 )
8+
9+ url = sys .argv [1 ]
10+ response = urllib .request .urlopen (url )
11+ html_text = response .read ().decode ('UTF-8' )
12+ text = html .fromstring (html_text ).text_content ()
13+
14+ print (text )
15+
You can’t perform that action at this time.
0 commit comments