|
|
@@ -0,0 +1,30 @@
|
|
|
+#!/usr/bin/python3
|
|
|
+import newspaper
|
|
|
+from newspaper import Article,Config
|
|
|
+import sys
|
|
|
+
|
|
|
+url = "http://feeds.wsjonline.com/~r/wsj/deals/feed/~3/lnaq0DpDaYI/"
|
|
|
+if url == "":
|
|
|
+ print("pls url")
|
|
|
+ sys.exit(1)
|
|
|
+
|
|
|
+config = Config()
|
|
|
+config.language='en'
|
|
|
+config.memoize_articles=False
|
|
|
+config.keep_article_html=True
|
|
|
+config.request_timeout=10
|
|
|
+config.fetch_images=False
|
|
|
+config.browser_user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"
|
|
|
+config.verbose=True
|
|
|
+
|
|
|
+
|
|
|
+import wsj
|
|
|
+print(url)
|
|
|
+html=wsj.parse(url)
|
|
|
+a = Article(url=url,config=config)
|
|
|
+a.download(html=html)
|
|
|
+#print("dl")
|
|
|
+a.parse()
|
|
|
+print("parsed")
|
|
|
+print(a.text)
|
|
|
+#
|