2022年11月25日星期五

世界杯 4K 2万码率 50帧抖音直播流




抖音4K 50帧


  1. http://39.135.41.243/PLTV/88888888/224/3221226716/index.m3u8?hls
复制代码

咪咕 4K HLG源 50帧
  1. http://117.136.156.3:80/000000001000/3000000010000005180/index.m3u8
复制代码

咪咕 4K HLG源 50帧 (备用)


  1. http://111.20.105.192:6610/000000001000/5000000008000023254/index.m3u8?channel-id=bestzb&Contentid=5000000008000023254&livemode=1&stbId=3
复制代码

CCTV16 4K SDR源 25帧
  1. http://live.cooltv.top/tv/aishang.php?id=cctv164k
复制代码

CCTV16 4K HLG源 25帧
  1. http://liveop.cctv.cn/hls/CCTV16HD/playlist.m3u8
复制代码

CCTV16 1080P HLG源 25帧
  1. http://[2409:8087:2001:20:2800:0:df6e:eb18]/ott.mobaibox.com/PLTV/3/224/3221228127/index.m3u8
复制代码

CCTV16 4K IPV6 HLG源 50帧

2022年8月14日星期日

python之gunicorn的配置

  • python常见的web部署搭配nginx+gunicorn,下面记录一下gunicorn的配置使用。

    安装gunicorn

    pip install gunicorn
    
    gunicorn -h  # 查看使用的命令
    

    gunicorn启动一个flask的应用程序

    # app.py
    from flask import Flask  
      
    def create_app():  
        app = Flask(__name__)  
        return app  
    app = create_app()  
      
    @app.route('/')  
    def index():  
        return 'hello world!' 
    
    if __name__ == '__main__':  
        app.run()   
    
    • 在flask的项目的目录下启动
    # 第一个app指的是app.py文件,第二个指的是flask应用的名字;
    gunicorn -w 4 -b 0.0.0.0:8000 app:app
    

    gunicorn的参数详解

    -c CONFIG    : CONFIG,配置文件的路径,通过配置文件启动;生产环境使用;
    
    -b ADDRESS   : ADDRESS,ip加端口,绑定运行的主机;
    
    -w INT, --workers INT:用于处理工作进程的数量,为正整数,默认为1;
    
    -k STRTING, --worker-class STRTING:要使用的工作模式,默认为sync异步,可以下载eventlet和gevent并指定
    
    --threads INT:处理请求的工作线程数,使用指定数量的线程运行每个worker。为正整数,默认为1。
    
    --worker-connections INT:最大客户端并发数量,默认情况下这个值为1000。
    
    --backlog int:未决连接的最大数量,即等待服务的客户的数量。默认2048个,一般不修改;
    
    -p FILE, --pid FILE:设置pid文件的文件名,如果不设置将不会创建pid文件
    
    
    --access-logfile FILE   :  要写入的访问日志目录
    
    --access-logformat STRING:要写入的访问日志格式
    
    --error-logfile FILE, --log-file FILE  :  要写入错误日志的文件目录。
    
    --log-level LEVEL   :   错误日志输出等级。
    
    
    --limit-request-line INT   :  HTTP请求头的行数的最大大小,此参数用于限制HTTP请求行的允许大小,默认情况下,这个值为4094。值是0~8190的数字。
    
    --limit-request-fields INT   :  限制HTTP请求中请求头字段的数量。此字段用于限制请求头字段的数量以防止DDOS攻击,默认情况下,这个值为100,这个值不能超过32768
    
    --limit-request-field-size INT  :  限制HTTP请求中请求头的大小,默认情况下这个值为8190字节。值是一个整数或者0,当该值为0时,表示将对请求头大小不做限制
    
    
    -t INT, --timeout INT:超过这么多秒后工作将被杀掉,并重新启动。一般设定为30秒;
    
    --daemon: 是否以守护进程启动,默认false;
    
    --chdir: 在加载应用程序之前切换目录;
    
    --graceful-timeout INT:默认情况下,这个值为30,在超时(从接收到重启信号开始)之后仍然活着的工作将被强行杀死;一般使用默认;
    
    --keep-alive INT:在keep-alive连接上等待请求的秒数,默认情况下值为2。一般设定在1~5秒之间。
    
    --reload:默认为False。此设置用于开发,每当应用程序发生更改时,都会导致工作重新启动。
    
    --spew:打印服务器执行过的每一条语句,默认False。此选择为原子性的,即要么全部打印,要么全部不打印;
    
    --check-config   :显示现在的配置,默认值为False,即显示。
    
    -e ENV, --env ENV: 设置环境变量;
    
    

    以配置文件的方式启动

    # gunicorn.conf
    
    # 并行工作进程数
    workers = 4
    # 指定每个工作者的线程数
    threads = 2
    # 监听内网端口5000
    bind = '127.0.0.1:5000'
    # 设置守护进程,将进程交给supervisor管理
    daemon = 'false'
    # 工作模式协程
    worker_class = 'gevent'
    # 设置最大并发量
    worker_connections = 2000
    # 设置进程文件目录
    pidfile = '/var/run/gunicorn.pid'
    # 设置访问日志和错误信息日志路径
    accesslog = '/var/log/gunicorn_acess.log'
    errorlog = '/var/log/gunicorn_error.log'
    # 设置日志记录水平
    loglevel = 'warning'
    
    • 启动unicorn
    gunicorn -c gunicorn.conf app:app
    

    注意:

    由于windows平台不支持gunicorn,gunicorn安装成功后,启动会出现

    ‘ImportError: No module named _curses / fcntl’错误;需要下载fcntl.py文件;

