forked from tanner/qotnews
Merge remote-tracking branch 'tanner/master'
This commit is contained in:
commit
bfa4108a8e
|
@ -84,8 +84,11 @@ def get_article(url):
|
||||||
|
|
||||||
def get_content_type(url):
|
def get_content_type(url):
|
||||||
try:
|
try:
|
||||||
headers = {'User-Agent': 'Twitterbot/1.0'}
|
headers = {
|
||||||
return requests.get(url, headers=headers, timeout=2).headers['content-type']
|
'User-Agent': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
|
||||||
|
'X-Forwarded-For': '66.249.66.1',
|
||||||
|
}
|
||||||
|
return requests.get(url, headers=headers, timeout=5).headers['content-type']
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -58,15 +58,15 @@ class Feed extends React.Component {
|
||||||
{error && <p>Connection error?</p>}
|
{error && <p>Connection error?</p>}
|
||||||
{stories ?
|
{stories ?
|
||||||
<div>
|
<div>
|
||||||
{stories.map((x, i) =>
|
{stories.map(x =>
|
||||||
<div className='item' key={i}>
|
<div className='item' key={x.id}>
|
||||||
<div className='title'>
|
<div className='title'>
|
||||||
<Link className='link' to={'/' + x.id}>
|
<Link className='link' to={'/' + x.id}>
|
||||||
<img className='source-logo' src={logos[x.source] || logos[x.source.split(' ')[0]]} alt='source logo' /> {x.title}
|
<img className='source-logo' src={logos[x.source] || logos[x.source.split(' ')[0]]} alt='source logo' /> {x.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<span className='source'>
|
<span className='source'>
|
||||||
​({sourceLink(x)})
|
({sourceLink(x)})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,15 @@ class Results extends React.Component {
|
||||||
<p>Search results:</p>
|
<p>Search results:</p>
|
||||||
<div className='comment lined'>
|
<div className='comment lined'>
|
||||||
{stories.length ?
|
{stories.length ?
|
||||||
stories.map((x, i) =>
|
stories.map(x =>
|
||||||
<div className='item' key={i}>
|
<div className='item' key={x.id}>
|
||||||
<div className='title'>
|
<div className='title'>
|
||||||
<Link className='link' to={'/' + x.id}>
|
<Link className='link' to={'/' + x.id}>
|
||||||
<img className='source-logo' src={logos[x.source]} alt='source logo' /> {x.title}
|
<img className='source-logo' src={logos[x.source]} alt='source logo' /> {x.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<span className='source'>
|
<span className='source'>
|
||||||
​({sourceLink(x)})
|
({sourceLink(x)})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user