CN113505318A - Short link generation method, device, equipment and storage medium - Google Patents

Short link generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113505318A
CN113505318A CN202110842631.8A CN202110842631A CN113505318A CN 113505318 A CN113505318 A CN 113505318A CN 202110842631 A CN202110842631 A CN 202110842631A CN 113505318 A CN113505318 A CN 113505318A
Authority
CN
China
Prior art keywords
short link
link
short
candidate
original long
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.)
Pending
Application number
CN202110842631.8A
Other languages
Chinese (zh)
Inventor
杨海松
梅雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panoramic Zhilian Wuhan Technology Co ltd
Original Assignee
Panoramic Zhilian Wuhan Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Panoramic Zhilian Wuhan Technology Co ltd filed Critical Panoramic Zhilian Wuhan Technology Co ltd
Priority to CN202110842631.8A priority Critical patent/CN113505318A/en
Publication of CN113505318A publication Critical patent/CN113505318A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9558Details of hyperlinks; Management of linked annotations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Abstract

The invention discloses a short link generation method, a device, equipment and a storage medium, wherein the method comprises the steps of encrypting an original long link to be popularized to obtain an encryption string, and improving the security in the link conversion process through encryption operation; the encryption strings are grouped to obtain a preset number of grouping strings, corresponding short link initial values are established for the grouping strings, the short link initial values are calculated, obtained calculation results form candidate short link addresses, an original long link is converted into the candidate short link addresses, the conversion process is simple and high in efficiency, the website is shortened to optimize the link of the cross-device, and the short link is connected to display, print, send messages or release pushtext, so that a large amount of space can be saved, and the error rate of the user input link is reduced.

Description