2022年6月13日星期一

Android没有ROOT删除预装的软件

 



 1241  adb shell pm list packages

 1242  adb shell pm uninstall jp.co.nttdocomo.lcsapp

 1243  adb shell pm uninstall --user 0 jp.co.nttdocomo.lcsapp

 1244  adb shell pm uninstall --user 0 com.sonymobile.email

 1245  adb shell pm uninstall --user 0 com.sony.tvsideview.videoph 

 1246  adb shell pm uninstall --user 0 com.sonymobile.entrance 

 1247  adb shell pm uninstall --user 0 com.sonyericsson.music 

 1248  adb shell pm uninstall --user 0 com.sonymobile.scan3d

 1249  adb shell pm uninstall --user 0 com.sonymobile.moviecreator.rmm 

 1250  adb shell pm uninstall --user 0 jp.co.nttdocomo.saigaiban 

 1251  adb shell pm uninstall --user 0 com.nttdocomo.android.store 

 1252  adb shell pm uninstall --user 0 com.nttdocomo.android.sdcardbackup 

 1253  adb shell pm uninstall --user 0 jp.co.nttdocomo.carriermail 

 1254  adb shell pm uninstall --user 0 com.android.contacts 

 1255  adb shell pm uninstall --user 0 com.nttdocomo.android.schedulememo 

 1256  adb shell pm uninstall --user 0 com.nttdocomo.android.mascot 

 1257  adb shell pm uninstall --user 0 com.nttdocomo.android.dmenu2 

 1258  adb shell pm uninstall --user 0 com.nttdocomo.android.msg 

 1259  adb shell pm uninstall --user 0 com.felicanetworks.mfc 

 1260  adb shell pm uninstall --user 0 com.felicanetworks.mfs

 1261  adb shell pm uninstall --user 0 com.felicanetworks.mfw.a.main 

 1262  adb shell pm uninstall --user 0 com.sonymobile.androidapp.machichara 

 1263  adb shell pm uninstall --user 0 com.nttdocomo.android.areamail 

 1264  adb shell pm uninstall --user 0 com.nttdocomo.android.kittingmanager 

 1265  adb shell pm uninstall --user 0 com.nttdocomo.android.bugreport 

 1266  adb shell pm uninstall --user 0 com.nttdocomo.android.apnsw 

 1267  adb shell pm uninstall --user 0 com.nttdocomo.android.atf 

 1268  adb shell pm uninstall --user 0 jp.co.nttdocomo.bridgelauncher 

 1269  adb shell pm uninstall --user 0 com.nttdocomo.android.accountwipe 

 1270  adb shell pm uninstall --user 0 com.nttdocomo.android.pf.dcmippushaggregator 

 1271  adb shell pm uninstall --user 0 com.nttdocomo.android.pf.dcmwappush 

 1272  adb shell pm uninstall --user 0 com.nttdocomo.android.applicationmanager 

 1273  adb shell pm uninstall --user 0 com.nttdocomo.android.accountauthenticator 

 1274  adb shell pm uninstall --user 0 com.nttdocomo.android.cloudset 

 1275  adb shell pm uninstall --user 0 com.nttdocomo.android.initialization 

 1276  adb shell pm uninstall --user 0 com.nttdocomo.android.dhome 

 1277  adb shell pm uninstall --user 0 com.nextbit.app 

 1278  adb shell pm uninstall --user 0 jp.co.nttdocomo.lcsappsub 

 1279  adb shell pm uninstall --user 0 jp.co.nttdocomo.anshinmode 

 1280  adb shell pm uninstall --user 0 com.nttdocomo.android.docomoset 

 1281  adb shell pm uninstall --user 0 com.nttdocomo.android.felicaremotelock 

 1282  adb shell pm uninstall --user 0 com.nttdocomo.android.idmanager 

 1283  adb shell pm uninstall --user 0 com.nttdocomo.android.iconcier

 1284  adb shell pm uninstall --user 0 com.nttdocomo.android.iconcier_contents 

 1285  adb shell pm uninstall --user 0 com.nttdocomo.android.voiceeditor 

 1286  adb shell pm uninstall --user 0 com.nttdocomo.android.remotelock 

 1287  adb shell pm uninstall --user 0 com.nttdocomo.osaifu.tsmproxy 

 1288  adb shell pm uninstall --user 0 com.nttdocomo.android.devicehelp 

 1289  adb shell pm uninstall --user 0 com.nttdocomo.android.wipe 

 1290  adb shell pm uninstall --user 0 com.rsupport.rsperm.ntt 

 1291  adb shell pm uninstall --user 0 com.nttdocomo.android.screenlockservice 

 1292  adb shell pm uninstall --user 0 com.nttdocomo.android.osv

 1293  adb shell pm uninstall --user 0 com.nttdocomo.android.phonemotion 

 1294  adb shell pm uninstall --user 0 com.nttdocomo.android.databackup 

 1295  adb shell pm uninstall --user 0 com.nttdocomo.android.remotelock 

 1296  adb shell pm uninstall --user 0 com.nttdocomo.android.wipe 

 1297  adb shell pm list

 1298  adb shell pm list packages

 1299  adb shell pm list packages | grep docomo

 1300  adb shell pm uninstall --user 0 com.nttdocomo.android.anmane2 

 1301  adb shell pm uninstall --user 0 com.nttdocomo.android.osv.res.overlay_305 

 1302  adb shell pm uninstall --user 0 com.sonymobile.docomoemoji.license 

 1303  adb shell pm list packages | grep docomo


