Skip to content

Commit 755874b

Browse files
committed
Some sites just refuses bot connection, so no Twitterbot agent from now
1 parent 4eda5c1 commit 755874b

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
echo -e "df -h:\n`df -h`"
4444
echo "pwd: `pwd`"
4545
echo "nproc: `nproc`"
46-
echo "curl -s ifconfig.me/all:\n`curl -s ifconfig.me/all`"
46+
echo -e "curl -s ifconfig.me/all:\n`curl -s ifconfig.me/all`"
4747
4848
- name: Export vars to env
4949
env:

page_content_extractor/http.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def init_poolmanager(self, *args, **kwargs):
5151
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
5252

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

templates/base.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ <h3 id="{{ news.slug() }}">
280280
<li class="last-updated"
281281
data-submitted="{{ last_updated.strftime("%Y-%m-%dT%H:%M:%SZ") }}"
282282
data-toggle="tooltip"
283-
title="{{ last_updated.replace(microsecond=0) }} UTC">Last
284-
updated: <span>{{ last_updated.replace(microsecond=0) }} UTC</span>
283+
title="{{ last_updated.replace(microsecond=0) }} UTC">Last updated: <span>{{ last_updated.replace(microsecond=0) }} UTC</span>
285284
</li>
286285
{% endif %}
287286
</ul>

0 commit comments

Comments
 (0)