Method for automatically transferring related news information
Technical Field
The invention belongs to an extension of the field of computer automation test, and discloses a method for quickly acquiring news information on a network and transferring the news information to a platform of a user.
Background
Every day in the world, a lot of attention is paid, and a large internet company reports a lot of important things in time because the large internet company has enough manpower resources to do the things specially. Small companies are likely to be slow to update. The information is announced on the website just like the company of the user, but the information is not updated every day, the content is always just a few, and therefore few users browse the information.
In communication with the responsible maintenance personnel, the news information they maintain is found to be basically transferred from the existing news information in the network. And they have a fixed origin. Except that they do not have as much effort to maintain. After viewing the websites provided by the maintenance personnel, the interface layout of the websites is found to be very regular and is very suitable for the operation of the automation tool, so that an idea is born: an automated test script is compiled to replace the manual operation of maintenance personnel.
Disclosure of Invention
The invention aims to provide a method for automatically transferring relevant news information from the view point of company operation. The news information content specific to a certain website is automatically transferred through the script and is released to the website of the user.
The technical scheme adopted by the invention for solving the technical problem comprises the following steps:
step 1, 2 browsers B1 and B2 are started, the browser B1 opens a certain website page to acquire education information, and the browser B2 opens a website maintenance news information page.
And 2, acquiring a title B1-T1 of news information with a designated sequence number on the page on the browser B1, pausing the browser operation B1, and starting the browser operation B2.
Step 3, the browser B2 opens a self website maintenance news information page, searches by using T1 as a title, suspends the browser B2 if T1 does not exist in the browser B2, starts the browser B1 to operate, further clicks and opens a title B1-T1 link, and acquires page detailed information T1-M1, including: out, text. If there are pictures in T1-M1, the text needs to be saved line by line, and the position of the picture is found to be marked with Flag 1, and the picture is downloaded locally. Browser B1 is paused and browser B2 operation is initiated. If T1 already exists in browser B2, go back to step 2 and continue to get the next new news.
And 4, starting newly added news information B2-T2 in the browser B2, maintaining the information corresponding to the T1-M1 in B2-T2, inserting a corresponding picture if Flag is detected to be 1 in the text in the maintenance process, and storing the information after the information is input. Pause browser B2, start browser B1 operation, get the next new T1 in browser B1, and then go back to step 2 operation.
Step 5, until B1-T1 all exist in browser B2, and simultaneously the operations of browsers B1 and B2 are suspended, and after waiting for a longer period of time T, the operation returns to step 1, and a new round of operation is started.
The reason for waiting a longer period of time T is: 1. b1 not update news information frequently; 2. accessing B1 too frequently may be considered an attack by B1, thereby denying service.
The invention has the following beneficial effects:
1. the maintenance real-time performance of the news information of the own website is obviously improved.
2. By acquiring news information of a plurality of different websites, the content is richer than before, and more users' attention is attracted.
Detailed Description
The present invention will be further described with reference to the following examples.
A method for automatically transferring relevant news information is concretely implemented as follows:
step 1, 2 browsers B1 and B2 are started, the browser B1 opens a certain website page to acquire education information, and the browser B2 opens a website maintenance news information page.
And 2, acquiring a title B1-T1 of news information with a designated sequence number on the page on the browser B1, pausing the browser operation B1, and starting the browser operation B2.
Step 3, the browser B2 opens a self website maintenance news information page, searches by using T1 as a title, suspends the browser B2 if T1 does not exist in the browser B2, starts the browser B1 to operate, further clicks and opens a title B1-T1 link, and acquires page detailed information T1-M1, including: out, text. If there are pictures in T1-M1, the text needs to be saved line by line, and the position of the picture is found to be marked with Flag 1, and the picture is downloaded locally. Browser B1 is paused and browser B2 operation is initiated. If T1 already exists in browser B2, go back to step 2 and continue to get the next new news.
And 4, starting newly added news information B2-T2 in the browser B2, maintaining the information corresponding to the T1-M1 in B2-T2, inserting a corresponding picture if Flag is detected to be 1 in the text in the maintenance process, and storing the information after the information is input. Pause browser B2, start browser B1 operation, get the next new T1 in browser B1, and then go back to step 2 operation.
Step 5, until B1-T1 all exist in browser B2, and simultaneously the operations of browsers B1 and B2 are suspended, and after waiting for a longer period of time T, the operation returns to step 1, and a new round of operation is started.
The reason for waiting a longer period of time T is: 1. b1 not update news information frequently; 2. accessing B1 too frequently may be considered an attack by B1, thereby denying service.