2022年6月2日星期四

Python用wallet文件连接Oracle Autonomous Database

The views expressed in this article are my own and do not necessarily reflect the views of Oracle.

Have you always wanted to connect your Python applications to Oracle Autonomous Transaction Processing (ATP) or to Oracle Autonomous Data Warehouse (ADW)?

This is much easier than you ever thought. In this article I’ll tell you how to do this within a few steps.

First of all, go to the Oracle Cloud Free Tier website and sign up for a cloud account to receive access to Oracle Autonomous Database. Finally, provision an ATP instance. In my case it will be called MSATP.

Let’s start with accessing MSATP with Python. We will make only three steps for this:

  1. Download and configure the Oracle Instant Client
  2. Install the cx_Oracle for Python module
  3. Connect your Python application to the ATP instance
Es wurde kein Alt-Text für dieses Bild angegeben.

Download and configure the Oracle Instant Client

For downloading the Oracle Instant Client go to the download page. Select your architecture and download the Basic Package:

Es wurde kein Alt-Text für dieses Bild angegeben.

Unzip the file into a local directory, for example /home/opc/instantclient_19_9, on a Linux based Oracle Compute Cloud Service instance:

Es wurde kein Alt-Text für dieses Bild angegeben.

In case of no other Oracle software running on your system which could be impacted, add Instant Client to the runtime link path:

