CN112199621B - Method and device for quickly generating poster and computer equipment - Google Patents
Method and device for quickly generating poster and computer equipment Download PDFInfo
- Publication number
- CN112199621B CN112199621B CN202011414287.4A CN202011414287A CN112199621B CN 112199621 B CN112199621 B CN 112199621B CN 202011414287 A CN202011414287 A CN 202011414287A CN 112199621 B CN112199621 B CN 112199621B
- Authority
- CN
- China
- Prior art keywords
- target
- poster
- request
- screenshot
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/508—Monitor
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention relates to the technical field of data processing, and discloses a method for quickly generating a poster, which comprises the following steps: obtaining a poster sharing request; generating a target html poster page according to the target poster template and the broker information; generating a screenshot request; sending the screenshot request to a target node server through a load server; generating a screenshot service request according to the local IP address, the local port information and the screenshot request; sending the screenshot service request to a target browser through a target node server so that the target browser can verify the screenshot service request; when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser; accessing a target browser according to the screenshot service information so that the target browser conducts screenshot operation on a target html poster page according to the screenshot request; a poster picture is obtained. Through the mode, the embodiment of the invention has the beneficial effect of quickly generating the poster.
Description
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a method and a device for quickly generating a poster and computer equipment.
Background
At present, in the existing scheme for poster rendering, a picture is generally generated by using html2Canvas after front end analysis and rendering, or a poster picture is generated by using Canvas at the back end and returned to the front end. Both of the above present a complexity problem for using cavas, the first also requires compatibility with different browser environments.
Disclosure of Invention
In view of the above problems, embodiments of the present invention provide a method for quickly generating a poster, which is used to solve the problems of complexity and incompatibility of a poster generation process in the prior art.
According to an aspect of the embodiments of the present invention, there is provided a method for quickly generating a poster, the method is based on an access device, the access device includes a load server and a plurality of node servers, the load server establishes communication connection with each node server, each node server is disposed on a host and establishes communication connection with google headless browser on the host, the method includes:
obtaining a poster sharing request, wherein the poster sharing request carries floor information and broker information;
determining a target poster template according to the floor information, and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser;
accessing the target browser according to the screenshot service information so that the target browser conducts screenshot operation on the target html poster page according to the screenshot request;
and obtaining a poster picture according to the screenshot operation.
In an optional mode, a target poster template is determined according to the floor information, and a target html poster page is generated according to the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
In an optional manner, the screenshot request further includes communication protocol information, the screenshot service request includes Host request header information, and the Host request header information includes request server port information and a request server IP address;
the obtaining a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information, and the screenshot request further includes:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
In an optional manner, before the sending, by the load server, the screenshot request to the target node server, the method further includes:
respectively acquiring service port information of each node server;
and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
In an optional manner, the determining a target node server from the plurality of node servers, and sending the google headless service request message to the target node server, further includes:
and determining the target node server through the load server according to a preset load balancing strategy.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for quickly generating a poster, including:
the request acquisition module is used for acquiring a poster sharing request, wherein the poster sharing request carries the floor information and the broker information;
the poster generation module is used for determining a target poster template according to the floor information and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
the screenshot request module is used for generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
the node determining module is used for sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
the request generation module is used for acquiring a local IP address and local port information of a host corresponding to the target node server and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
the verification module is used for sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
the service information acquisition module is used for acquiring screenshot service information corresponding to the screenshot service request returned by the target browser when the verification is passed;
the screenshot module is used for accessing the target browser according to the screenshot service information so that the target browser can perform screenshot operation on the target html poster page according to the screenshot request;
and the poster picture module is used for obtaining the poster picture according to the screenshot operation.
In an optional mode, a poster generation module determines a target poster template according to the floor information, and generates a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
In an optional manner, the screenshot request further includes communication protocol information, the screenshot service request includes Host request header information, and the Host request header information includes request server port information and a request server IP address;
the request generation module obtains a local IP address and local port information of a host corresponding to the target node server, and generates a screenshot service request according to the local IP address, the local port information, and the screenshot request, further comprising:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
According to another aspect of the embodiments of the present invention, there is provided a computer apparatus including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation of the method for quickly generating the poster.
According to a further aspect of the embodiments of the present invention, there is provided a computer-readable storage medium having stored therein at least one executable instruction, which when executed on a device for quickly generating a poster, causes the device for quickly generating a poster to perform the operations of the method for quickly generating a poster as described above.
According to the embodiment of the invention, the request for generating the poster of the broker is obtained, and the Google headless browser is remotely accessed by setting the load server and the plurality of node servers, so that the poster is generated through the headless browser, the poster generating efficiency and the poster precision can be improved, and the device can be compatible with various browsers.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart illustrating a method for quickly generating a poster according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an apparatus for quickly generating a poster according to an embodiment of the present invention;
fig. 3 shows a schematic structural diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein.
Fig. 1 shows a flowchart of an embodiment of the method for quickly generating a poster according to the present invention, which is executed by a computer device and applied to a screenshot application of the computer device. The computer device may be an access device. The access equipment comprises a load server and a plurality of node servers, wherein the load server is in communication connection with each node server, and each node server is arranged on a host and is in communication connection with a Google headless browser on the host. The information interaction between the client poster making and the Google headless browser is established through the access equipment. The method for quickly generating the poster is realized according to the Google headless browser. As shown in fig. 1, the method comprises the steps of:
step 110: and obtaining a poster sharing request, wherein the poster sharing request carries the floor information and the broker information.
Before obtaining the poster sharing request, responding to a trigger operation that a broker clicks a sharing button through a client page, and generating the poster sharing request. The client page may be an applet page, an application page, and a web page. The page may be a building details page or a house display list. Illustratively, there may be a share button in the building details page or house display list.
In the embodiment of the invention, after a user clicks a sharing button, a poster sharing request is generated, and the poster sharing request comprises the floor information corresponding to the page and the corresponding broker information. The broker information includes information such as broker ID, broker avatar, broker two-dimensional code information, and broker contact information. The information such as the broker ID, the broker avatar, the broker two-dimensional code information, and the broker contact information may be obtained from a broker account pre-stored in the client.
Step 120: determining a target poster template according to the floor information, and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template.
In the embodiment of the invention, the target poster template is an html poster template, and each html poster template corresponds to a target template network address. Wherein the target poster template is stored in association with the floor information. Step 120 further comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address; storing the target network address in association with the broker ID;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
Step 130: generating a screenshot request for the target html poster page; and the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information.
And when the target html poster page is determined to be generated, generating a screenshot request for the target html poster page.
In the embodiment of the invention, corresponding screenshot quality requirement information can be configured for each poster template in advance. The screenshot quality requirement information includes size information, pixel information, and the like.
Step 140: sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server.
The method for quickly generating the poster is realized according to the Google headless browser. Because the poster is drawn by the html, the corresponding network address (namely the page url) and the screenshot quality requirement information are sent to the screenshot service in the Google headless browser for screenshot. Specifically, the screenshot can be realized through Puppeneer screenshot service of a Google headless browser. However, considering that different kinds of application layers need to be installed and compiled together with the google headless browser, respectively, so that the service that the google headless browser can be called on the specific type of application layer is realized. Therefore, when a new function needs to be realized, a google headless browser needs to be installed on the application layer with the corresponding function, but because the volume of the data packet of the application layer is large, the time cost and the computing resource cost for recompiling the application layer after installing the google headless browser each time are large. This results in inefficient access by the application layer to google headless browsers in the prior art. Therefore, in the method for quickly generating the poster, the Google headless browser is arranged on the plurality of hosts, each host corresponds to one Google headless browser and one node server, and the load server is arranged to access each node server, so that communication with the headless browser is realized. By the mode, during development, a Google headless browser is not required to be installed on each host, and therefore working efficiency is improved.
Before forwarding the screenshot request to the corresponding target node server through the load server, the load server needs to be configured first, so that the load server establishes communication with the plurality of node servers.
Step 1401: and respectively acquiring the service port information of each node server.
The service port information is a monitoring port exposed by each node server, the service port information of different node servers is different, and each node server monitors the message from the service port, so that the message sent to the service port from the outside is processed. In one embodiment of the present invention, the service port information of one node server may be the port number 9222.
Step 1402: and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
The process of configuring the load server is as follows: and writing the service port information monitored outwards by each node server into a configuration file of a forwarding module of the load server. In one embodiment of the present invention, the load server may be a proxy server with load function, such as Nginx, docker, or the like. When the type of the load server is Nginx, the specific forwarding module may be an upstream module.
Considering that there may be a plurality of screenshot requests sent by the target application layer within a period of time, in order to process each screenshot request in time and avoid that the screenshot request response time is too long or the node server crashes due to the proxy load being greater than the processing capacity, in an embodiment of the present invention, a policy setting of load balancing may be further performed on the load server to balance and schedule the screenshot requests forwarded to each node server.
In an embodiment of the present invention, the process of determining one node server from a plurality of node servers that have established a connection with a load server as a target node server may be that the target node server is determined by the load server according to a preset load balancing policy.
The specific load balancing policy may include the following: first, a polling method: and forwarding the screenshot request to each node server in turn according to the received time sequence. Secondly, a weighted polling method: and determining the weight value corresponding to each node server according to the current load condition and the system configuration condition of each node server. And when the weighted polling is carried out, the screenshot requests are distributed to the node servers in sequence according to the time sequence of receiving the screenshot requests by the load servers and the descending order of the weight values of the node servers. Third, minimum connection number method: and dynamically selecting one node server with the least current waiting connection number as a target node server to process the current screenshot request according to the current connection condition of each node server. And writing the load strategy into a configuration file of a forwarding module of the load server.
Step 150: and acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request.
In the embodiment of the invention, as the operation communication protocol of the Google headless browser is a DevTools protocol which is a debugging protocol, the operation of the Google headless browser is only allowed by the request of the local IP address and the local port, and a host corresponding to one Google headless browser corresponds to one local port and one or more IP addresses. In order to enable each node server to send a screenshot service request from a load server to a host corresponding to a browser corresponding to the node server, each node server needs to be installed on a host corresponding to a google headless browser respectively, and each node server needs to be set, so that communication connection is established between the node server and the host corresponding to the google headless browser corresponding to the node server.
Therefore, before the screenshot service request is sent to the google headless browser through the target node server, the target node server is required to be sent, and steps 1501 to 1502 are included.
Step 1501: and installing one node server on the host corresponding to each Google headless browser.
The node server and the google headless browser are installed on the same host, so that in one embodiment of the present invention, the node server may be a proxy server with reverse proxy function, such as Nginx, quid, and Varnish.
Step 1502: and respectively configuring each node server so that each node server respectively establishes communication connection with the Google headless browser on the corresponding host.
The process of configuring the node server includes first setting the IP address and port of the local server,
and in the configuration file of the server module of the node server, an address transferred by the proxy is set as a local IP address and a local port of a host corresponding to the local Google headless browser by using a proxy address setting command (such as a proxy _ pass command).
After the configuration of the node servers is completed, the service of the node servers is started, and thus communication connection is established between each node server and the Google headless browser on the host machine where the node servers are arranged.
Therefore, the technical scheme is different from the technical scheme that the resource of the Google headless browser is directly accessed without proxy, so that binding installation and compiling with the Google headless browser are required to be carried out again when the application layer is changed and modified every time. Meanwhile, the remote access efficiency of the Google headless browser is improved based on the load balancing function of the load server and the plurality of node servers.
In the embodiment of the invention, the screenshot request also comprises communication protocol information, the screenshot service request comprises Host request header information, and the Host request header information comprises request server port information and a request server IP address;
the acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request further comprises the following steps:
step 1510: setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server; in an embodiment of the present invention, a setting statement of a Host request header is first defined in a server configuration file of a target node server, where the setting statement of the Host request header is as follows:
proxy_set_header Host $server_addr$port。
where the $ server _ addr variable represents the local server IP address and the $ port variable represents the local server port information.
The method comprises the steps of firstly obtaining a local IP address and local port information, then writing the setting statement into a configuration file of a server module of a target node server, setting a request server port for sending a service request in a Host request header as the local port information of a Host corresponding to a chromosome browser, and setting the request server IP address for sending the service request as the local IP address of the Host corresponding to the chromosome browser.
In one embodiment of the invention, configuring the target node server may include the following: the method comprises the steps of firstly setting a monitoring port of a target node server, then setting a local port of a Host corresponding to the target node server, setting an http communication protocol version in the proxy process, setting Host request header information and setting a target address of the proxy.
Specifically, the step of setting the Host request header may be to write a proxy _ set _ header Host $ server _ addr $ port statement in the configuration file of the target node server, and set the Host request header as a combination of the local port information of the Host corresponding to the target browser and the local IP address of the Host, that is, to make the address of the client request identified by the target browser be the local port information plus the local IP address.
The target address to which the proxy is set may be a proxy _ passttp:// 127.0.0.1:9221 statement written in the configuration file of the target server, so that the requesting proxy is forwarded to http://127.0.0.1:9221 (i.e. the local IP address of the host corresponding to the chrome browser where the target node server is located plus the local port address) for processing.
Step 1511: and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
Step 160: sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server.
And the target browser verifies the screenshot service request according to the communication protocol information in the screenshot service request and the Host request header information.
Step 170: and when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser.
In an embodiment of the present invention, the screenshot service information includes a target access link, where the target access link is used to provide a target access interface, the target access interface may be an interface of a Puppeteer screenshot service, and the obtained target service information may include the following aspects: the Browser information is 'Browser', which is a HeadlessChrome, Google headless Browser, as 'HeadlessChrome/85.0.4183.121'. Communication Protocol Version information such as "Protocol-Version": 1.3 "and target service links such as:
"webSocketDebuggerUrl": "ws://192.168.1.45:9221/DevTools/browser/edeb113e-70e3-45a6-bad7-a50d66cceef9"。
based on a service mechanism of a Google headless browser, the communication protocol type of the target service link is a Websocket type, in the Websocket communication protocol, a browser server and a client can directly establish connection and perform bidirectional data transmission only by completing one-time handshake. The target access link corresponds to a target access interface, and the target application layer can access the resource provided by the host corresponding to the chromosome browser on the target access interface based on a debugging protocol approved by the chromosome browser, such as the DevTools protocol, wherein the target access interface can be a client based on the DevTool protocol, which is configured in advance.
Step 180: and accessing the target browser according to the screenshot service information so that the target browser performs screenshot operation on the target html poster page according to the screenshot request.
And when the Google headless browser opens a target html poster page according to the target network address, indicating Puppeneer screenshot service of the Google headless browser to perform screenshot operation.
Step 190: and obtaining a poster picture according to the screenshot operation.
And after the target browser conducts screenshot operation on the target html poster page according to the screenshot request, the obtained base64 information of the poster picture is obtained. And analyzing the poster picture according to the base64 information.
And after the poster picture is obtained, sending the poster picture to a broker ID corresponding to a client, so that the broker can perform sharing operation according to the poster picture.
According to the embodiment of the invention, the request for generating the poster of the broker is obtained, and the Google headless browser is remotely accessed by setting the load server and the plurality of node servers, so that the poster is generated through the headless browser, the poster generating efficiency and the poster precision can be improved, and the device can be compatible with various browsers.
Fig. 2 shows a schematic structural diagram of an embodiment of the device for quickly generating a poster according to the invention. The specific working process of the device 200 for quickly generating a poster according to the embodiment of the present invention is the same as the specific method steps of the above method embodiments, and details are not repeated here. As shown in fig. 2, the apparatus 200 includes:
a request obtaining module 210, configured to obtain a poster sharing request, where the poster sharing request carries floor information and broker information;
the poster generation module 220 is used for determining a target poster template according to the floor information and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
a screenshot request module 230, configured to generate a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
a node determining module 240, configured to send the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
a request generating module 250, configured to obtain a local IP address and local port information of a host corresponding to the target node server, and generate a screenshot service request according to the local IP address, the local port information, and the screenshot request;
a verification module 260, configured to send the screenshot service request to a target browser through the target node server, so that the target browser verifies the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
a service information obtaining module 270, configured to obtain screenshot service information corresponding to the screenshot service request returned by the target browser when the verification is passed;
the screenshot module 280 is configured to access the target browser according to the screenshot service information, so that the target browser performs screenshot operation on the target html poster page according to the screenshot request;
and the poster picture module 290 is used for obtaining the poster picture according to the screenshot operation.
In an optional mode, a target poster template is determined according to the floor information, and a target html poster page is generated according to the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
In an optional manner, the screenshot request further includes communication protocol information, the screenshot service request includes Host request header information, and the Host request header information includes request server port information and a request server IP address;
the obtaining a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information, and the screenshot request further includes:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
In an optional manner, before the sending, by the load server, the screenshot request to the target node server, the method further includes:
respectively acquiring service port information of each node server;
and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
In an optional manner, the determining a target node server from the plurality of node servers, and sending the google headless service request message to the target node server, further includes:
and determining the target node server through the load server according to a preset load balancing strategy.
According to the embodiment of the invention, the request for generating the poster of the broker is obtained, and the Google headless browser is remotely accessed by setting the load server and the plurality of node servers, so that the poster is generated through the headless browser, the poster generating efficiency and the poster precision can be improved, and the device can be compatible with various browsers.
Fig. 3 is a schematic structural diagram of an embodiment of the computer device of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the computer device.
As shown in fig. 3, the computer apparatus may include: a processor (processor)302, a communication Interface 304, a memory 306, and a communication bus 308.
Wherein: the processor 302, communication interface 304, and memory 306 communicate with each other via a communication bus 308. A communication interface 304 for communicating with network elements of other devices, such as clients or other servers. The processor 302 is configured to execute the program 310, and may specifically execute relevant steps in the above-described method embodiment for quickly generating a poster.
In particular, program 310 may include program code comprising computer-executable instructions.
The processor 302 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computer device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 306 for storing a program 310. Memory 306 may comprise high-speed RAM memory and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Specifically, the program 310 may be invoked by the processor 302 to cause the computer device to perform the following operations:
obtaining a poster sharing request, wherein the poster sharing request carries floor information and broker information;
determining a target poster template according to the floor information, and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser;
accessing the target browser according to the screenshot service information so that the target browser conducts screenshot operation on the target html poster page according to the screenshot request;
and obtaining a poster picture according to the screenshot operation.
In an optional mode, a target poster template is determined according to the floor information, and a target html poster page is generated according to the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
In an optional manner, the screenshot request further includes communication protocol information, the screenshot service request includes Host request header information, and the Host request header information includes request server port information and a request server IP address;
the obtaining a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information, and the screenshot request further includes:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
In an optional manner, before the sending, by the load server, the screenshot request to the target node server, the method further includes:
respectively acquiring service port information of each node server;
and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
In an optional manner, the determining a target node server from the plurality of node servers, and sending the google headless service request message to the target node server, further includes:
and determining the target node server through the load server according to a preset load balancing strategy.
According to the embodiment of the invention, the request for generating the poster of the broker is obtained, and the Google headless browser is remotely accessed by setting the load server and the plurality of node servers, so that the poster is generated through the headless browser, the poster generating efficiency and the poster precision can be improved, and the device can be compatible with various browsers.
An embodiment of the present invention provides a computer-readable storage medium, where at least one executable instruction is stored, and when the executable instruction is executed on a computer device, the computer device is caused to execute the method for quickly generating a poster in any of the above-mentioned method embodiments.
The executable instructions may be specifically configured to cause the computer device to perform the following operations:
obtaining a poster sharing request, wherein the poster sharing request carries floor information and broker information;
determining a target poster template according to the floor information, and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser;
accessing the target browser according to the screenshot service information so that the target browser conducts screenshot operation on the target html poster page according to the screenshot request;
and obtaining a poster picture according to the screenshot operation.
In an optional mode, a target poster template is determined according to the floor information, and a target html poster page is generated according to the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
In an optional manner, the screenshot request further includes communication protocol information, the screenshot service request includes Host request header information, and the Host request header information includes request server port information and a request server IP address;
the obtaining a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information, and the screenshot request further includes:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
In an optional manner, before the sending, by the load server, the screenshot request to the target node server, the method further includes:
respectively acquiring service port information of each node server;
and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
In an optional manner, the determining a target node server from the plurality of node servers, and sending the google headless service request message to the target node server, further includes:
and determining the target node server through the load server according to a preset load balancing strategy.
According to the embodiment of the invention, the request for generating the poster of the broker is obtained, and the Google headless browser is remotely accessed by setting the load server and the plurality of node servers, so that the poster is generated through the headless browser, the poster generating efficiency and the poster precision can be improved, and the device can be compatible with various browsers.
The embodiment of the invention provides a device for quickly generating a poster, which is used for executing the method for quickly generating the poster.
Embodiments of the present invention provide a computer program that can be invoked by a processor to enable the computer device to execute the method for quickly generating a poster in any of the method embodiments.
Embodiments of the present invention provide a computer program product comprising a computer program stored on a computer-readable storage medium, the computer program comprising program instructions that, when run on a computer, cause the computer to perform a method of quickly generating a poster in any of the method embodiments described above.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specified otherwise.
Claims (10)
1. A method for quickly generating a poster, wherein the method is based on an access device, the access device comprises a load server and a plurality of node servers, the load server establishes communication connection with each node server, each node server is arranged on a host and establishes communication connection with google headless browser on the host, and the method comprises the following steps:
obtaining a poster sharing request, wherein the poster sharing request carries floor information and broker information;
determining a target poster template according to the floor information, and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from the plurality of node servers through the load server;
acquiring a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
when the verification is passed, acquiring screenshot service information corresponding to the screenshot service request returned by the target browser;
accessing the target browser according to the screenshot service information so that the target browser conducts screenshot operation on the target html poster page according to the screenshot request;
and obtaining a poster picture according to the screenshot operation.
2. The method of claim 1, wherein a target poster template is determined from the floor information, and a target html poster page is generated from the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
3. The method of claim 1, wherein the screenshot request further includes communication protocol information, the screenshot service request includes a Host request header information, and the Host request header information includes request server port information and a request server IP address;
the obtaining a local IP address and local port information of a host corresponding to the target node server, and generating a screenshot service request according to the local IP address, the local port information, and the screenshot request further includes:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
4. The method of claim 2, wherein before sending the screenshot request to the target node server through the load server, further comprising:
respectively acquiring service port information of each node server;
and configuring the load server according to the service port information so as to enable the load server to establish communication connection with each node server respectively.
5. The method as claimed in any one of claims 1-3, wherein a target node server is determined from the plurality of node servers, and wherein Google headless service request information is transmitted to the target node server, further comprising:
and determining the target node server through the load server according to a preset load balancing strategy.
6. An apparatus for quickly generating a poster, the apparatus comprising:
the request acquisition module is used for acquiring a poster sharing request, wherein the poster sharing request carries the floor information and the broker information;
the poster generation module is used for determining a target poster template according to the floor information and generating a target html poster page according to the target poster template and the broker information; the target poster template is an html poster template;
the screenshot request module is used for generating a screenshot request for the target html poster page; the screenshot request comprises a target network address of the target html poster page and screenshot quality requirement information;
the node determining module is used for sending the screenshot request to a target node server through a load server; the target node server is any idle node server determined from a plurality of node servers through the load server;
the request generation module is used for acquiring a local IP address and local port information of a host corresponding to the target node server and generating a screenshot service request according to the local IP address, the local port information and the screenshot request;
the verification module is used for sending the screenshot service request to a target browser through the target node server so that the target browser can verify the screenshot service request; the target browser is a Google headless browser corresponding to the target node server;
the service information acquisition module is used for acquiring screenshot service information corresponding to the screenshot service request returned by the target browser when the verification is passed;
the screenshot module is used for accessing the target browser according to the screenshot service information so that the target browser can perform screenshot operation on the target html poster page according to the screenshot request;
and the poster picture module is used for obtaining the poster picture according to the screenshot operation.
7. The apparatus of claim 6, wherein the poster generation module determines a target poster template from the floor information and generates a target html poster page from the target poster template and the broker information; the target poster template is an html poster template, and comprises:
acquiring a target template network address corresponding to the target poster template;
opening the target poster template according to the target template network address;
generating a target network address of the target html poster page according to the target template network address;
and generating a target html poster page in the target network address according to the target poster template and the broker information.
8. The apparatus of claim 6, wherein the screenshot request further includes communication protocol information, the screenshot service request includes a Host request header information, and the Host request header information includes request server port information and a request server IP address;
the request generation module obtains a local IP address and local port information of a host corresponding to the target node server, and generates a screenshot service request according to the local IP address, the local port information, and the screenshot request, further comprising:
setting the request server port information as the local port information and the request server IP address as the local IP address by the target node server;
and generating the screenshot service request by the target node server according to the communication protocol information and the Host request header information.
9. A computer device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is for storing at least one executable instruction that causes the processor to perform the operations of the method of quickly generating a poster of any of claims 1-6.
10. A computer-readable storage medium having stored therein at least one executable instruction that, when executed on a computer device, causes the computer device to perform operations of a method of quickly generating a poster of any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011414287.4A CN112199621B (en) | 2020-12-07 | 2020-12-07 | Method and device for quickly generating poster and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011414287.4A CN112199621B (en) | 2020-12-07 | 2020-12-07 | Method and device for quickly generating poster and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112199621A CN112199621A (en) | 2021-01-08 |
CN112199621B true CN112199621B (en) | 2021-03-09 |
Family
ID=74034498
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011414287.4A Active CN112199621B (en) | 2020-12-07 | 2020-12-07 | Method and device for quickly generating poster and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112199621B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113590564B (en) * | 2021-07-29 | 2024-03-01 | 挂号网(杭州)科技有限公司 | Data storage method, device, electronic equipment and storage medium |
CN113573102A (en) * | 2021-08-18 | 2021-10-29 | 北京中网易企秀科技有限公司 | Video generation method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109636883A (en) * | 2018-12-13 | 2019-04-16 | 珍岛信息技术(上海)股份有限公司 | A kind of advertising pictures processing system based on Canvas |
US10726424B1 (en) * | 2019-07-29 | 2020-07-28 | Capital One Services, Llc | Computer-based systems and platforms and computer-implemented methods configured for one or more technological applications involving reduction of false-positive fraud detection incidents |
CN111462281A (en) * | 2020-03-31 | 2020-07-28 | 北京创鑫旅程网络技术有限公司 | Poster generation method, device, equipment and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9384472B2 (en) * | 2012-09-07 | 2016-07-05 | Time.ly Network Inc. | Methods and systems for a web-based calendar application |
TW201624253A (en) * | 2014-12-31 | 2016-07-01 | 萬國商業機器公司 | Method, computer program product and computer system for displaying information of a parent webpage associated with a child tab on a graphical user interface |
CN109543168A (en) * | 2018-11-21 | 2019-03-29 | 万翼科技有限公司 | House property poster to participator's information adding method, server and storage medium |
-
2020
- 2020-12-07 CN CN202011414287.4A patent/CN112199621B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109636883A (en) * | 2018-12-13 | 2019-04-16 | 珍岛信息技术(上海)股份有限公司 | A kind of advertising pictures processing system based on Canvas |
US10726424B1 (en) * | 2019-07-29 | 2020-07-28 | Capital One Services, Llc | Computer-based systems and platforms and computer-implemented methods configured for one or more technological applications involving reduction of false-positive fraud detection incidents |
CN111462281A (en) * | 2020-03-31 | 2020-07-28 | 北京创鑫旅程网络技术有限公司 | Poster generation method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
基于视频序列的平面海报生成方法;于洋等;《计算机辅助设计与图形学学报》;20090531;第644-649页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112199621A (en) | 2021-01-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111461332B (en) | Deep learning model online reasoning method and device, electronic equipment and storage medium | |
US7568032B2 (en) | Method of balancing load among mirror servers | |
JP2017168139A5 (en) | Computer-implemented method for remote process execution and system for remote process execution | |
CN109525461B (en) | Network equipment testing method, device, equipment and storage medium | |
CN112199621B (en) | Method and device for quickly generating poster and computer equipment | |
CN110011875B (en) | Dial testing method, device, equipment and computer readable storage medium | |
JPH11134219A (en) | Device and method for simulating multiple nodes on single machine | |
US9971636B2 (en) | Methods for implementing web services and devices thereof | |
CN111079048B (en) | Page loading method and device | |
CN114205342A (en) | Routing method, electronic device, medium, and program product for service debugging | |
CN104468594B (en) | The method, apparatus and system of a kind of request of data | |
CN111787036A (en) | Solution method, device, storage medium and equipment for front-end private cloud deployment | |
CN104270443B (en) | A kind of cloud computing system and method for being capable of dynamic analysis Web applications | |
CN113468045A (en) | Test system, method and assembly for server batch configuration software | |
CN107395663B (en) | Data acquisition method and device | |
CN112115056A (en) | Project deployment method and device, server and storage medium | |
CN112491940B (en) | Request forwarding method and device of proxy server, storage medium and electronic equipment | |
CN114915565B (en) | Network debugging method and system | |
CN111447273A (en) | Cloud processing system and data processing method based on cloud processing system | |
CN115758334A (en) | Cloud application access method and device, electronic equipment and storage medium | |
CN108228359B (en) | Method and system for integrating web program and R program to process data | |
CN112243039B (en) | Remote access method, device, equipment and computer readable medium of chrome browser | |
CN112685285A (en) | User interface test case generation method and device | |
CN115022387B (en) | Cross-domain pre-inspection request processing method, device, equipment and medium | |
CN110278271B (en) | Network request control method and device and terminal equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |