A method and apparatus for accessing long links based on short links
By splitting and decrypting the short link address, obtaining the short link ID value, and finding the long link identifier, the long link address is finally decrypted, which solves the problem of long URLs taking up length and affecting user experience, and enables accurate access from short links to long links.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- THINKCAR TECH CO LTD
- Filing Date
- 2023-03-31
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, long URLs not only occupy length space and affect aesthetics, but also result in a poor user experience. How to effectively access long URLs through short links is a challenge.
By obtaining the short link address, splitting and decrypting it to get the short link ID value, and then using the database to find the long link identifier and finally decrypting it to get the long link address, reverse access from short link to long link can be achieved.
It enables accurate access to long link content through short links, ensuring data security and access accuracy.
Smart Images

Figure CN116166900B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method and apparatus for accessing long links based on short links. Background Technology
[0002] The Internet refers to the connection between two or more computers, or between two or more computer terminals, clients, and servers, through computer information technology. People can send emails to friends or colleagues thousands of miles away, work together on a task, or enjoy entertainment together. The way information is transmitted through URLs when communicating via the Internet to work together on a task or enjoy entertainment is through URLs, which are the addresses of web pages on the Internet.
[0003] In particular, enterprises, institutions, or individuals use technology to store information on the Internet in a page-by-page manner, with each page having a corresponding address, so that other users can access and obtain information.
[0004] In the internet, to access another computer from one computer, you must know the other's URL. As the categories of goods and services become increasingly diverse, the URLs for product details are growing longer. Excessively long URLs not only take up valuable space but also negatively impact aesthetics and user experience. Therefore, short URLs are used to shorten long website links into shorter ones. However, ultimately, the short URL still accesses the long link's address to display its content. How to access the long link through a short URL depends on how the short URL was generated. Summary of the Invention
[0005] The main purpose of this application is to provide a method and apparatus for accessing long links based on short links, which aims to express how to access long links through short links.
[0006] This application proposes a method for accessing long links based on short links, the improvement of which is that the method includes:
[0007] Get the shortened link address;
[0008] The short link address is split for the first time according to the splitting procedure to obtain the domain name and short code;
[0009] The short code is decrypted for the first time according to the decryption principle to obtain the short link ID value;
[0010] The database is retrieved, and the long link identifier is obtained by searching the database according to the short link ID value. The short link ID value and the long link identifier have a unique correspondence.
[0011] The long link identifier is decrypted a second time according to the decryption principle to obtain the long link address;
[0012] Select the long link address and click to browse.
[0013] As an improvement to the above technical solution, the method for performing a first decryption of the short code according to the decryption principle to obtain the short link ID value includes:
[0014] The short codes are sorted in reverse order to obtain the target string;
[0015] The target string is split a second time according to the splitting procedure to obtain the preset string and the quotient Bn+1;
[0016] The preset string is split a third time according to the splitting procedure to obtain the index value M, where each index value M corresponds to a remainder A.
[0017] As a further improvement to the above technical solution, the method further includes:
[0018] Record the remainder A corresponding to each subscript value M, and obtain remainders A1, A2, ..., An+1. Each remainder A1, A2, ..., An+1 is assigned a quotient B, which are represented as B1, B2, ..., Bn+1 respectively.
[0019] Collectors B1, B2, ..., Bn+1.
[0020] As a further improvement to the above technical solution, the method further includes:
[0021] Obtain an encryption lookup table, which consists of multiple strings, where the number of strings is N;
[0022] Compare the quotient Bn+1 with N;
[0023] If the quotient Bn+1 is less than N, then according to the multiplication principle, the quotient Bn+1 is multiplied by N and the remainder An+1 is added to obtain the quotient Bn.
[0024] As a further improvement to the above technical solution, the method further includes:
[0025] According to the multiplication principle, the quotient Bn is multiplied by N and then the remainder An is added to obtain the quotient Bn-1, until the quotient B1 is obtained;
[0026] Multiply the quotient B1 by the N and add the remainder A1 to obtain the short link ID value.
[0027] As a further improvement to the above technical solution, the method further includes:
[0028] If the quotient Bn+1 is greater than N, then return to re-decrypt the short code.
[0029] This application also provides an apparatus for accessing long links based on short links, comprising:
[0030] A first processing unit is used to obtain the short link address;
[0031] The first splitting unit is used to perform a first split on the short link address according to the splitting procedure to obtain the domain name and short code;
[0032] The first decryption unit is used to perform a first decryption on the short code according to the decryption principle to obtain the short link ID value;
[0033] The second processing unit is used to obtain a database, search the database according to the short link ID value, and obtain the long link identifier. The short link ID value and the long link identifier have a unique correspondence.
[0034] The second decryption unit is used to perform a second decryption on the long link identifier according to the decryption principle to obtain the long link address;
[0035] The visit unit is used to select the long link address and click to enter the browsing.
[0036] As a further improvement to the above technical solution, the first decryption unit further includes:
[0037] The first decryption subunit is used to reverse the sorting of the short code to obtain the target string;
[0038] The second decryption subunit is used to perform a second split on the target string according to the splitting procedure to obtain a preset string and a quotient Bn+1;
[0039] The third decryption subunit is used to perform a third split on the preset string according to the splitting program to obtain the index value M, wherein each index value M corresponds to a remainder A.
[0040] This application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method for accessing long links based on short links.
[0041] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method for accessing long links based on short links.
[0042] The beneficial effect of this application is that by generating short links, long links can be found in reverse. This targeted search method ultimately obtains the unique content displayed within the long link. Attached Figure Description
[0043] Figure 1 This is a flowchart illustrating a method for accessing long links based on short links, according to an embodiment of this application.
[0044] Figure 2 This is a structural framework diagram of an apparatus for accessing long links based on short links, according to an embodiment of this application.
[0045] Figure 3 This is a partial structural framework diagram of an apparatus for accessing long links based on short links, according to an embodiment of this application.
[0046] Figure 4 This is a schematic diagram of the internal structure of a computer device according to an embodiment of this application.
[0047] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings.
[0048] 100. First processing unit, 200. First splitting unit, 300. First decryption unit, 400. Second processing unit, 500. Second decryption unit, 600. Visiting unit, 3001. First decryption subunit, 3002. Second decryption subunit, 3003. Third decryption subunit. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0052] Example 1
[0053] refer to Figure 1 This application discloses a method for accessing long links based on short links, the method comprising:
[0054] S1: Get the shortened link address;
[0055] S2: Perform the first split on the short link address according to the splitting procedure to obtain the domain name and short code;
[0056] S3: Perform the first decryption on the short code according to the decryption principle to obtain the short link ID value;
[0057] S4: Obtain the database, search the database according to the short link ID value to obtain the long link identifier, and the short link ID value and the long link identifier have a unique correspondence;
[0058] S5: Perform a second decryption on the long link identifier according to the decryption principle to obtain the long link address;
[0059] S6: Select the long link address and click to enter the browser.
[0060] In the above embodiments, the method of accessing long links based on short links in this application is related to the generation method of short links. It mainly reverses the generation method of short links to find the long link address. Clicking the long link address can obtain the content displayed in the long link address. In steps S1-S6, the short link address is first obtained, and then the short link address is split. The main purpose here is to find the short code, because when generating short links, the short code is the key data to find the long link identifier. The long link address can be obtained by the long link identifier. Therefore, obtaining the short code is the key step of accessing long links based on short links.
[0061] The short code is decrypted for the first time according to the decryption principle to obtain the short link ID value. This short link ID value is also related to the long link identifier. After obtaining the short link ID value, the long link identifier can be queried from the database based on the short link ID value. Before this, the long link identifier is stored in the database, and a new short link ID value is added each time it is stored. Therefore, the short link ID value and the long link identifier have a unique correspondence. After obtaining the long link identifier, a second decryption is performed on the long link identifier according to the decryption principle to obtain the long link address. The long link address is selected and clicked to browse. This application discloses how to access the content of a long link through a short link to obtain the long link content.
[0062] Furthermore, the method for performing a first decryption on the short code according to the decryption principle to obtain the short link ID value includes:
[0063] S311: Reverse sort the short code to obtain the target string;
[0064] S312: Perform a second split on the target string according to the splitting procedure to obtain a preset string and a quotient Bn+1;
[0065] S313: Perform a third split on the preset string according to the splitting procedure to obtain the index value M, wherein each index value M corresponds to a remainder A;
[0066] S314: Record the remainder A corresponding to each subscript value M, and obtain remainders A1, A2, ..., An+1. Each remainder A1, A2, ..., An+1 is assigned a quotient B, which are represented as B1, B2, ..., Bn+1 respectively.
[0067] S315: Collectors B1, B2, ..., Bn+1;
[0068] S316: Obtain an encryption lookup table, which consists of multiple strings, wherein the number of strings is N;
[0069] S317: Compare the quotient Bn+1 with N;
[0070] S318: If the quotient Bn+1 is less than N, then according to the multiplication principle, multiply the quotient Bn+1 by N and add the remainder An+1 to obtain the quotient Bn;
[0071] S318: Multiply the quotient Bn by N according to the multiplication principle and add the remainder An to obtain the quotient Bn-1, until the quotient B1 is obtained;
[0072] S319: Multiply the quotient B1 by the N and add the remainder A1 to obtain the short link ID value;
[0073] S320: If the quotient Bn+1 is greater than N, then return to re-decrypt the short code.
[0074] In the above embodiment, for example, the encryption lookup table is defined as $char, where $char consists of N strings, including lowercase letters, uppercase letters, and Arabic numerals, i.e., az, AZ, and 0-9, where N = 62. In the method of generating short links:
[0075] The process involves dividing the short link ID value by N (62) to obtain a remainder A1 and a quotient B1. A first check is performed on remainder A1 and quotient B1 to determine if quotient B1 is greater than N (62). If quotient B1 is greater than N, a division operation is performed on quotient B1 to obtain remainder A2 and quotient B2. After each division operation, a check is executed to determine if the resulting quotient Bn is greater than N. If the final check results in quotient Bn+1 being less than N, then remainders A1, A2, ..., An, An+1 and quotients B1, B2, ..., Bn, Bn+1 are collected.
[0076] Furthermore, the lookup procedure iteratively queries the remainders A1, A2, ..., An+1 to identify multiple index values M of the encrypted lookup table corresponding to the remainders A1, A2, ..., An+1, where the index values M range from 0 to 61. These multiple index values M are then concatenated sequentially according to the acquisition order to obtain a preset string. The quotient Bn+1 is then obtained and concatenated after the preset string to obtain the target string. The target string is then reversed to obtain a short code. For example, if the target string is AB321cba, after reversing the sorting, it becomes abc123AB, and the short code is abc123AB.
[0077] After obtaining the short code, obtain the domain name, for example, the domain name is: http: / / www.abc.com. Concatenate the short code to the domain name to obtain the short link, which is represented as http: / / www.abc.com / abc123AB.
[0078] Therefore, during the process of generating short links, when visiting long links, the original long link address can be found by reverse searching the generation method of the short links. Furthermore, by obtaining the key of the short link generation method and decrypting it during the reverse search process, this application ensures the accuracy of the data obtained during the visit. Regarding steps S311-S320, the short link generation method obtains a short code through encryption. This application mainly discloses a method for performing a first decryption of the short code according to decryption principles to obtain the short link ID value:
[0079] The short code is reverse-sorted to obtain the target string; the target string is split a second time according to the splitting procedure to obtain a preset string and a quotient Bn+1; the preset string is split a third time according to the splitting procedure to obtain the index value M, where each index value M corresponds to a remainder A; the remainder A corresponding to each index value M is recorded to obtain remainders A1, A2, ..., An+1, where each remainder A1, A2, ..., An+1 is assigned a quotient B, which are represented as B1, B2, ..., Bn+1 respectively; collect... Quotients B1, B2, ..., Bn+1; Obtain an encryption lookup table, which consists of multiple strings, where the number of strings is N; Compare the quotient Bn+1 with N; If the quotient Bn+1 is less than N, multiply the quotient Bn+1 by N according to the multiplication principle and add the remainder An+1 to obtain the quotient Bn; Multiply the quotient Bn by N according to the multiplication principle and add the remainder An to obtain the quotient Bn-1, until the quotient B1 is obtained; Multiply the quotient B1 by N and add the remainder A1 to finally obtain the short link ID value.
[0080] If the quotient Bn+1 is greater than N, then return to decrypt the short code again, that is, re-execute steps S311-S320.
[0081] After obtaining the short link ID value, the database can be searched based on the short link ID value to obtain the long link identifier. The short link ID value and the long link identifier have a unique correspondence. The long link identifier is then decrypted a second time according to the decryption principle to obtain the long link address. The long link address is selected and clicked to browse. This application discloses a method of accessing long links through short link generation to obtain long link content. Moreover, data is encrypted during the short link generation process, and the reverse search for the long link requires a key for decryption, which can ensure data security.
[0082] Example 2
[0083] refer to Figure 2This application also discloses an apparatus for accessing long links based on short links, the apparatus comprising:
[0084] The first processing unit 100 is used to obtain the short link address;
[0085] The first splitting unit 200 is used to perform a first split on the short link address according to the splitting procedure to obtain the domain name and short code;
[0086] The first decryption unit 300 is used to perform a first decryption on the short code according to the decryption principle to obtain the short link ID value;
[0087] The second processing unit 400 is used to obtain a database, search the database according to the short link ID value, and obtain the long link identifier. The short link ID value and the long link identifier have a unique correspondence.
[0088] The second decryption unit 500 is used to perform a second decryption on the long link identifier according to the decryption principle to obtain the long link address;
[0089] The visitor unit 600 is used to select the long link address and click to enter the browsing.
[0090] The first decryption unit 300 further includes:
[0091] The first decryption subunit 3001 is used to reverse the sorting of the short code to obtain the target string;
[0092] The second decryption subunit 3002 is used to perform a second split on the target string according to the splitting procedure to obtain a preset string and a quotient Bn+1.
[0093] The third decryption subunit 3003 is used to perform a third split on the preset string according to the splitting program to obtain the index value M, wherein each index value M corresponds to a remainder A.
[0094] The device for accessing long links based on short links in this application can be implemented with reference to the method steps for accessing long links based on short links described above, and will not be repeated here.
[0095] Example 3
[0096] like Figure 4 As shown, this application also provides a computer device, which can be a server, and its internal structure can be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores all data required for a method of accessing long links based on short links. The network interface communicates with external terminals via a network connection. The computer program, when executed by the processor, implements a method of accessing long links based on short links.
[0097] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer equipment on which the present application is applied.
[0098] An embodiment of this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements any of the above-described methods for accessing long links based on short links.
[0099] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media provided in this application and in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0100] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0101] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for accessing long links based on short links, characterized in that, The method includes: Get the shortened link address; The short link address is split for the first time according to the splitting procedure to obtain the domain name and short code; The short code is decrypted for the first time according to the decryption principle to obtain the short link ID value; The database is retrieved, and the long link identifier is obtained by searching the database according to the short link ID value. The short link ID value and the long link identifier have a unique correspondence. The long link identifier is decrypted a second time according to the decryption principle to obtain the long link address; Select the long link address and click to browse; The method for performing a first decryption of the short code according to the decryption principle to obtain the short link ID value includes: The short codes are sorted in reverse order to obtain the target string; The target string is split a second time according to the splitting procedure to obtain the preset string and the quotient Bn+1; The preset string is split a third time according to the splitting procedure to obtain the index value M, wherein each index value M corresponds to a remainder A; Record the remainder A corresponding to each subscript value M, and obtain remainders A1, A2, ..., An+1. Each remainder A1, A2, ..., An+1 is assigned a quotient B, which are represented as B1, B2, ..., Bn+1 respectively. Collectors B1, B2, ..., Bn+1; Obtain an encryption lookup table, which consists of multiple strings, where the number of strings is N; Compare the quotient Bn+1 with N; If the quotient Bn+1 is less than N, then according to the multiplication principle, the quotient Bn+1 is multiplied by N and the remainder An+1 is added to obtain the quotient Bn; According to the multiplication principle, the quotient Bn is multiplied by N and then the remainder An is added to obtain the quotient Bn-1, until the quotient B1 is obtained; Multiply the quotient B1 by the N and add the remainder A1 to obtain the short link ID value.
2. The method for accessing long links based on short links according to claim 1, characterized in that, The method further includes: If the quotient Bn+1 is greater than N, then return to re-decrypt the short code.
3. A device for accessing long links based on short links, characterized in that, include: A first processing unit is used to obtain the short link address; The first splitting unit is used to perform a first split on the short link address according to the splitting procedure to obtain the domain name and short code; The first decryption unit is used to perform a first decryption on the short code according to the decryption principle to obtain the short link ID value; The second processing unit is used to obtain a database, search the database according to the short link ID value, and obtain the long link identifier. The short link ID value and the long link identifier have a unique correspondence. The second decryption unit is used to perform a second decryption on the long link identifier according to the decryption principle to obtain the long link address; A visitor unit, which is used to select the long link address and click to enter the browsing; The first decryption unit further includes: The first decryption subunit is used to reverse the sorting of the short code to obtain the target string; The second decryption subunit is used to perform a second split on the target string according to the splitting procedure to obtain a preset string and a quotient Bn+1; The third decryption subunit is used to perform a third split on the preset string according to the splitting program to obtain the index value M, wherein each index value M corresponds to a remainder A; The short codes are sorted in reverse order to obtain the target string; The target string is split a second time according to the splitting procedure to obtain the preset string and the quotient Bn+1; The preset string is split a third time according to the splitting procedure to obtain the index value M, wherein each index value M corresponds to a remainder A; Record the remainder A corresponding to each subscript value M, and obtain remainders A1, A2, ..., An+1. Each remainder A1, A2, ..., An+1 is assigned a quotient B, which are represented as B1, B2, ..., Bn+1 respectively. Collectors B1, B2, ..., Bn+1; Obtain an encryption lookup table, which consists of multiple strings, where the number of strings is N; Compare the quotient Bn+1 with N; If the quotient Bn+1 is less than N, then according to the multiplication principle, the quotient Bn+1 is multiplied by N and the remainder An+1 is added to obtain the quotient Bn; According to the multiplication principle, the quotient Bn is multiplied by N and then the remainder An is added to obtain the quotient Bn-1, until the quotient B1 is obtained; Multiply the quotient B1 by the N and add the remainder A1 to obtain the short link ID value.
4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method for accessing long links based on short links as described in any one of claims 1-2.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for accessing long links based on short links as described in any one of claims 1-2.