Es wurde kein Alt-Text für dieses Bild angegeben.

Finally export the library path in the shell where you run your applications:

Es wurde kein Alt-Text für dieses Bild angegeben.

Let’s continue with installing the cx_Oracle module for Python.

Install the cx_Oracle for Python module

First of all, install Python 3 if you haven’t done it before. In my example I will work with cx_Oracle 8. That’s why Python 3.5 or higher is required:

Es wurde kein Alt-Text für dieses Bild angegeben.

As you have already seen on the architectural diagram above, the cx_Oracle module will use the Oracle Client to communicate over Oracle Net with your ATP instance.

Install the cx_Oracle module from the Python Package Index (PyPI) using pip:

Es wurde kein Alt-Text für dieses Bild angegeben.

That’s it. Let’s start working with cx_Oracle and connect to the ATP instance.

Connect your Python application to the ATP instance

At the beginning you will need to download client security credentials to connect to your ATP instance. For downloading the client credentials (wallet) navigate to the Autonomous Transaction Processing details page of your ATP instance. Click on <<DB Connection>>:

Es wurde kein Alt-Text für dieses Bild angegeben.

Click on << Download Wallet >>:

Es wurde kein Alt-Text für dieses Bild angegeben.

Provide a password for your wallet and download the wallet to your Python environment. Subsequently unzip it, for example to /home/opc/wallet:

Es wurde kein Alt-Text für dieses Bild angegeben.
Es wurde kein Alt-Text für dieses Bild angegeben.

You will need only the following files to work with the cx_Oracle module: tnsnames.ora, sqlnet.ora and cwallet.sso.

You can store the wallet configuration file cwallet.sso separately from the tnsnames.ora and the sqlnet.ora files. Please remember, in any case you should store it securely. It’s important to protect this file and its contents to prevent unauthorized database access!

Edit the sqlnet.ora file with vi and enter the path to the cwallet.sso file:

Es wurde kein Alt-Text für dieses Bild angegeben.

As of now you can start accessing your ATP instance with Python. You can call off cx_Oracle.init_oracle_client() function at the beginning of your code:

Es wurde kein Alt-Text für dieses Bild angegeben.

Alternatively, you can export the environment variable TNS_ADMIN to /home/opc/wallet:

Es wurde kein Alt-Text für dieses Bild angegeben.

Test connection to the ATP instance

The following code snippet will query the products table in the sample schema SH. This read-only schema is being provisioned by default with your ATP instance:

from __future__ import print_function

import cx_Oracle
import sys
import getpass

try:
    cx_Oracle.init_oracle_client(config_dir="/home/opc/wallet")
except Exception as err:
    print(err);
    sys.exit(1);

 
password = getpass.getpass()
connection = cx_Oracle.connect('admin',password,'msatp_low')
 
sql = """
select prod_name from sh.products where rownum<5"""

print("All rows from the above query:")
cursor = connection.cursor()
for result in cursor.execute(sql):
    print(result)

print()

Copy and paste it to a file called querySH.py and run it in your Python environment:

Es wurde kein Alt-Text für dieses Bild angegeben.

This kind of connection is suitable for standalone connections, where your application will manage the user sessions to the ATP instance.

You may consider using cx_Oracle’s connection pooling for more sophisticated, performance critical scenarios and applications frequently connecting users to and disconnecting them from the ATP instance.

Bonus material: Simple Oracle Document Access (SODA)

As stated in the Oracle Documentation Simple Oracle Document Access (SODA) is a set of NoSQL-style APIs that let you create and store collections of documents (in particular JSON) in Oracle Database, retrieve them, and query them, without needing to know Structured Query Language (SQL) or how the documents are stored in the database.

