| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/usr/bin/env python3
- from news import News
- from db import db
- from pprint import pprint
- d = db()
- cat = 1
- kw = d.get_keywords(cat)
- f = open("links")
- links = f.read().split('\n')
- f.close()
- not_matched=[]
- matched=[]
- for url in links:
- if url == "":
- continue
- n = News(url, "57351207d47db2159a918636", "9to5", cat, kw)
- out = n.get()
- if out is not None and "weight" in out and out["weight"] > 1:
- matched.append(url)
- continue
- not_matched.append(url)
- #print("[DID NOT MATCH] %s" % url)
- p = {}
- p["kw"] = out["kw"]
- p["matches"] = out["matches"]
- p["title"] = out["title"]
- p["url"] = out["url"]
- p["weight"] = out["weight"]
- p["text"] = out["text"]
- #pprint(out)
- # print("#######################################")
- # d.insert_article(n.get())
- # forbesUtilCookie={'toURL':'http://www.forbes.com/sites/lizryan/2016/05/21/want-to-hire-great-people-stop-asking-stupid-interview-questions/','refURL':'','referrer':''};
- # Path=/; Domain=.forbes.com; Expires=Session
- for n in matched:
- print("[KEYWORD MATCH] %s" % n)
- for n in not_matched:
- print("[DID NOT MATCH] %s" % n)
|