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

NyaVM: $4/month/512MB memory/5GB space/2TB traffic/KVM/San Jose C3

NyaVM, a Chinese hosting provider, has now launch...

ipsystemsltd: $6/year/512MB RAM/10GB SSD/3 IPs/500GB traffic/OpenVZ

IP Systems Limited is a newly established America...

SpeedyKVM: $19.5/month/E3-1230/15GB memory/1.7TB space/20TB traffic/KVM/Dallas

SpeedyKVM is a direct sub-brand of Incero Compute...

FirstByte 512MB RAM 100Mbps Ports Moscow, Russia KVM VPS Review

Details : FirstByte: 4.8 yuan/month/512MB memory/...

TragicServers: 50% off on Black Friday, VPS starting at $5

Coupon code : BF OVZ – 128MB CPU: 1 core Memory: ...

Christmas promotion for .TOP domains managed by China

On June 20, 2011, ICANN officially announced the ...

ru-tld: €2/month/1GB memory/40GB space/4TB traffic/KVM/Singapore

Since LeaseWeb launched the Singapore data center...

IDrive – Free online storage that automatically backs up your WordPress data

IDrive is a service provider that provides online...