On a VPS, collect 1024 image blocks and automatically publish them to WordPress

On a VPS, collect 1024 image blocks and automatically publish them to WordPress

Environmental requirements : python3, PHP, Mysql.
The following is successful under CentOS 7.

1. Create a PHP and Mysql environment, and install WordPress and chevereto image hosting .<br />Specific installation tutorial for WordPress images and text: Use VPS to install Nginx, PHP, and Mysql. At the same time, create a wordpress blog and install the chevereto image hosting program. After the installation is complete, go to the chevereto backend to turn off flood protection, and then go to the upload parameters to set them according to your requirements.

2. Install Python 3.6 and pip3
Among them, steps c, d, and e can be omitted.

a. Update source

 yum install epel-release yum install https://centos7.iuscommunity.org/ius-release.rpm

b. Install Python 3.6

 yum install python36u

c. Create a python3 connector

 ln -s /bin/python3.6 /bin/python3

d. Install pip3

 yum install python36u-pip

e. Create pip3 link symbol

 ln -s /bin/pip3.6 /bin/pip3

f. Install requests and pymysql

 pip3 install requests pip3 install pymysql

3. Download and modify crawler code
a. Create a storage directory

 mkdir /home/1024

b. Enter the directory

 cd /home/1024

c. Download crawler

 wget https://zhujiwiki.com/wp-content/uploads/2018/03/1024_img_spider_wordpress.py

d. Edit the 1024_img_spider_wordpress.py file

 vi spider.py

Configuration parameters
d-1. Fill in the WordPress MySQL database parameters in line 12
conn = pymysql.connect(host=”, port=3306, user='MySQL username', passwd='password', db='MySQL database name', charset='utf8′) #Fill in the database here

d-2. Add the API of the image hosting service in line 26

APIKey = "" # Fill in the API here. This API can be found in the chevereto backend

Change your image hosting address here in line 28
url = “http://yourdomain/api/1/upload/?key=” + APIKey + “&format=” + format #Image hosting address

d-3. Exit and save the 1024_img_spider_wordpress.py file.

e. Modify file permissions

 chmod +x spider.py

4. Run and view the effect
a. Operation

 python3 spider.py

b. Open the website to view the effect

5. Install Python3 and pip3 under CentOS/Debian
a. Check whether the system has Python3

 python3 -V

b. Install Python3

CentOS

 wget https://zhujiwiki.com/wp-content/uploads/2018/03/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh

Debian

 wget https://zhujiwiki.com/wp-content/uploads/2018/03/Debian_Python3.6.sh && sh Debian_Python3.6.sh

Then enter python3 -V to see if the installation is successful. Generally, you can use python3 and pip3 after successful installation.

via: https://github.com/ishkong/1024_img_spider_wordpress, https://www.openos.org/post/165/, https://www.moerats.com/archives/507/

<<:  Time4VPS: €9.99/month/1GB memory/1TB space/10TB traffic/KVM/Lithuania

>>:  Light Internet 512MB RAM Los Angeles CN2 KVM VPS Review

Recommend

Server4You: €24.99/month/AMD Athlon II/16GB RAM/3TB HDD/Unlimited traffic/1 IP

Server4You has 3 special offers on Black Friday, ...

LayerOnline: $5/month/1GB RAM/20GB SSD space/unlimited traffic/1Gbps/KVM/Europe

LayerOnline, a Canadian business, was established...

LAUNCH VPS: $36/year/1GB RAM/20GB SSD space/1TB bandwidth/KVM/Philadelphia

LAUNCH VPS, an American hosting provider, mainly ...

Alibaba Cloud: 33 yuan/year/1TB storage/can be directly linked

Alibaba Cloud's latest object storage activit...

In 2020, Double 11 and Black Friday promotions and submissions

This is the most cost-effective time to buy a hos...

eBesucher Hang Up Guide

eBesucher is the most famous automatic surfing mo...

WeVPS 1GB RAM 1Gbps Port Taiwan KVM VPS Review

Details : WeVPS: $22/month/1GB RAM/20GB SSD space...

HiFormance: $3/month/1G memory/20GB SSD space/2TB traffic/KVM/Utah

HiFormance, an American hosting provider located ...

This site provides DIYPAGE template imitation service

The DIYPAGE program is pretty good and I have bee...