Short link generation method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of data processing, in particular to a short link generation method, a short link generation device, short link generation equipment and a storage medium.
Background
In the prior art, when information is pushed, the generated link is too long, and some websites cannot be opened when the information is configured. When searching, displaying, printing, sending messages or issuing pushtext, long links consume a large amount of space, and users are inconvenient to use long links and have high error probability.
Disclosure of Invention
The invention aims to provide a short link generation method, a device, equipment and a storage medium for overcoming the defects of inconvenience in long link use, space consumption of inventory and high error rate of users in the prior art.
To achieve the above object, the present invention provides a short link generation method, comprising the steps of:
encrypting an original long link to be popularized to obtain an encrypted string;
grouping the encrypted strings to obtain a preset number of grouped strings;
establishing a corresponding short chain connection initial value for each packet string;
and computing each short link initial value, and forming a candidate short link address by each obtained computing result.
Preferably, after the operation is performed on each of the short-link initial values and the obtained operation results are combined into the candidate short-link ground address, the method further includes:
sending the candidate short link to a target terminal;
when the user clicks the candidate short link through the target terminal, intercepting and analyzing an http request of the user to obtain the candidate short link;
searching an original long link in a preset cache according to the candidate short link;
if the page is found, the page corresponding to the original long-chain connection is redirected.
Preferably, when the user clicks the candidate short link through the target terminal, intercepting and analyzing the http request of the user to obtain the candidate short link, further comprising:
acquiring the access times, equipment types, access areas and time period information of the user;
and tracking the behavior of the user according to the access times, the equipment type, the access area and the time period information, and performing data analysis.
Preferably, after searching for the original long link in the preset cache according to the candidate short link, the method further includes:
and if the mapping relation between the selected short link and the original long link is not found, searching the mapping relation between the selected short link and the original long link in a relational database.
Preferably, the encrypting the original long link to be promoted to obtain an encrypted string specifically includes:
and encrypting the original long link to be popularized and the custom key by an MD5 encryption algorithm to obtain an encryption string.
Preferably, the performing an operation on each of the short link initial values and forming a candidate short link address by using each obtained operation result specifically includes:
step S1, performing a bit and operation on each of the short link initial values and the first preset value, and performing a bit and operation on the obtained value and the second preset value;
step S2, selecting characters in a preset character table by using the obtained result as a subscript;
and moving the short link initial value by a preset digit to the right to obtain a new short link initial value, repeatedly executing the step S1 and the step S2, and repeatedly executing preset times to obtain a candidate short link address.
Preferably, after the operation is performed on each of the short-link initial values and the obtained operation results are combined into the candidate short-link ground address, the method further includes:
storing the mapping relation between the candidate short link address and the original long link at a short link server;
and caching the mapping relation between the candidate short link address and the original long link in the redis.
In addition, to achieve the above object, the present invention further provides a short link generation apparatus, including:
the encryption module is used for encrypting the original long chain link to be popularized to obtain an encryption string;
the grouping module is used for grouping the encrypted strings to obtain a preset number of grouped strings;
the establishing module is used for establishing a corresponding short-chain-connection initial value for each packet string;
and the operation module is used for operating each short link initial value and forming a candidate short link address by each obtained operation result.
In addition, to achieve the above object, the present invention further provides a short link generation apparatus, including: a memory, a processor and a short link generation program stored on the memory and executable on the processor, the short link generation program when executed by the processor implementing the steps of the short link generation method as described above.
In addition, to achieve the above object, the present invention further provides a storage medium having a short link generation program stored thereon, wherein the short link generation program, when executed by a processor, implements the steps of the short link generation method as described above.
In the invention, the original long link to be promoted is encrypted to obtain an encrypted string, and the security in the link conversion process is improved through encryption operation; the encryption strings are grouped to obtain a preset number of grouping strings, corresponding short link initial values are established for the grouping strings, the short link initial values are calculated, obtained calculation results form candidate short link addresses, an original long link is converted into the candidate short link addresses, the conversion process is simple and high in efficiency, the website is shortened to optimize the link of the cross-device, and the short link is connected to display, print, send messages or release pushtext, so that a large amount of space can be saved, and the error rate of the user input link is reduced.
Drawings
FIG. 1 is a schematic diagram of a short link generation device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a short link generation method according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a short link generation method according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating a process of accessing a short link by a user according to an embodiment of the present invention;
fig. 5 is a block diagram of a short link generating apparatus according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a short link generation device of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the short link generation apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), and the optional user interface 1003 may further include a standard wired interface and a wireless interface, and the wired interface for the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory or a Non-volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the architecture shown in fig. 1 does not constitute a limitation of the short link generating device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is one type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a short link generation program.
In the short link generation device shown in fig. 1, the network interface 1004 is mainly used for connecting a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting user equipment; the short link generation device calls the short link generation program stored in the memory 1005 through the processor 1001, and executes the short link generation method provided by the embodiment of the present invention.
Based on the above hardware structure, an embodiment of the short link generation method of the present invention is provided.
Referring to fig. 2, a first embodiment of the short link generation method of the present invention is provided.
In a first embodiment, the short link generation method includes the steps of:
step S10: and encrypting the original long link to be popularized to obtain an encrypted string.
It should be understood that the execution subject of this embodiment is the device that creates an alias for a long Uniform Resource Locator (URL), where the short link generating device may be an electronic device such as a personal computer or a server, and this embodiment is not limited thereto. The generation of the short link can be realized by an MD5 Message Digest Algorithm (MD5 Message-Digest Algorithm, MD5 for short) encryption Algorithm. First we encrypt the original link that we want to promote and the custom key by MD5 to obtain the encrypted string. In this embodiment, the step S10 specifically includes: and encrypting the original long link to be popularized and the custom key by an MD5 encryption algorithm to obtain an encryption string.
Step S20: and grouping the encrypted strings to obtain a preset number of grouped strings.
Step S30: and establishing a corresponding short chain joint initial value for each packet string.
It should be understood that the predetermined number may be determined according to actual conditions, for example, the predetermined number is 4, the encryption strings are divided into 4 groups, and each group corresponds to a short link initial value.
Step S40: and computing each short link initial value, and forming a candidate short link address by each obtained computing result.
It should be noted that, bit and operation are performed on each short link initial value, an obtained result is used as a subscript to select a target character in a preset character table, then, right shift operation is performed on the short link initial value to obtain a new short link value, bit and operation is performed repeatedly with the preset value to obtain a new result, the new result is used as the subscript to select a new target character in the preset character table, and a plurality of characters obtained after repeated execution form a candidate short link address.
Further, in this embodiment, the step S40 specifically includes:
step S1, performing a bit and operation on each of the short link initial values and the first preset value, and performing a bit and operation on the obtained value and the second preset value;
step S2, selecting characters in a preset character table by using the obtained result as a subscript;
and moving the short link initial value by a preset digit to the right to obtain a new short link initial value, repeatedly executing the step S1 and the step S2, and repeatedly executing preset times to obtain a candidate short link address.
In a specific implementation, each preset value may be determined according to an empirical value or an actual condition, for example, the first preset value is 0x3FFFFFFF, the second preset value is 0x0000003D, the preset number of bits is 5 bits, and the preset number of times is 6 times. The initial values and 0x3FFFFFFF are used for carrying out bit AND operation, the obtained values and 0x0000003D are used for carrying out bit AND operation, the obtained results are used as subscripts to select characters in a character table (preset), the initial values are shifted to the right by 5 bits to carry out the same operation, 6 times of repeated operation is carried out to obtain 6 characters, namely a candidate short link address is formed to carry out long-short link mapping relation storage in a short link server, and the mapping relation can be cached in redis at the same time in consideration of the service response performance. In this embodiment, after the step S40, the method further includes: storing the mapping relation between the candidate short link address and the original long link at a short link server; and caching the mapping relation between the candidate short link address and the original long link in the redis. For example, we want to shorten the URL:
http://www.smcaiot.com/#/collection/page/5668639101419520/5649050225344512/5668600916475904/;
a short URL can be obtained by this embodiment: http:// smit.com/jlg 8 zp/.
In the embodiment, the original long link to be promoted is encrypted to obtain an encrypted string, and the security in the link conversion process is improved through encryption operation; the encryption strings are grouped to obtain a preset number of grouping strings, corresponding short link initial values are established for the grouping strings, the short link initial values are calculated, obtained calculation results form candidate short link addresses, an original long link is converted into the candidate short link addresses, the conversion process is simple and high in efficiency, the website is shortened to optimize the link of the cross-device, and the short link is connected to display, print, send messages or release pushtext, so that a large amount of space can be saved, and the error rate of the user input link is reduced.
Referring to fig. 3, a second embodiment of the short link generation method according to the present invention is proposed based on the first embodiment of the method.
In this embodiment, after step S40, the method further includes:
step S50, sending the candidate short link to the target terminal.
It will be appreciated that a significant amount of space can be saved when messaging, information presentation or tweeting is performed over the short candidate links. Further, the user is less likely to miss shorter URLs. The shortened URL is almost one-third the size of the actual URL, shortening the web site for optimizing links across devices.
And step S60, when the user clicks the candidate short link through the target terminal, intercepting and analyzing the http request of the user to obtain the candidate short link.
And step S70, searching the original long link in a preset cache according to the candidate short link.
And step S80, if the page is found, redirecting to the page corresponding to the original long-chain connection.
It should be understood that the preset cache may be a redis cache, and referring to fig. 4, when the user clicks the short links, the short link server may intercept and analyze the http request, first take the short links, search the original links in the redis cache, and if not, search the mapping relationship in the relational database; and if the original long link is found, updating the redis cache, returning a result, and finally redirecting to the original link. In this embodiment, after the step S70, the method further includes: and if the mapping relation between the selected short link and the original long link is not found, searching the mapping relation between the selected short link and the original long link in a relational database.
Referring to fig. 4, in order to ensure access security and accuracy, when the original long link is found, it is further necessary to determine whether the original long link is expired, so as to avoid accessing the expired or invalid link; meanwhile, whether the user has access authority is judged, attack is avoided, and information access safety is improved. In fig. 4, the URL is found, that is, the original long link is found, and when the found URL is out of date or has no access right, no access right is returned; when the found URL is not expired and has access rights, it is redirected to the original long link.
Further, in this embodiment, after the step S60, the method further includes:
acquiring the access times, equipment types, access areas and time period information of the user;
and tracking the behavior of the user according to the access times, the equipment type, the access area and the time period information, and performing data analysis.
It should be noted that, the data analysis can be performed by tracking the behavior of the user through dimensions such as access times, device types, access areas, and time periods. So as to find out which promotion channel is best and analyze the user portrait of the audience. For example: for some c-end apps, short links can be added in voting content, and the click rate of the user is relatively increased due to the simplicity of the short links.
In the embodiment, a large amount of space can be saved when the candidate short link is sent to the target terminal and the short link is displayed, printed, sent or released; when the user clicks the candidate short link through the target terminal, intercepting and analyzing the http request of the user to obtain the candidate short link, searching the original long link in a preset cache according to the candidate short link, and redirecting to a page corresponding to the original long link if the original long link is searched, wherein the short link is simple, and the click rate of the user is improved.
Furthermore, an embodiment of the present invention further provides a storage medium, where a short link generation program is stored, and the short link generation program, when executed by a processor, implements the steps of the short link generation method as described above.
In addition, referring to fig. 5, an embodiment of the present invention further provides a short link generation apparatus, where the short link generation apparatus includes:
the encryption module 10 is used for encrypting the original long chain link to be popularized to obtain an encryption string;
a grouping module 20, configured to group the encrypted strings to obtain a preset number of grouped strings;
an establishing module 30, configured to establish a corresponding short link initial value for each packet string;
and the operation module 40 is configured to perform operation on each short link initial value, and form each obtained operation result into a candidate short link address.
Other embodiments or specific implementation manners of the short link generation device according to the present invention may refer to the above method embodiments, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third and the like do not denote any order, but rather the words first, second and the like may be interpreted as indicating any order.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A short link generation method, characterized by comprising the steps of:
encrypting an original long link to be popularized to obtain an encrypted string;
grouping the encrypted strings to obtain a preset number of grouped strings;
establishing a corresponding short chain connection initial value for each packet string;
and computing each short link initial value, and forming a candidate short link address by each obtained computing result.
2. The short link generation method of claim 1, wherein after the operation is performed on each of the short link initial values and the obtained operation results are grouped into the candidate short link ground address, the method further comprises:
sending the candidate short link to a target terminal;
when the user clicks the candidate short link through the target terminal, intercepting and analyzing an http request of the user to obtain the candidate short link;
searching an original long link in a preset cache according to the candidate short link;
if the page is found, the page corresponding to the original long-chain connection is redirected.
3. The short link generation method of claim 2, wherein when the user clicks the candidate short link through the target terminal, intercepting and analyzing an http request of the user, and after obtaining the candidate short link, further comprising:
acquiring the access times, equipment types, access areas and time period information of the user;
and tracking the behavior of the user according to the access times, the equipment type, the access area and the time period information, and performing data analysis.
4. The short link generation method of claim 2, wherein after searching for an original long link in a preset cache according to the candidate short link, the method further comprises:
and if the mapping relation between the selected short link and the original long link is not found, searching the mapping relation between the selected short link and the original long link in a relational database.
5. The short link generation method according to claim 1, wherein encrypting the original long link to be promoted to obtain an encrypted string specifically includes:
and encrypting the original long link to be popularized and the custom key by an MD5 encryption algorithm to obtain an encryption string.
6. The short link generation method according to claim 1, wherein the performing an operation on each of the short link initial values and forming each obtained operation result into a candidate short link address specifically comprises:
step S1, performing a bit and operation on each of the short link initial values and the first preset value, and performing a bit and operation on the obtained value and the second preset value;
step S2, selecting characters in a preset character table by using the obtained result as a subscript;
and moving the short link initial value by a preset digit to the right to obtain a new short link initial value, repeatedly executing the step S1 and the step S2, and repeatedly executing preset times to obtain a candidate short link address.
7. The short link generation method according to any one of claims 1 to 6, further comprising, after performing an operation on each of the short link initial values and forming each of the obtained operation results into a candidate short link ground address:
storing the mapping relation between the candidate short link address and the original long link at a short link server;
and caching the mapping relation between the candidate short link address and the original long link in the redis.
8. A short link generation apparatus, comprising:
the encryption module is used for encrypting the original long chain link to be popularized to obtain an encryption string;
the grouping module is used for grouping the encrypted strings to obtain a preset number of grouped strings;
the establishing module is used for establishing a corresponding short-chain-connection initial value for each packet string;
and the operation module is used for operating each short link initial value and forming a candidate short link address by each obtained operation result.
9. A short link generation device, the short link generation device comprising: memory, a processor and a short link generation program stored on the memory and executable on the processor, the short link generation program when executed by the processor implementing the steps of the short link generation method according to any one of claims 1 to 7.
10. A storage medium having stored thereon a short link generation program which, when executed by a processor, implements the steps of the short link generation method of any one of claims 1 to 7.
CN202110842631.8A 2021-07-26 2021-07-26 Short link generation method, device, equipment and storage medium Pending CN113505318A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110842631.8A CN113505318A (en) 2021-07-26 2021-07-26 Short link generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110842631.8A CN113505318A (en) 2021-07-26 2021-07-26 Short link generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113505318A true CN113505318A (en) 2021-10-15

