|
@@ -1,6 +1,7 @@
|
|
|
import re
|
|
import re
|
|
|
import htmlmin
|
|
import htmlmin
|
|
|
import datetime
|
|
import datetime
|
|
|
|
|
+import html
|
|
|
|
|
|
|
|
from functions import sanitizeUrl
|
|
from functions import sanitizeUrl
|
|
|
from newspaper import Article
|
|
from newspaper import Article
|
|
@@ -60,7 +61,7 @@ class News():
|
|
|
self.PUBLISH_DATE=a.publish_date
|
|
self.PUBLISH_DATE=a.publish_date
|
|
|
self.SUMMARY=a.summary
|
|
self.SUMMARY=a.summary
|
|
|
self.TEXT=a.text
|
|
self.TEXT=a.text
|
|
|
- self.TITLE=a.title
|
|
|
|
|
|
|
+ self.TITLE=self.fix_title(a.title)
|
|
|
self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
|
# if html is None:
|
|
# if html is None:
|
|
|
# self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
# self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
@@ -93,6 +94,12 @@ class News():
|
|
|
"title": self.TITLE
|
|
"title": self.TITLE
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ def fix_title(self,n):
|
|
|
|
|
+ while(html.unescape(n)!=n):
|
|
|
|
|
+ n=html.unescape(n)
|
|
|
|
|
+ n=n.replace("&Dquot",'"')
|
|
|
|
|
+ return n
|
|
|
|
|
+
|
|
|
def dedup(self,val):
|
|
def dedup(self,val):
|
|
|
return list(set(val))
|
|
return list(set(val))
|
|
|
|
|
|