cx_Oracle provides all methods and objects needed for working with SODA in your ATP instance.

The following code snippet will create a new collection in your ATP instance and insert a JSON document into this collection:

from __future__ import print_function
 
import cx_Oracle
import sys
import getpass

try:
    cx_Oracle.init_oracle_client(config_dir="/home/opc/wallet")
except Exception as err:
    print(err);
    sys.exit(1);
 

password = getpass.getpass()

connection = cx_Oracle.connect('admin',password,'msatp_low')

soda = connection.getSodaDatabase()

collection = soda.createCollection("mycollection")

content = {'empid':7782,'empdata': {'firstname': 'Scott', 'lastname': 'Tiger'},"Managerid":7839,"Deptid":10}
 
returnedDoc = collection.insertOneAndGet(content)
key = returnedDoc.key

connection.commit()
 
print('The key of the new SODA document is: ', key)


Copy and paste it to a file called soda.py and run it in your Python environment:

Es wurde kein Alt-Text für dieses Bild angegeben.

You can use the following code snippet to retrieve the JSON document stored in your new collection:

from __future__ import print_function

import cx_Oracle
import sys
import getpass

 
try:
    cx_Oracle.init_oracle_client(config_dir="/home/opc/wallet")
except Exception as err:
    print(err);
    sys.exit(1);

password = getpass.getpass()
key = input("Provide your doc key: ")

connection = cx_Oracle.connect('admin',password,'msatp_low')
soda = connection.getSodaDatabase()
collection = soda.createCollection("mycollection")

content = collection.find().key(key).getOne().getContent()

print(content)

Copy and paste it to a file called getSodaContent.py and run it in your Python environment:

Es wurde kein Alt-Text für dieses Bild angegeben.

That's it! You can now use the power and the efficiency of your Python applications with Oracle Autonomous databases!



I installed the library and when trying to access SQL in jupyter notebook with my credentials the following error appears:

DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help


As per documentation accessed on cx_Oracle page.

Step 1: install cx_Oracle

python -m pip install cx_Oracle --upgrade

Step 2: Download and extract Oracle Basic Client

For Windows download and extract Oracle Basic Instatnt client instantclient-basic-windows.x64-19.9.0.0.0dbru.zip file.

Step 3: Inform cx_Oracle module about the Instatnt Client location.

If you stick to documentation and extract them in c:\oracle folder then your script may look like this.

    import cx_Oracle
    cx_Oracle.init_oracle_client(lib_dir=r"C:\oracle\instantclient_19_9")

Now you will be free from the error.

2022年5月31日星期二

ubuntu全新设置用户和key登陆,开启docker

 

    当开启一台全新的ubuntu,登陆后要做的事情。

netstat -aptlun 查看打开的端口

adduser name

usermod -a -G adm name

usermod -a -G sudo name

mkdir ~/.ssh

mv my.pub ~/.ssh/authorized_keys

chmod 700 ~/.ssh/

sudo vi /etc/ssh/sshd_config

sudo visudo

jia  ALL=(ALL) NOPASSWD:ALL

sudo snap install docker

sudo groupadd docker 

sudo gpasswd -a $USER docker

newgrp docker 

cat /etc/group | grep docker

2022年5月3日星期二

Blogger搭建国内可正常访问博客(超详细教程)

 


一、经历

  • 前后折腾博客花了不少时间,之前本来想着弄着玩玩,于是随意买了个便宜的域名:axutongxue.top,几经周折终于搭建出满意的博客后,当机立断新买了axutongxue.com这个域名,准备认真写博了。
  • 中途在Github上用hexo也搭建了一个博客,不过可能是做公众号影响,比较习惯在本地用markdown写好,然后再在线渲染css,网页发布。不太习惯在hexo的发布博文方式,另外感觉如果以后换电脑,Github博客搬迁也是个麻烦,最后还是就想用Blogger了。
  • 写这篇文章,记录一下在Blogger上费下的精力,希望也能对一些想用 Blogger 写博客的人带来帮助。