Family

ID=78014722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110842631.8A Pending CN113505318A (en) 2021-07-26 2021-07-26 Short link generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113505318A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114169917A (en) * 2021-11-17 2022-03-11 广州市玄武无线科技股份有限公司 Information sending method, platform, system, electronic equipment and storage medium
CN115587609A (en) * 2022-09-27 2023-01-10 深圳市智码通科技有限公司 Short-link two-dimensional code generation method and device
CN116501997A (en) * 2023-06-28 2023-07-28 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114169917A (en) * 2021-11-17 2022-03-11 广州市玄武无线科技股份有限公司 Information sending method, platform, system, electronic equipment and storage medium
CN115587609A (en) * 2022-09-27 2023-01-10 深圳市智码通科技有限公司 Short-link two-dimensional code generation method and device
CN116501997A (en) * 2023-06-28 2023-07-28 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium
CN116501997B (en) * 2023-06-28 2023-09-26 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113505318A (en) Short link generation method, device, equipment and storage medium
WO2019095416A1 (en) Information pushing method and apparatus, and terminal device and storage medium
US10509905B2 (en) Ransomware mitigation system
CN101523393B (en) Locally storing web-based database data
CN111475376B (en) Method, apparatus, computer device and storage medium for processing test data
WO2017080366A1 (en) Method and apparatus for recognising camouflage download link
CN105824909A (en) Page generation method and device
US9275018B2 (en) Techniques for analyzing web pages to determine font subsets
US20110055357A1 (en) Server apparatus, communication apparatus, and method for generating navigation information
US10015253B2 (en) System and method for preemptive request processing
CN110888838A (en) Object storage based request processing method, device, equipment and storage medium
CN107844488B (en) Data query method and device
CN113094334B (en) Digital service method, device, equipment and storage medium based on distributed storage
CN111222075A (en) Data transmission method based on multiple Webviews, server and storage medium
CN111222153B (en) Application program authority management method and device and storage medium
CN113064562A (en) Man-machine interaction printing method and system based on block chain
JP5197681B2 (en) Login seal management system and management server
CN114039801B (en) Short link generation method, short link analysis system, short link analysis equipment and storage medium
CN112182603B (en) Anti-crawler method and device
CN115640471A (en) Short link generation method and device, computer equipment and storage medium
CN111368231B (en) Method and device for testing heterogeneous redundancy architecture website
JP2009230662A (en) Web-site determination device and web-site determination program
JP2011186639A (en) Content relation management system, content relation management device, content relation management method and program
US11929994B2 (en) Web scraping prevention system
JP6420728B2 (en) Mask processing system, mask processing method, user terminal, and server

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