diff options
author | sstvinc2 <sstvinc2@gmail.com> | 2017-02-13 21:40:12 -0600 |
---|---|---|
committer | sstvinc2 <sstvinc2@gmail.com> | 2017-02-13 21:40:12 -0600 |
commit | 82166863a0c4a8c101d041123c4ac2f098c9ef9a (patch) | |
tree | 51104dd4887dcc8c02f7fdfe62e185468eddf365 | |
parent | 028845d66a407f8af072c7b11be7be4bb4ae4602 (diff) |
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.
-rw-r--r-- | html_template/newtemplate.html | 38 | ||||
-rw-r--r-- | html_template/template.html | 20 | ||||
-rw-r--r-- | main.py | 2 | ||||
-rw-r--r-- | 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 @@ <html> <head> <meta charset="utf-8"> - <link rel="stylesheet" href="testtemplate.css"> + <link rel="stylesheet" href="unbiased.css"> <title>UnBiased</title> </head> <body> @@ -17,7 +17,7 @@ <div id="top-stories"> <div class="top-story"> - <a target="_blank" href="redirects/h1-1.html" id="top-story-1"> + <a target="_blank" id="top-story-1" href="" onclick="location.href='xxURL1-1'"> <div class="top-stories-img" style="background-image: url('http://www.theblaze.com/wp-content/uploads/2017/02/GettyImages-465794068-1280x720.jpg');" /> </div> <div class="top-stories-hed">Rand Paul and Cory Booker push bipartisan effort to limit solitary confinement for juveniles</div> @@ -26,7 +26,7 @@ </div> <div class="top-story"> - <a target="_blank" href="redirects/h1-2.html" id="top-story-2"> + <a target="_blank" href="" onclick="location.href='xxURL1-2'"> <div class="top-stories-img" style="background-image: url('http://cdn.weeklystandard.biz/cache/r960-90b8d8d5cbcef212ecae2a5c455fed8f.jpg');" /> </div> <div class="top-stories-hed">Bibi and Donald</div> @@ -35,7 +35,7 @@ </div> <div class="top-story"> - <a target="_blank" href="redirects/h1-3.html" id="top-story-3"> + <a target="_blank" href="" onclick="location.href='xxURL1-3'"> <div class="top-stories-img" style="background-image: url('https://static01.nyt.com/images/2017/02/13/multimedia/DavidOyelowo-UnitedKingdom/DavidOyelowo-UnitedKingdom-facebookJumbo.png');" /> </div> <div class="top-stories-hed">David Oyelowo on How to Play a Real King</div> @@ -44,7 +44,7 @@ </div> <div class="top-story"> - <a target="_blank" href="redirects/h1-4.html" id="top-story-4"> + <a target="_blank" href="" onclick="location.href='xxURL1-4'"> <div class="top-stories-img" style="background-image: url('http://a57.foxnews.com/images.foxnews.com/content/fox-news/us/2017/02/13/judge-orders-ohio-village-to-pay-back-3-million-to-lead-footed-drivers/_jcr_content/par/featured-media/media-0.img.jpg/0/0/1487019011476.jpg?ve=1');" /> </div> <div class="top-stories-hed">Judge orders Ohio village to pay back $3 million to lead-footed drivers</div> @@ -56,7 +56,7 @@ <div id="middle-stories"> - <a target="_blank" href="redirects/h2-1.html" > + <a target="_blank" href="" onclick="location.href='xxURL2-1'"> <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('http://www.theblaze.com/wp-content/uploads/2017/02/GettyImages-635148734-1280x720.jpg');"> </div> @@ -64,7 +64,7 @@ </div> </a> - <a target="_blank" href="redirects/h2-2.html" > + <a target="_blank" href="" onclick="location.href='xxURL2-2'"> <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('http://a57.foxnews.com/media2.foxnews.com/BrightCove/694940094001/2017/02/12/0/0/694940094001_5320280093001_5320267547001-vs.jpg?ve=1');"> </div> @@ -72,7 +72,7 @@ </div> </a> - <a target="_blank" href="redirects/h2-3.html" > + <a target="_blank" href="" onclick="location.href='xxURL2-3'"> <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('http://ichef.bbci.co.uk/news/1024/cpsprodpb/C9C5/production/_94635615_6c33162f-1c24-487d-8a51-bb7b13ec063f.jpg');"> </div> @@ -80,7 +80,7 @@ </div> </a> - <a target="_blank" href="redirects/h2-4.html" > + <a target="_blank" href="" onclick="location.href='xxURL2-4'"> <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('http://media1.s-nbcnews.com/j/newscms/2017_07/1900281/13217-oroville-dam-724a-rs_4a8b5ba9690488f11410f156833e1b70.nbcnews-fp-1200-800.jpg');"> </div> @@ -88,7 +88,7 @@ </div> </a> - <a target="_blank" href="redirects/h2-5.html" > + <a target="_blank" href="" > <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('http://cbsnews1.cbsistatic.com/hub/i/2017/02/13/4ad800d9-69ba-4102-a8ec-af12e8eb6adb/021317-news.jpg');"> </div> @@ -96,7 +96,7 @@ </div> </a> - <a target="_blank" href="redirects/h2-6.html" > + <a target="_blank" href="" > <div class="middle-story"> <div class="middle-stories-img" style="background-image: url('https://static01.nyt.com/images/2017/02/14/us/14townhall1/14townhall1-facebookJumbo.jpg');"> </div> @@ -109,35 +109,35 @@ <div id="bottom-stories"> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-1.html">xxTitle3-1xx</a> + <a target="_blank" href="">xxTitle3-1xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-2.html">xxTitle3-2xx</a> + <a target="_blank" href="">xxTitle3-2xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-3.html">xxTitle3-3xx</a> + <a target="_blank" href="">xxTitle3-3xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-4.html">xxTitle3-4xx</a> + <a target="_blank" href="">xxTitle3-4xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-5.html">xxTitle3-5xx</a> + <a target="_blank" href="">xxTitle3-5xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-6.html">xxTitle3-6xx</a> + <a target="_blank" href="">xxTitle3-6xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-7.html">xxTitle3-7xx</a> + <a target="_blank" href="">xxTitle3-7xx</a> </div> <div class="bottom-story"> - <a target="_blank" href="redirects/h3-8.html">xxTitle3-8xx</a> + <a target="_blank" href="">xxTitle3-8xx</a> </div> </div> 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 @@ <div id="top-stories">
<div class="top-story">
- <a target="_blank" href="redirects/h1-1.html" id="top-story-1">
+ <a target="_blank" href="" onclick="window.open('xxURL1-1xx', '_blank')">
<div class="top-stories-img" style="background-image: url('xxImg1-1xx');" />
</div>
<div class="top-stories-hed">xxTitle1-1xx</div>
@@ -26,7 +26,7 @@ </div>
<div class="top-story">
- <a target="_blank" href="redirects/h1-2.html" id="top-story-2">
+ <a target="_blank" href="" onclick="window.open('xxURL1-2xx', '_blank')">
<div class="top-stories-img" style="background-image: url('xxImg1-2xx');" />
</div>
<div class="top-stories-hed">xxTitle1-2xx</div>
@@ -35,7 +35,7 @@ </div>
<div class="top-story">
- <a target="_blank" href="redirects/h1-3.html" id="top-story-3">
+ <a target="_blank" href="" onclick="window.open('xxURL1-3xx', '_blank')">
<div class="top-stories-img" style="background-image: url('xxImg1-3xx');" />
</div>
<div class="top-stories-hed">xxTitle1-3xx</div>
@@ -44,7 +44,7 @@ </div>
<div class="top-story">
- <a target="_blank" href="redirects/h1-4.html" id="top-story-4">
+ <a target="_blank" href="" onclick="window.open('xxURL1-4xx', '_blank')">
<div class="top-stories-img" style="background-image: url('xxImg1-4xx');" />
</div>
<div class="top-stories-hed">xxTitle1-4xx</div>
@@ -56,7 +56,7 @@ <div id="middle-stories">
- <a target="_blank" href="redirects/h2-1.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-1xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-1xx');">
</div>
@@ -64,7 +64,7 @@ </div>
</a>
- <a target="_blank" href="redirects/h2-2.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-2xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-2xx');">
</div>
@@ -72,7 +72,7 @@ </div>
</a>
- <a target="_blank" href="redirects/h2-3.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-3xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-3xx');">
</div>
@@ -80,7 +80,7 @@ </div>
</a>
- <a target="_blank" href="redirects/h2-4.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-4xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-4xx');">
</div>
@@ -88,7 +88,7 @@ </div>
</a>
- <a target="_blank" href="redirects/h2-5.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-5xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-5xx');">
</div>
@@ -96,7 +96,7 @@ </div>
</a>
- <a target="_blank" href="redirects/h2-6.html" >
+ <a target="_blank" href="" onclick="window.open('xxURL2-6xx', '_blank')">
<div class="middle-story">
<div class="middle-stories-img" style="background-image: url('xxImg2-6xx');">
</div>
@@ -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('<html><head><script type="text/javascript">window.location="'+article.url+'"</script></head></html>')
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('<html><head><script type="text/javascript">window.location="'+article.url+'"</script></head></html>')
r.close()
+ '''
template=template.replace('xxTitle2-'+str(i+1)+'xx', article.title)
template=template.replace('xxImg2-'+str(i+1)+'xx', article.img)
|