感谢JoeyLiu大佬在我搭建过程中给了许多的帮助
他的博客:https://blog.iljw.me/
他的公众号:Joeyspace

二、国内访问 Blogger

1 首先准备

请确认自己能够科学上网。
  • 不会的话,我这里写有一篇教程:http://mooc1.chaoxing.com/zt/201723393.html
  • 购买域名。没什么好讲的,各个地方都能买,我图便利,直接在阿里云买的域名。(同一个域名,在腾讯云买还要便宜点,不过因为我上一个域名就在阿里云买的,所以这次顺便就在阿里云买了)

2.设置解析

1.Blogger要求的设置

  • 打开Blogger后台,找到设置—基本,Blogger 会提示你需要设置两个 CNAME 分别解析到ghs.google.com 和 ***.dv.googlehosted.com(每一个人的都不一样)
  • 为了 Blogger 可以在国内访问,我们不能直接按上述的解析。
  • 我们得将第一个 CNAME 解析:记录类型: A 记录,主机记录:WWW,记录值由「ghs.google.com」改成 「国内可访问的 IP」
  • 后面的一个CNAME 解析不变:记录类型:CNAME,主机记录:ai76xxxxxxxxxxx,记录值:gv-j5jxxxxxxxxxx

2. 寻找国内可访问的 IP

  • 可以使用站长之家 Ping 工具:http://ping.chinaz.com/
  • 如下图所示,Ping检测:ghs.google.com
  • 找一个国内可访问的 IP。
  • 注意:香港的IP延迟虽然小,但是不行。

3.域名后台设置解析

打开阿里云控制台—域名—域名列表—解析,照第一步所说的那样样设置,如下图:
至此,域名解析设置完成,当然这样还不够,我们还得修改Blogger自带的博客模板。
备注:如果想要实现不带www访问
添加:记录类型: A 记录,主机记录:@,记录值同为找到的 「国内可访问的 IP」
如下图这样:

这样用 axutongxue.com 也可以访问我的博客了

4.启用https

三、修改 Blogger 的模板代码

我使用的是官方Contempo这套主题模板,简洁,美观,符合我的审美。 折腾过程中,在JoeyLiu大佬帮助下发现Contempo这套模板实际上所需要修改的地方很少,并且JoeyLiu大佬也用的这套模板。
如果你想使用非官方模板,这里有详细的教程:https://www.lawpai.com/2016/10/blogger.html?m=1
提示:在修改代码之前,建议先保存备份一下原来的模板,这是一个好习惯。
Blogger 模板网站地址
  1. http://www.mybloggerthemes.com/
  2. https://btemplates.com/
  3. https://gooyaabitemplates.com/
  4. https://newbloggerthemes.com/

1. 下载Contempo模板xml文件

在弹出的窗口中选择「下载主题背景」

2.修改XML

针对Contempo模板,我们只需要屏蔽Blogger自动加载项即可。
用notepad++、Sublime、Atom等软件打开下载好的XML
我用的是Sublime_Text3,顺便提供一个自用版本的下载地址吧:点击下载
打开XML后,Sublime里面Ctrl+F搜索

1.屏蔽Blogger自动加载项即可

将<head>替换为
&lt;!--<head>--&gt;&lt;head&gt;

将</head>替换为
&lt;/head&gt;&lt;!--</head>--&gt;

将</body>替换为
&lt;!--</body>--&gt;&lt;/body&gt;

2.替换背景图

搜索“url”,大概在第49行,可以找到一个链接,将其替换为你的背景图片地址。
下图是我替换好之后的,我用的是Github图床。
之前一直用的人民网图床,一直不显示背景图 http://bbs1.people.com.cn/postImages/Y0/70/D2/AB/69/1539491146601.jpg,换用Github图床后,即可正常显示背景图(具体什么问题未知)

3.JS问题

