aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-03-31 17:25:35 +0000
committerterminaldweller <thabogre@gmail.com>2021-03-31 17:25:35 +0000
commit5cd1e564f1f7603989007f4e16e50f8c84010360 (patch)
treef0890e9cbad5e64ddef82fdb8dff23b55f211463
parentInitial commit (diff)
downloaddevourer-5cd1e564f1f7603989007f4e16e50f8c84010360.tar.gz
devourer-5cd1e564f1f7603989007f4e16e50f8c84010360.zip
first commit
-rwxr-xr-xmain.py37
-rwxr-xr-xrun.sh3
2 files changed, 40 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100755
index 0000000..c9a1af6
--- /dev/null
+++ b/main.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+# _*_ coding=utf-8 _*_
+
+import argparse
+import logging
+import traceback
+from newspaper import Article, build
+import fileinput
+
+
+class Argparser(object):
+ def __init__(self):
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--string", type=str, help="string")
+ parser.add_argument("--bool", action="store_true",
+ help="bool", default=False)
+ parser.add_argument("--dbg", action="store_true",
+ help="debug", default=False)
+ self.args = parser.parse_args()
+
+
+def main():
+ urls = (line for line in fileinput.input())
+ for url in urls:
+ parser = build(url)
+ for article in parser.articles:
+ a = Article(article.url)
+ try:
+ a.download()
+ a.parse()
+ print(a.text)
+ except Exception as e:
+ logging.error(traceback.format_exc(e))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..6037b8d
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env zsh
+
+sniff --src https://github.com/coinpride/CryptoList --url | ./main.py > out2.txt