|
@@ -0,0 +1,22 @@
|
|
|
|
|
+#!/usr/bin/env python3
|
|
|
|
|
+import requests
|
|
|
|
|
+import json
|
|
|
|
|
+
|
|
|
|
|
+def parse(link):
|
|
|
|
|
+ s_r = requests.session()
|
|
|
|
|
+ print_link=link+"/print/"
|
|
|
|
|
+ cookie = {'toURL':link,'refURL':'','referrer':''}
|
|
|
|
|
+ result = s_r.get(print_link, cookies=cookie)
|
|
|
|
|
+ out = result.content.decode("utf-8")
|
|
|
|
|
+ out = out.split("\n")
|
|
|
|
|
+
|
|
|
|
|
+ ret = {'title':"", 'body': ""}
|
|
|
|
|
+ for l in out:
|
|
|
|
|
+ if "fbs_settings.content = {" in l:
|
|
|
|
|
+ substr=l.split("=",1)[1]
|
|
|
|
|
+ substr="".join(substr.rsplit(";",1))
|
|
|
|
|
+ try:
|
|
|
|
|
+ ret = json.loads(substr)
|
|
|
|
|
+ except:
|
|
|
|
|
+ pass
|
|
|
|
|
+ return "<html><head><title>%s</title></head><body><article>%s</article></body></html>" %(ret["title"], ret["body"] )
|