Skip to content

Commit

Permalink
Some sites just refuses bot connection, so no Twitterbot agent from now
Browse files Browse the repository at this point in the history
  • Loading branch information
polyrabbit committed Sep 12, 2023
1 parent 4eda5c1 commit edcffb8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Expand Up @@ -43,7 +43,7 @@ jobs:
echo -e "df -h:\n`df -h`"
echo "pwd: `pwd`"
echo "nproc: `nproc`"
echo "curl -s ifconfig.me/all:\n`curl -s ifconfig.me/all`"
echo -e "curl -s ifconfig.me/all:\n`curl -s ifconfig.me/all`"
- name: Export vars to env
env:
Expand Down
2 changes: 1 addition & 1 deletion hacker_news/news.py
Expand Up @@ -262,7 +262,7 @@ def fetch_feature_image(self):

def summarize_by_llama(self, content):
if config.disable_llama:
logger.warning("LLaMA is disabled by env DISABLE_LLAMA=1")
logger.info("LLaMA is disabled by env DISABLE_LLAMA=1")
return ''

start_time = time.time()
Expand Down
2 changes: 1 addition & 1 deletion page_content_extractor/http.py
Expand Up @@ -51,7 +51,7 @@ def init_poolmanager(self, *args, **kwargs):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

# Some sites just refuses bot connection
ua = UserAgent(browsers=['chrome'], fallback='Twitterbot/1.0')
ua = UserAgent(browsers=['chrome'], min_percentage=10.0)
ua_str = ua.random
logger.info(f'Use user-agent {ua_str}')

Expand Down
3 changes: 1 addition & 2 deletions templates/base.html
Expand Up @@ -280,8 +280,7 @@ <h3 id="{{ news.slug() }}">
<li class="last-updated"
data-submitted="{{ last_updated.strftime("%Y-%m-%dT%H:%M:%SZ") }}"
data-toggle="tooltip"
title="{{ last_updated.replace(microsecond=0) }} UTC">Last
updated: <span>{{ last_updated.replace(microsecond=0) }} UTC</span>
title="{{ last_updated.replace(microsecond=0) }} UTC">Last updated: <span>{{ last_updated.replace(microsecond=0) }} UTC</span>
</li>
{% endif %}
</ul>
Expand Down

0 comments on commit edcffb8

Please sign in to comment.