From 82166863a0c4a8c101d041123c4ac2f098c9ef9a Mon Sep 17 00:00:00 2001 From: sstvinc2 Date: Mon, 13 Feb 2017 21:40:12 -0600 Subject: Better URL obfuscation method Was pointing to static HTML files, but they changed anytime the program was re-run, causing links to point to unexpected URLs. Changed to javascript obfuscation, using an onclick event rather than the href, which sufficiently hides the URL for most purposes. --- html_template/newtemplate.html | 38 +++++++++++++++++++------------------- html_template/template.html | 20 ++++++++++---------- main.py | 2 +- unbiasedFunctions.py | 8 ++++++-- 4 files changed, 36 insertions(+), 32 deletions(-) diff --git a/html_template/newtemplate.html b/html_template/newtemplate.html index 7170a4a..923dee2 100644 --- a/html_template/newtemplate.html +++ b/html_template/newtemplate.html @@ -2,7 +2,7 @@ - + UnBiased @@ -17,7 +17,7 @@
- +
Rand Paul and Cory Booker push bipartisan effort to limit solitary confinement for juveniles
@@ -26,7 +26,7 @@
- +
Bibi and Donald
@@ -35,7 +35,7 @@
- +
David Oyelowo on How to Play a Real King
@@ -44,7 +44,7 @@
- +
Judge orders Ohio village to pay back $3 million to lead-footed drivers
@@ -56,7 +56,7 @@
- +
@@ -64,7 +64,7 @@
- +
@@ -72,7 +72,7 @@
- +
@@ -80,7 +80,7 @@
- +
@@ -88,7 +88,7 @@
- +
@@ -96,7 +96,7 @@
- +
@@ -109,35 +109,35 @@
diff --git a/html_template/template.html b/html_template/template.html index 87e34e8..befaaff 100644 --- a/html_template/template.html +++ b/html_template/template.html @@ -17,7 +17,7 @@
- +
xxTitle1-1xx
@@ -26,7 +26,7 @@
- +
xxTitle1-2xx
@@ -35,7 +35,7 @@
- +
xxTitle1-3xx
@@ -44,7 +44,7 @@
- +
xxTitle1-4xx
@@ -56,7 +56,7 @@
- +
@@ -64,7 +64,7 @@
- +
@@ -72,7 +72,7 @@
- +
@@ -80,7 +80,7 @@
- +
@@ -88,7 +88,7 @@
- +
@@ -96,7 +96,7 @@
- +
diff --git a/main.py b/main.py index 3a22875..163f73a 100644 --- a/main.py +++ b/main.py @@ -9,7 +9,7 @@ def main(): print('-----------------------') run() print('-----------------------') - time.sleep(120) + time.sleep(600) def run(): sourceList=[] diff --git a/unbiasedFunctions.py b/unbiasedFunctions.py index a67f800..c2f62c0 100644 --- a/unbiasedFunctions.py +++ b/unbiasedFunctions.py @@ -147,10 +147,12 @@ def buildOutput(newsSourceArr): source=newsSourceArr[h1RandomSources[i]] randomArticle=random.sample(range(len(source.h1Arr)), 1)[0] article=source.h1Arr[randomArticle] - #template=template.replace('xxURL1-'+str(i+1)+'xx', article.url) + template=template.replace('xxURL1-'+str(i+1)+'xx', article.url) + ''' r=open('/var/www/html/redirects/h1-'+str(i+1)+'.html', 'w') r.write('') r.close() + ''' template=template.replace('xxTitle1-'+str(i+1)+'xx', article.title) template=template.replace('xxImg1-'+str(i+1)+'xx', article.img) desc=article.description @@ -165,10 +167,12 @@ def buildOutput(newsSourceArr): source=newsSourceArr[h2RandomSources[i]] randomArticle=random.sample(range(len(source.h2Arr)), 1)[0] article=source.h2Arr[randomArticle] - #template=template.replace('xxURL2-'+str(i+1)+'xx', article.url) + template=template.replace('xxURL2-'+str(i+1)+'xx', article.url) + ''' r=open('/var/www/html/redirects/h2-'+str(i+1)+'.html', 'w') r.write('') r.close() + ''' template=template.replace('xxTitle2-'+str(i+1)+'xx', article.title) template=template.replace('xxImg2-'+str(i+1)+'xx', article.img) -- cgit v1.2.3