到目前为止,博客已经基本上可以不翻墙访问了。但是有一个问题:打开网站后,这两个按钮按不了
因为模板里有这一段代码: <b:template-script async='true' name='indie' version='1.0.0'/>执行它,会加载下述的 js 文件
  • https://resources.blogblog.com/blogblog/data/res/1468123664-indie_compiled.js
记得删除<b:template-script async='true' name='indie' version='1.0.0'/>这行代码,然后翻墙打开上面的网址,右键另存为得到一个.js文件,把它上传到国内空间的对象存储(阿里云,腾讯云、网易云、又拍云、七牛云…都是免费注册)
复制得到js的外链地址,然后在xml文件里面引用此js文件,引用方式见下图(你可以跟着我在相同的位置引用)
<script async='async' src='你的外链地址'/>
至此,xml基本修改完毕,打开blogger后台,上传修改完的主题模板

3.解决缩略图问题

现在打开主页,唯一的问题是缩略图无法显示,原因是Blogger 新版本的语法,其获取文章图片链接时,会将其转换成 https://lh4.googleusercontent.com/proxy/....这种形式,所以不翻墙无法显示。
在这里感谢JoeyLiu大佬提供了解决办法:Blogger 博文首页缩略图解决方法

使用 JavaScript 代码

Blogger 有一个语法可以获取文章的全部内容,我们可以使用 JavaScript 利用正则表达式将文章中的第一张图片链接提取出来。
代码如下:
将 JS 代码放置于 </body> 标签前:
<b:if cond='data:blog.pageType in {"index","searchQuery","searchLabel","archive"}'> <!--如果当前页是首页,搜索页,标签页,那么代码继续执行-->
    <script defer='defer'>
        //<![CDATA[
        var postThumbnails = document.getElementsByClassName("post-thumbnail");
        var postContents = document.getElementsByClassName("post-text");
        for (var i=0;i<postContents.length;i++)
        {
            var postContent = postContents[i].innerText;
            var imgReg = /<img.*?(?:>|\/>)/gi;
            var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;
            var imgTags = postContent.match(imgReg);
            imgSrcs = imgTags[0].match(srcReg);
            imgSrc = imgSrcs[1];
            postThumbnails[i].setAttribute('src', imgSrc);
        }
        //]]>
    </script></b:if>
修改模板,搜索data:post.featuredImage,在缩略图处改成下代码:
<b:if cond='data:post.featuredImage'>  <!--判断文章内是否有图片,有则代码继续执行-->
    <div class='snippet-thumbnail'>  <!--创建一个 div 容器,缩略图放置在这里-->
        <img class='post-thumbnail' sizes='(max-width: 800px) 20vw, 128px' src='https://ae01.alicdn.com/kf/HTB1Gb7LUmzqK1RjSZFL5jcn2XXac.gif'/>  <!--预先放置一个加载图片,增强用户体验-->
        <textarea class='post-text' style='display:none;'><data:post.body.escaped/></textarea> <!--这里放置文章全文,图片从中提取,样式设置为不显示-->
    </div></b:if>
此方法优点是无需手动设置缩略图,比较省心
不同模板会有所不同,详情请看大佬原教程的评论区:Blogger 博文首页缩略图解决方法

4.解决头像问题

如果你添加了个人资料小部件
访客不翻墙的话,是无法正常显示头像的

解决办法如下

还是在blogger后台—主题背景—修改HTML,搜索“profile-img”找到这下面一行
把expr:src='dat:authorPhoto.image'修为src='你的头像链接',如下图所示

5.字体问题

现在博客在电脑端可能没问题了,但是在手机端可能还会出现博文、博文标题、博客标题等等不显示的问题,如下图

解决办法

这是字体问题,解决办法也很简单,打开blogger后台—主题背景—自定义
在Blogger 主题背景设计器里面,如下图,把所有的字体设置为Arial,这样就能把上面的问题解决了。

6.评论系统

Blogger 自带的评论自然不翻墙无法正常使用,本站目前评论系统采用Valine
安装教程请看我写的另外一篇教程:为 Blogger 安装 Valine 评论系统