Platform login method and device, electronic equipment and storage medium
By constructing a list of platform domain associations and utilizing browser extensions to obtain login information, the problems of low login success rate and poor stability in traditional data collection systems were solved, enabling login status sharing between platforms and improving login and data collection efficiency.
Patent Information
- Application Number
- CN202511065433.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-04
AI Technical Summary
Traditional data collection systems suffer from low login success rates and poor stability when faced with complex CAPTCHAs and behavioral analysis. Automated tools are easily identified as machine behavior, and manually obtaining cookies is inefficient and has a short validity period, resulting in low efficiency during the platform login process.
By pre-building a list of associated platform domains and using browser extensions to obtain login information from text files, login status sharing between platform domains can be achieved, reducing repeated login operations.
It improved platform login efficiency and data collection efficiency, reduced repeated login operations, and enhanced system stability and data collection reliability.
Smart Images

Figure CN120896743A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a platform login method and device, electronic equipment and storage medium. BACKGROUND
[0002] In many current technical solutions for browser data collection, HTTP (Hypertext Transfer Protocol) requests are simulated to directly submit login forms, or automated tools are used, or manual login is used to obtain cookies (small text files stored in client browsers by websites) to sequentially log in each preset platform such as a shopping platform to collect data.
[0003] However, in the above data collection methods, the simulated HTTP requests are difficult to deal with complex verification codes and the like, resulting in login failure, and the automated tools are easily identified as machine behavior, causing logout and poor stability, and manual login to obtain cookies is low in efficiency and short in validity period, requiring timely maintenance, and the login method for each platform is low in efficiency. Therefore, the traditional data collection system has technical problems of low login success rate, poor stability, and low data collection efficiency in the process of collecting data from preset platforms. SUMMARY
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a platform login method and device, electronic equipment and storage medium.
[0005] The platform login method provided by the present disclosure is applied to a device for deploying a data collection system, and the method comprises: acquiring a text file collected by an extension component based on a client browser; wherein the text file comprises login information of a preset platform; acquiring an associated platform domain name based on a preset platform domain name of the preset platform and a pre-stored platform domain name association list; accessing the preset platform based on the preset platform domain name and logging into the preset platform according to the login information, wherein the associated platform is in a login state when the associated platform is accessed based on the associated platform domain name; or, accessing the associated platform based on the associated platform domain name and logging into the associated platform according to the login information, wherein the preset platform is in a login state when the preset platform is accessed based on the preset platform domain name.
[0006] The embodiment of the present disclosure further provides a platform login device, applied to a device deploying a data collection system, the device comprising: a first acquisition module configured to acquire a text file collected by an extension component based on a client browser; wherein the text file comprises login information of a preset platform; a second acquisition module configured to acquire an associated platform domain name based on a preset platform domain name of the preset platform and a pre-stored platform domain name association list; a login module configured to access the preset platform based on the preset platform domain name and log in the preset platform according to the login information, wherein the associated platform is in a login state when the associated platform is accessed based on the associated platform domain name; or the login module is further configured to access the associated platform based on the associated platform domain name and log in the associated platform according to the login information, wherein the preset platform is in a login state when the preset platform is accessed based on the preset platform domain name.
[0007] The embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; and the processor is configured to read the executable instructions from the memory and execute the instructions to implement the platform login method provided by the embodiment of the present disclosure.
[0008] The embodiment of the present disclosure further provides a computer readable storage medium, which stores a computer program, and the computer program is used to execute the platform login method provided by the embodiment of the present disclosure.
[0009] The embodiment of the present disclosure further provides a computer program product, comprising a computer program, wherein the computer program is used to execute the platform login method provided by the embodiment of the present disclosure when executed by a processor.
[0010] The above technical solution provided by the embodiment of the present disclosure pre-constructs a platform domain name association list, and after logging in a platform based on login information of a text file after accessing the corresponding platform based on any platform domain name, all platform domain names associated with the any platform domain name in the platform domain name association list are in a login state when accessing the corresponding platform, so that fewer login times can be initiated to complete more platform logins, the login state sharing between related platforms is realized, repeated login operations are reduced, and the platform login efficiency and data collection efficiency are improved.
[0011] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0012] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
[0014] Figure 1 A flowchart of a platform login method provided by an embodiment of the present disclosure is shown in FIG. 1.
[0015] Figure 2 A flowchart of a platform login method provided by an embodiment of the present disclosure is shown in FIG. 1.
[0016] Figure 3 A platform login flowchart provided by an embodiment of the present disclosure is shown in FIG. 1.
[0017] Figure 4 A structural diagram of a platform login device provided by an embodiment of the present disclosure is shown in FIG. 1.
[0018] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present disclosure is shown in FIG. 1. DETAILED DESCRIPTION
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
[0020] In the following description, many specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure can also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some of the embodiments of the present disclosure, not all the embodiments.
[0021] In actual application scenarios, the data acquisition system automatically logs in to each preset platform such as an e-commerce platform under user authorization to perform data acquisition; in application scenarios such as e-commerce platform data analysis, price monitoring, and commodity information acquisition, it is necessary to frequently access the e-commerce platform to obtain data; these e-commerce platforms usually require users to log in to access complete commodity information, and have adopted complex data protection mechanisms, including but not limited to multiple protection measures such as verification code recognition, behavior analysis, and device fingerprint recognition.
[0022] The traditional data collection system mainly adopts the following login methods when facing these e-commerce platforms, including submitting a login form directly by simulating HTTP requests, using an automation tool such as Selenium (a tool for testing web applications, which can run directly in the browser, just like a real user is operating), to simulate user login behavior, manually logging in to obtain cookies and using them in the data collection system; however, simulating HTTP requests is difficult to deal with complex verification codes and behavior analysis, automation tools are easily identified as machine behavior, manually obtaining cookies is inefficient and the cookies have a short validity period, and the cookie management and update mechanism is complex, making it difficult to maintain and the login method for each platform is relatively inefficient; thus, the traditional data collection system has the technical problems of low login success rate, poor stability, and low data collection efficiency in the login process of e-commerce platforms.
[0023] To solve the above problems, the embodiment of the present disclosure proposes a platform login method, which pre-constructs a platform domain name association list. After accessing the corresponding platform based on any platform domain name and logging in to the platform according to the login information of the text file, all platform domain names associated with the aforementioned any platform domain name in the platform domain name association list access the corresponding platform in the login state, so that fewer login times can be initiated to complete more platform logins, the login state sharing between related platforms is realized, repeated login operations are reduced, and the platform login efficiency and data collection efficiency are improved. The following will be explained and described in detail:
[0024] Figure 1 A flowchart of a platform login method provided by the embodiment of the present disclosure is shown. The method can be applied to a client, such as a computer, a mobile phone, a tablet computer, a television, a server, etc., which is not limited here. As shown in Figure 1 The method mainly includes the following steps S102-S108:
[0025] Step 102, obtaining a text file collected by an extension component based on a client browser; wherein the text file includes login information of a preset platform.
[0026] In the embodiment of the present disclosure, the pre-set extension component is installed in one or more browsers of the client under the condition of user authorization; the extension component includes configuration files, script files, page files and other components.
[0027] The configuration file includes basic information of the extension component, such as an extension component version, an extension component name, permission information such as specific preset platform permissions such as an e-commerce platform, and resource information such as obtaining a Cookie and a specified server as a target server, and the configuration file is set according to an actual application scenario. The script file includes a background script for processing Cookie acquisition and synchronization logic, a content script for interacting with a web page of the browser to detect a login state of the preset platform, and the like, and the script file is set according to an actual application scenario. The page file can be a pop-up page file for providing a user interface and a manual synchronization function, and the like, and the page file is set according to an actual application scenario.
[0028] It can be understood that after the preset extension component is installed in the browser, the extension component has functions of pre-configured detection of a login state, acquisition of a Cookie, and synchronization of the Cookie.
[0029] Specifically, the extension component is used as an intermediate layer between the browser and the data collection system, and connects the browsing behavior of a real user and the data collection system. In the case of user authorization, the login state of a certain platform is detected based on the extension component, a text file is acquired based on the login state, and the text file is synchronized to a target server or stored locally on the terminal, so that the data collection system can acquire a text file including the latest login information to log in to the platform, efficient and stable access to the platform is achieved, and platform login efficiency is improved and maintenance costs are reduced.
[0030] The preset platform can be selected and set according to actual application needs, such as an e-commerce platform, a video platform, and an audio platform.
[0031] Specifically, a text file application programming interface based on the browser is used to acquire a text file corresponding to a platform domain name, and the text file corresponding to the platform domain name is acquired in a preset partition storage. The text file includes login information of the preset platform.
[0032] The text file application programming interface based on the browser extension can acquire a target attribute text file (such as a Cookie with an HttpOnly attribute), which solves the technical problem that the traditional platform login cannot acquire key authentication information.
[0033] Therefore, based on the text file application programming interface, all text files of the preset platform can be obtained, including text files with target attributes. Specifically, based on the browser's text file application programming interface, the text file corresponding to the platform domain can be obtained. That is, according to different preset platforms, the corresponding platform domain is selected, and the text file application programming interface is used to obtain the text file corresponding to the platform domain. For example, if the browser is Chrome, all cookies of the specified domain can be obtained as text files through the Chrome Cookies API (Application Programming Interface).
[0034] In practical applications, Partitioned Cookies are a new mechanism for storing cookies in browsers, providing better privacy protection and cross-site functionality support. By storing cookies in different partitions, independent management of cookies is achieved, thus resolving the contradiction between privacy protection and functional requirements in traditional cookie mechanisms.
[0035] Therefore, it is necessary to retrieve all matching partition cookies as text files by querying the platform domain name in the preset partition storage.
[0036] It is understandable that the text file stores all the login information of the preset platform, such as login ID and login time, as strings.
[0037] In this embodiment of the disclosure, the text file is stored locally on the client or sent to the target server for storage, so that the data acquisition system can obtain all the login information of the preset platform from the local storage of the client or the target server and log in to the preset platform.
[0038] It should be noted that when the text file cannot be obtained and / or the abnormal information of the target server is not obtained, a prompt page is displayed in the browser in a preset format based on the extended component.
[0039] Step 104: Obtain the associated platform domains based on the preset platform domains and the pre-stored platform domain association list.
[0040] Specifically, each platform has a corresponding platform domain name, and login to the corresponding platform is done through the platform domain name. Therefore, a preset platform has a corresponding preset platform domain name, which can uniquely identify a preset platform.
[0041] It is understandable that during the platform login process, different but related platforms (such as e-commerce platforms Taobao and Tmall) need to be logged in separately, resulting in repeated logins and low efficiency.
[0042] In an embodiment of the present disclosure, different but related platforms are associated through a platform domain name association list, so that the data collection system logs in to the preset platform and the associated platforms based on a text file.
[0043] Among them, the pre-stored platform domain name association list refers to the set of platform domain names corresponding to each preset platform, which can be one or more; in some embodiments, at least one candidate platform domain name corresponding to the preset platform domain name is obtained, the domain name similarity between the preset platform domain name and the candidate platform domain name is calculated, and when the domain name similarity is greater than or equal to the preset similarity threshold, the candidate platform domain name is used as the associated platform domain name corresponding to the preset platform domain name, and a platform domain name association list is constructed; in other embodiments, the target entity information to which the preset platform domain name belongs is obtained, and the platform domain name corresponding to the target entity information is obtained, and the platform domain name corresponding to the target entity information is used as the associated platform domain name corresponding to the preset platform domain name, and a platform domain name association list is constructed.
[0044] Specifically, in order to achieve the sharing of login states between related platforms, the embodiment of the present disclosure designs a platform domain name association list to associate different but related preset platforms. For example, map "Ymall.com" (Y Cat) to "Xaobao.com" (X Treasure), so that the platform login system can access the Y Cat platform using the Cookie of X Treasure.
[0045] Exemplarily, the platform domain name association list is like "Ymall.com" associated with "Xaobao.com", "detail.ymall.com" associated with "Xaobao.com", and "item.xaobao.com" associated with "Xaobao.com".
[0046] Thus, by matching the preset platform domain name of the preset platform with the platform domain name association list, one or more associated platform domain names can be obtained.
[0047] After step 104, step 106 and / or step 108 can be executed, which is specifically set according to the actual application scenario.
[0048] Step 106, access the preset platform based on the preset platform domain name and log in to the preset platform according to the login information. When accessing the associated platform based on the associated platform domain name, the associated platform is in the logged-in state.
[0049] Step 108, access the associated platform based on the associated platform domain name and log in to the associated platform according to the login information. When accessing the preset platform based on the preset platform domain name, the preset platform is in the logged-in state.
[0050] Specifically, after accessing the preset platform based on the preset platform domain name and logging in the preset platform based on the login information, the associated platform is in a login state when accessing the associated platform based on the associated platform domain name; or, after accessing the associated platform based on the associated platform domain name and logging in the associated platform based on the login information, the preset platform is in a login state when accessing the preset platform based on the preset platform domain name.
[0051] That is, the login information of the preset platform can log in the preset platform or the associated platform. As long as any one of the preset platform or the associated platform is in a login state, the other platform shares the login state, so that logging in one platform can realize that multiple platforms are in a login state, and initiating fewer login times can complete more platform logins.
[0052] To sum up, the platform login method of the embodiment of the present disclosure is applied to a device for deploying a data collection system, which comprises: obtaining a text file collected by an extension component based on a client browser; wherein the text file comprises login information of a preset platform; obtaining an associated platform domain name based on a preset platform domain name of the preset platform and a pre-stored associated list of platform domain names; accessing the preset platform based on the preset platform domain name and logging in the preset platform based on the login information, and the associated platform is in a login state when accessing the associated platform based on the associated platform domain name; or, accessing the associated platform based on the associated platform domain name and logging in the associated platform based on the login information, and the preset platform is in a login state when accessing the preset platform based on the preset platform domain name. Thus, the associated list of platform domain names is constructed in advance, and after accessing the corresponding platform based on any platform domain name and logging in the platform based on the login information of the text file, all platform domain names associated with the aforementioned any platform domain name in the associated list of platform domain names are in a login state when accessing the corresponding platform, so that fewer login times can be initiated to complete more platform logins, the login state sharing between related platforms is realized, repeated login operations are reduced, and the platform login efficiency and data collection efficiency are improved.
[0053] In some embodiments, the platform login method further comprises: obtaining at least one candidate platform domain name corresponding to the preset platform domain name; calculating a domain name similarity between the preset platform domain name and the candidate platform domain name; when the domain name similarity is greater than or equal to a preset similarity threshold, taking the candidate platform domain name as the associated platform domain name corresponding to the preset platform domain name, and constructing the associated list of platform domain names.
[0054] The candidate platform domain name refers to a platform domain name that may be associated with the preset platform domain name, so that the domain name similarity between the preset platform domain name and the candidate platform domain name is calculated, and the candidate platform domain name with a domain name similarity greater than or equal to a preset similarity threshold is taken as the associated platform domain name corresponding to the preset platform domain name, thereby constructing a mapping relationship between the preset platform domain name and the associated platform domain name, and obtaining the associated list of platform domain names.
[0055] The domain name similarity between the preset platform domain name and the candidate platform domain name can be calculated in many ways. In some embodiments, the preset platform domain name and the candidate platform domain name are respectively encoded to obtain a preset platform vector and a candidate platform vector, and the cosine similarity between the preset platform vector and the candidate platform vector is calculated as the domain name similarity. In other embodiments, the number of identical strings between the preset platform domain name and the candidate platform domain name is counted, and the number of identical strings is used to determine the domain name similarity. The above are only examples, and the present disclosure does not specifically limit the way of calculating the domain name similarity between the preset platform domain name and the candidate platform domain name.
[0056] The above describes that the associated platform domain name is determined by calculating the similarity between the domain names, and the mapping relationship between the preset platform domain name and the associated platform domain name is constructed to obtain the platform domain name association list, thereby further improving the subsequent platform login efficiency.
[0057] In some embodiments, the platform login method further comprises: obtaining target entity information to which the preset platform domain name belongs, and obtaining platform domain names corresponding to the target entity information; taking the platform domain names corresponding to the target entity information as the associated platform domain names corresponding to the preset platform domain name, and constructing the platform domain name association list.
[0058] The target entity information refers to a target entity to which the platform belongs. One target entity can include multiple businesses, thereby having corresponding platforms, and each platform has a different platform domain name. In order to improve the login efficiency, the platform domain names of the platforms can be associated as a platform domain name association list.
[0059] Therefore, the platform domain names belonging to the same target entity are constructed into a platform domain name association list, thereby improving the domain name management efficiency and further improving the subsequent platform login efficiency.
[0060] In some embodiments, the platform login method further comprises: receiving update information of a text file, and obtaining the updated text file from the local storage of the client or the target server; and sharing the login status of the preset platform and the associated platform based on the updated text file.
[0061] In actual application scenarios, the user may modify the login information and the like. Therefore, after the platforms are logged in, the extension component needs to synchronously update the text file and notify the data collection system, so that the data collection system receives the update information of the text file, obtains the updated text file from the local storage of the client or the target server, and shares the login status of the preset platform and the associated platform based on the updated text file.
[0062] Specifically, the extension component can detect the login state of the platform in real time, and synchronize the text file when the login state is login. The extension component can detect the login state of the platform in many ways. In some embodiments, the extension component obtains the platform page element of the platform, determines whether the platform page element includes a preset element, and determines that the login state is login when the platform page element includes the preset element. The preset element is a pre-set login identifier, such as a login field.
[0063] Specifically, the content script of the extension component can be used to detect the login state of the user on the platform. First, the website page of the preset platform currently accessed is automatically identified, and the login state is determined based on the characteristic elements of the website page of the preset platform, such as page elements, to realize the monitoring and management of the login state of the preset platform by the browser-based extension component. Therefore, the automatic determination of the login state based on the characteristic elements of different platforms can accurately identify the login state, update the invalid Cookie in a timely manner, and improve the stability of the system.
[0064] Specifically, the traditional platform login system cannot obtain the Cookie marked with target attributes such as HttpOnly. Such Cookie usually contains key authentication information and cannot be directly accessed by JavaScript (a lightweight, interpreted, or just-in-time compiled programming language), which causes the platform login system to be unable to obtain the login credentials completely, and seriously affects the integrity and accuracy of the platform login.
[0065] In the embodiments of the present disclosure, the text file application programming interface access permission of the browser extension is used to realize the acquisition of the target attribute text file, solve the technical problem that the traditional platform login cannot obtain key authentication information, and improve the efficiency and effect of the platform login.
[0066] It can be understood that the text file can be obtained from the local storage of the client or the target server. Specifically, a multi-level Cookie storage strategy can be provided, including the database persistence of the target server and the local cache mechanism existing in the local storage of the client. The foregoing multi-level storage strategy ensures the security and availability of the Cookie.
[0067] Specifically, the multi-level storage strategy is used to save and manage the Cookie. The browser local storage saves the Cookie backup in the local using the storage application programming interface; and the target server storage synchronizes the Cookie to the target server and saves it persistently.
[0068] Therefore, during the running of the extension component, the use of the memory cache improves access efficiency, and the multi-level storage strategy ensures the availability and security of the cookie, so that the platform login system can still use the previously synchronized text file to continue platform login even in the case of browser closing or network interruption, further improving the platform login efficiency and effect.
[0069] Specifically, when the text file cannot be obtained and / or abnormal information of the target server is obtained, the extension component displays a prompt page in a preset form in the browser.
[0070] Specifically, when the text file application programming interface cannot obtain the text file or cannot obtain the text file in the preset partition storage, and the server response error and the like are abnormal, the prompt page can be displayed in the preset form such as a pop-up window through the page file of the extension component; wherein the prompt page can be "synchronization error, try again" and the like. Therefore, the user is prompted in the form of a pop-up page, further improving the user experience.
[0071] In some embodiments, the platform login method further comprises: the text file comprises an authorization time of the login information; obtaining the current time and calculating the time interval between the current time and the authorization time, and when the time interval is less than or equal to a preset interval threshold, requesting a new text file from the local storage of the client or the target server.
[0072] Specifically, in order to ensure the effectiveness of the login, the use effective period of the text file can also be set, that is, the authorization time of the login information is, for example, a certain time point, so as to calculate the time interval between the current time and the authorization time in real time, for example, less than five seconds, in order to avoid exiting the platform during data collection, and when the time interval is less than or equal to a preset interval threshold, a new text file is requested from the local storage of the client or the target server for login, so as to ensure the effectiveness of successful login and data collection.
[0073] Based on the foregoing embodiment description, in order to solve the technical problems faced by the traditional data collection system in the preset platform login process, a platform domain name association list is constructed in advance, and after accessing the corresponding platform based on any platform domain name and logging in the platform according to the login information of the text file, all platform domain names associated with the foregoing any platform domain name in the platform domain name association list are in a login state when accessing the corresponding platform, so that fewer login times can be initiated to complete more platform logins, realizing the sharing of login states between related platforms, reducing repeated login operations, and improving the platform login efficiency and data collection efficiency.
[0074] Figure 2 A flowchart of a platform login method provided by the embodiments of the present disclosure is shown, and the method mainly comprises the following steps S202-S212:
[0075] In step S202, at least one candidate platform domain name corresponding to the preset platform domain name is obtained, the domain name similarity between the preset platform domain name and the candidate platform domain name is calculated, when the domain name similarity is greater than or equal to a preset similarity threshold, the candidate platform domain name is taken as the associated platform domain name corresponding to the preset platform domain name, and a platform domain name association list is constructed.
[0076] In step S204, a text file collected based on an extension component of a client browser is obtained; wherein the text file includes login information of the preset platform.
[0077] In step S206, based on the preset platform domain name of the preset platform and the platform domain name association list, the associated platform domain name is obtained.
[0078] In step S208, the preset platform is accessed based on the preset platform domain name and logged in according to the login information, and when the associated platform is accessed based on the associated platform domain name, the associated platform is in a login state.
[0079] In step S210, the associated platform is accessed based on the associated platform domain name and logged in according to the login information, and when the preset platform is accessed based on the preset platform domain name, the preset platform is in a login state.
[0080] In step S212, after receiving update information of the text file, an updated text file is obtained from local storage of the client or a target server, and the preset platform and the associated platform are shared in a login state based on the updated text file.
[0081] Specifically, the browser extension component is used as an intermediate layer between the user browser and the platform login system, avoiding the problems of traditional platform login systems such as verification code recognition and behavior analysis, and improving the login success rate; the platform domain name association list is designed to associate different but related platforms, realizing the login state sharing between related platforms, reducing repeated login operations, and improving the platform login efficiency; the login state is automatically judged according to the characteristic elements of different platforms, the login state is accurately identified, the invalid Cookie is updated in time, and the system stability is improved; a multi-level storage strategy combining browser local storage, server database storage and memory cache is adopted to ensure the availability and security of Cookie and improve the fault tolerance of the system; the partition Cookie processing mechanism is specially used to process the partition Cookie in the new browser, adapts to the latest browser security strategy, and ensures the compatibility of the system in various environments; the specific API of the browser extension is used to realize the complete acquisition of the Cookie with target attributes such as HttpOnly, the HttpOnly Cookie containing key identity verification information is acquired, the integrity of the login credential is ensured, and the stability and reliability of the platform login system are significantly improved.
[0082] For example, step 3.1, the user accesses the preset platform, that is, the user opens the website page of the preset platform in the browser; step 3.2, the extension component detects the login state, that is, after the extension component is installed in the browser, the extension component can detect the website page of the preset platform in real time to obtain the login state (such as login or not login) of the preset platform; step 3.3, obtaining the platform Cookie, that is, when the login state of the preset platform is detected as login, the corresponding Cookie of the preset platform needs to be updated in time, so as to obtain the Cookie through the text file application programming interface, and after the Cookie is obtained from the partition storage, the Cookie is processed by de-duplication, formatting and the like, and then step 3.4 is executed; step 3.4, synchronizing to the target server of the backend, storing the Cookie of the preset platform to the target server, and also storing to the local cache of the browser to improve the processing efficiency; step 3.5, Cookie mapping conversion, that is, determining one or more preset platforms to which the Cookie belongs according to the platform domain name association list; step 3.6, the platform login system uses the Cookie to access the platform for platform login.
[0083] It should be noted that the Cookie expiration time can also be predicted based on a machine learning algorithm, and the Cookie can be updated in advance to further ensure the effectiveness of platform login; a distributed Cookie pool can be established to realize load balancing and high availability, that is, the Cookie can be stored in multiple target servers, and the multiple target servers are distributed; the Cookie can also be encrypted to enhance the encryption mechanism in the Cookie transmission process and improve the security; in addition, when the Cookie expires, the user behavior can be simulated to automatically log in again to further ensure the effectiveness of platform login, thereby improving the efficiency and effect of platform login.
[0084] Specifically, the extension component of the browser is designed, the browser extension is developed by using a browser extension framework, the extension component can include a Manifest (configuration) file, which defines the basic information, permissions and resources of the extension; the script file includes a background script (Background Script) for processing Cookie acquisition and synchronization logic; a content script (Content Script) for interacting with a webpage and detecting a login state; a page file for popping up a page (Popup) to provide a user interface and a manual synchronization function.
[0085] For example, the extended manifest.json file is defined as follows: "manifest_version": 3, / / indicates the version of the extension component, 3 refers to the currently recommended version; "name": "Platform Cookie Synchronization Tool", / / indicates the name of the extension component; "version": "1.0", / / indicates the version number of the current extension program; "description": "Synchronize cookies of platform 1 and platform 2 to the specified server", / / indicates the brief description information of the extension component; "permissions": [
[0086] [cookies", / / indicates the permission to access cookies; "storage" / / indicates the permission to access storage], "host_permissions": ["*: / / *.xaobao.com / *", / / indicates that all subdomain names of Xbao platform are allowed to be accessed; "*: / / *.zd.com / *", / / indicates that all subdomain names of Zdong are allowed to be accessed; "http: / / dc.piyi.domain / *" / / indicates that all paths of the specified server are allowed to be accessed], "background": { "service_worker": "background.js" / / indicates to define the background script for handling asynchronous tasks}, "content_scripts": [{"matches":
[0087] ["*: / / *.xaobao.com / *", "*: / / *.zd.com / *"], / / indicates to define the script injected into Xbao and Zdong pages; "js": ["content.js"] / / indicates to specify the script file to be injected}, "action": { "default_title": "Platform Cookie Synchronization Tool" / / indicates the default title of the browser toolbar button}.
[0088] Among them, the content script (content.js) is responsible for detecting the login status of the user in the preset platform, including automatically identifying the currently accessed preset platform, judging the login status according to the platform characteristic elements (such as page elements), triggering the cookie synchronization regularly and providing state feedback to the user.
[0089] For example, the content script includes (function () {function getCurrentPlatform () {const hostname = window.location.hostname; / / represents obtaining the hostname of the current page;if (hostname.includes ('xaobao.com')) {return 'xaobao'; / / represents returning 'xaobao' if the hostname includes 'xaobao.com'} else if (hostname.includes ('zd.com')) {return 'zd'; / / represents returning 'zd' if the hostname includes 'zd.com'} return 'xaobao'; / / represents returning 'xaobao' by default}function syncCookies () {const platform = getCurrentPlatform (); / / represents determining the current platform;updateStatus (`Checking ${platform === 'xaobao'? 'Xbao' : 'Zdong'} login status...`).
[0090] / / Example of chrome.runtime.sendMessage({ action: 'getCookies', platform: platform}, (response) => { if (chrome.runtime.lastError) { / / Indicates to check if there is an extension error; updateStatus('Sync failed: browser extension error', true); return;} if (response && response.status ==='success') { / / Indicates to check if the response is successful; updateStatus(response.message); setTimeout(() => { / / Indicates to hide the sync success message after three seconds; const statusDiv = document.getElementById('cookie-sync-status'); if (statusDiv) statusDiv.style.display = 'none';}, 3000);} else if (response) { / / For indicating if the response has error information, update the status and display; updateStatus(response.message || 'Unknown error', true);} else { updateStatus('Sync failed: no response received', true); / / Indicates to display an error message if there is no response;}});
[0091] Specifically, the background script (background.js) is responsible for handling the acquisition and synchronization of cookies, including selecting the corresponding domain list according to different platforms, using the Chrome (browser) Cookies API to obtain all cookies of the specified domain name, processing partitioned cookies, removing duplicates and formatting the cookie string, and sending the cookies to the specified backend server.
[0092] For example, the background script includes chrome.runtime.onMessage.addListener((request,sender,sendResponse) => {if(request.action==='getCookies'){ / / Indicates checking if the received message is a request to obtain cookies; let domainList=[]; / / Indicates initializing the domain list array; let platform=request.platform||"xaobao"; / / Indicates checking the platform attribute of the request, which defaults to "xaobao"; if(platform==="xaobao"){domainList=['xaobao.com', 'www.xaobao.com', 'm.xaobao.com']; / / Indicates specifying the corresponding domain if the platform is Xbao}else if(platform==="zd"){domainList=['zd.com','www.zd.com','m.zd.com','item.zd.com','login.zd.com']; / / Indicates that if the platform is JD.com, specify the corresponding domain name}(async()=>{ / / Indicates that an asynchronous operation is handled by a self-executing asynchronous function; try{const allCookies=[]; / / Indicates that an array is created to store all the cookies obtained; for(let domain of domainList){ / / Indicates that the domain list is traversed, / / Indicates that all cookies under the current domain are obtained.
[0093] Constcookies = await new Promise((resolve, reject) => {chrome.cookies.getAll({domain:domain}, (cookies) => {if (chrome.runtime.lastError) { / / Check if an error has occurred reject(chrome.runtime.lastError); / / If an error occurs, reject the Promise and throw an error message} else { resolve(cookies); / / If cookies are successfully retrieved, resolve the Promise}});}); allCookies.push(...cookies); / / Add the cookies retrieved from the current domain to the total Cookies array} / / Remove duplicate cookies; constiqueCookies = Array.from(new Map(allCookies.map(cookie => ...
[0094] [`${cookie.name}-${cookie.domain}-${cookie.path}`,cookie]) / / This means generating a Map using the cookie's name, domain, and path for deduplication. values()); / / This means formatting the deduplicated cookies as a string; const cookieString = uniqueCookies.map(cookie => `${cookie.name} = ${cookie.value}`).join(';'); / / This means sending the cookies to the server using the Fetch API; try { const response = await fetch('http: / / dc.qiyi.domain / uiMonitor / api / platformCookie', {method: 'POST', / / This means setting the request method to POST.
[0095] headers: { 'Content-Type': 'application / json' / / Indicates that the request body format is JSON}, body: JSON.stringify({ platform: platform, / / Indicates that it contains platform information (such as Xbao or Zdong); cookies: cookieString / / Indicates that it contains all Cookie strings})}) ; if (response.ok) { / / Indicates that the server response is successful; sendResponse ({ status:'success', message: `${platform === "xaobao"? "Xbao" : "Zdong"} Cookie synchronization success`}) ;} else { sendResponse ({ status: 'error', message: `Server response exception: ${response.status}`}) ;}} catch (fetchError) { / / Indicates that errors may occur during network request; sendResponse ({ status: 'error', message: `Network request failed: ${fetchError.message}`}) ;}} catch (error) { / / Indicates that errors may occur during Cookie acquisition; sendResponse ({ status: 'error', message: `Failed to obtain cookies: ${error.message}`}) ;}}) () ; return true; / / Return true to send the response asynchronously.
[0096] In this way, the platform login efficiency is improved, thereby improving the efficiency and success rate of data collection, providing a more reliable data source for data analysis and intelligent systems; reducing the maintenance cost of the data collection system, reducing manual intervention and maintenance work, and reducing operating costs; enhancing competitiveness by stably obtaining platform information to enhance market analysis and competitiveness; supporting the price monitoring system to provide stable data sources for the price monitoring system and help develop more competitive pricing strategies; improving user experience by simplifying user operation processes and improving user experience through automatic login and status synchronization.
[0097] In summary, the platform login method provided by the embodiments of the present disclosure acquires at least one candidate platform domain name corresponding to a preset platform domain name, calculates the domain name similarity between the preset platform domain name and the candidate platform domain name, when the domain name similarity is greater than or equal to a preset similarity threshold, takes the candidate platform domain name as an associated platform domain name corresponding to the preset platform domain name, and constructs a platform domain name association list; acquires a text file collected by an extension component based on a client browser; wherein the text file includes login information of a preset platform; based on the preset platform domain name of the preset platform and the platform domain name association list, acquires an associated platform domain name; based on the preset platform domain name, accesses the preset platform and logs in the preset platform according to the login information, when accessing an associated platform based on the associated platform domain name, the associated platform is in a login state; based on the associated platform domain name, accesses the associated platform and logs in the associated platform according to the login information, when accessing the preset platform based on the preset platform domain name, the preset platform is in a login state; after receiving update information of the text file, acquires an updated text file from local storage of the client or a target server, and shares the login state of the preset platform and the associated platform based on the updated text file. Thus, the platform domain name association list is constructed in advance, after accessing a corresponding platform based on any platform domain name and logging in the platform according to the login information of the text file, all platform domain names associated with the any platform domain name in the platform domain name association list are in a login state when accessing the corresponding platform, so that fewer login times can be initiated to complete the login of more platforms, the login state sharing between related platforms is realized, repeated login operations are reduced, and the platform login efficiency and the data collection efficiency are improved.
[0098] Corresponding to the foregoing platform login method, the embodiments of the present disclosure further provide a platform login device, Figure 4 A structural diagram of a platform login device provided by the embodiments of the present disclosure, the device can be realized by software and / or hardware, and is applied to a device for deploying a data collection system, and the device comprises:
[0099] The first acquisition module 402 is configured to acquire a text file collected by an extension component based on a client browser; wherein the text file includes login information of a preset platform;
[0100] The second acquisition module 404 is configured to acquire an associated platform domain name based on a preset platform domain name of the preset platform and a pre-stored platform domain name association list;
[0101] The login module 406 is configured to access the preset platform based on the preset platform domain name and log in the preset platform according to the login information, when accessing an associated platform based on the associated platform domain name, the associated platform is in a login state; or,
[0102] The login module 406 is further configured to access the associated platform based on the associated platform domain name and log in the associated platform according to the login information, and the preset platform is in a login state when the preset platform is accessed based on the preset platform domain name.
[0103] The device provided in the embodiments of the present disclosure has a platform domain name association list constructed in advance, and after logging in a platform based on any platform domain name and according to the login information of the text file, all platform domain names associated with the any platform domain name in the platform domain name association list are in a login state when accessing the corresponding platform, so that fewer login times can be initiated to complete login of more platforms, login state sharing between related platforms is achieved, repeated login operations are reduced, and platform login efficiency and data collection efficiency are improved.
[0104] In some embodiments, the device further includes: a third acquisition module configured to acquire at least one candidate platform domain name corresponding to the preset platform domain name; a calculation module configured to calculate a domain name similarity between the preset platform domain name and the candidate platform domain name; and a first construction module configured to, when the domain name similarity is greater than or equal to a preset similarity threshold, take the candidate platform domain name as an associated platform domain name corresponding to the preset platform domain name, and construct the platform domain name association list.
[0105] In some embodiments, the calculation module is specifically configured to: encode the preset platform domain name and the candidate platform domain name respectively to obtain a preset platform vector and a candidate platform vector; and calculate a cosine similarity between the preset platform vector and the candidate platform vector as the domain name similarity.
[0106] In some embodiments, the device further includes: a fourth acquisition module configured to acquire target entity information to which the preset platform domain name belongs, and acquire platform domain names corresponding to the target entity information; and a second construction module configured to take the platform domain names corresponding to the target entity information as the associated platform domain names corresponding to the preset platform domain name, and construct the platform domain name association list.
[0107] In some embodiments, the first acquisition module 402 is specifically configured to: acquire the text file based on local storage of the client or a target server; and when the text file cannot be acquired and / or abnormal information of the target server is acquired, display a prompt page in a preset form based on the extension component in the browser.
[0108] In some embodiments, the device further includes: a receiving module configured to acquire an updated text file from the local storage of the client or the target server after receiving update information of the text file; and an updating module configured to perform login state sharing for the preset platform and the associated platform based on the updated text file.
[0109] In some embodiments, the text file comprises an authorized time of the login information; the apparatus further comprises a fifth obtaining module for obtaining a current time and calculating a time interval between the current time and the authorized time; a sixth obtaining module for requesting a new text file from a local storage of the client or a target server when the time interval is less than or equal to a preset interval threshold.
[0110] The platform login apparatus provided by the embodiments of the present disclosure can perform the platform login method provided by any of the embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of performing the method.
[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the apparatus embodiments described above can refer to the corresponding process in the method embodiments, which will not be described here.
[0112] The embodiments of the present disclosure provide an electronic device, comprising: a storage device having a computer program stored thereon; a processing device configured to execute the computer program in the storage device to implement the steps of any method of the present disclosure.
[0113] Reference will be made to the following Figure 5 , which shows a structural schematic diagram of an electronic device 500 suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure can include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Multimedia Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, as well as fixed terminals such as digital TVs, desktop computers, and the like. Figure 5 The electronic device shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0114] As shown in Figure 5 , the electronic device 500 can include a processing device 501 (such as a central processor, a graphics processor, etc.) which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0115] In general, the following devices can be connected to the I / O interface 505: input devices 506, including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 507, including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; storage devices 508, including, for example, a magnetic tape, a hard disk, and the like; and communication devices 509. The communication devices 509 can allow the electronic device 500 to communicate wirelessly or wired with other devices to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it is understood that not all of the shown devices are required to be implemented or present. More or fewer devices can alternatively be implemented or present.
[0116] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 509, or installed from the storage devices 508, or installed from the ROM 502. When the computer program is executed by the processing devices 501, the above-mentioned functions defined in the methods of embodiments of the present disclosure are performed.
[0117] In addition to the above-mentioned methods and devices, embodiments of the present disclosure can also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the image processing method provided by embodiments of the present disclosure. The computer program product can be written in any combination of one or more programming languages to perform the operations of embodiments of the present disclosure, including an object-oriented programming language, such as Java, C++, and the like, and a conventional procedural programming language, such as the "C" language or similar programming languages. The program code can be executed entirely on a user computing device, partially on a user device, as a standalone software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0118] In addition, embodiments of the present disclosure can also be a computer-readable storage medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform the platform login method provided by embodiments of the present disclosure.
[0119] The computer readable storage medium can take the form of one or more combinations of any type of computer readable media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] The embodiments of the present disclosure further provide a computer program product, comprising computer programs / instructions, which, when executed by a processor, implement the platform login method in the embodiments of the present disclosure.
[0121] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the use range, the use scenario, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0122] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will need to obtain and use the personal information of the user. Thus, the user can autonomously select whether to provide the personal information to the software or hardware such as the electronic device, the application program, the server or the storage medium, etc. that performs the operation of the technical solutions of the present disclosure according to the prompt information.
[0123] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending the prompt information to the user can be, for example, the manner of a pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to select “agree” or “disagree” to provide the personal information to the electronic device.
[0124] It can be understood that the above notification and obtaining of the authorization of the user are only illustrative, and do not limit the implementation manners of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation manners of the present disclosure.
[0125] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0126] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A platform login method, characterized in that, The method, applied to a device for deploying a data acquisition system, includes: Obtain a text file collected by an extension component of a client browser; wherein the text file includes login information for a preset platform; Based on the preset platform domain name and the pre-stored platform domain name association list, obtain the associated platform domain name; Accessing the preset platform based on the preset platform domain name and logging into the preset platform according to the login information, wherein the associated platform is logged in when accessing the associated platform based on the associated platform domain name; or... Access the associated platform based on the associated platform domain name and log in to the associated platform according to the login information. When accessing the preset platform based on the preset platform domain name, the preset platform is in a logged-in state.
2. The method according to claim 1, characterized in that, The method further includes: Obtain at least one candidate platform domain name corresponding to the preset platform domain name; Calculate the domain similarity between the preset platform domain name and the candidate platform domain name; When the domain name similarity is greater than or equal to a preset similarity threshold, the candidate platform domain name is used as the associated platform domain name corresponding to the preset platform domain name, and the platform domain name association list is constructed.
3. The method according to claim 2, characterized in that, The calculation of the domain name similarity between the preset platform domain name and the candidate platform domain name includes: The preset platform domain name and the candidate platform domain name are encoded respectively to obtain the preset platform vector and the candidate platform vector; The cosine similarity between the preset platform vector and the candidate platform vector is calculated as the domain name similarity.
4. The method according to claim 1, characterized in that, The method further includes: Obtain the target entity information to which the preset platform domain name belongs, and obtain the platform domain name corresponding to the target entity information; The platform domain name corresponding to the target entity information is used as the associated platform domain name corresponding to the preset platform domain name, and the platform domain name association list is constructed.
5. The method according to claim 1, characterized in that, The acquisition of text files collected by the client browser's extension component includes: The text file is obtained from the client's local storage or the target server; If the text file cannot be obtained and / or abnormal information of the target server is not obtained, a prompt page is displayed in the browser in a preset format based on the extended component.
6. The method according to claim 1, characterized in that, The method further includes: After receiving the update information of the text file, the updated text file is retrieved from the client's local storage or the target server; Login status is shared between the preset platform and the associated platform based on the updated text file.
7. The method according to claim 1, characterized in that, The text file includes the authorization time of the login information; the method further includes: Obtain the current time and calculate the time interval between the current time and the authorized time; When the time interval is less than or equal to a preset interval threshold, a new text file is requested from the client's local storage or the target server.
8. A platform login device, characterized in that, An apparatus for deploying a data acquisition system, the apparatus comprising: The first acquisition module is used to acquire a text file collected by an extension component of a client browser; wherein the text file includes login information of a preset platform; The second acquisition module is used to acquire associated platform domains based on the preset platform domains and the pre-stored platform domain association list of the preset platform; The login module is used to access the preset platform based on the preset platform domain name and log in to the preset platform according to the login information. When accessing the associated platform based on the associated platform domain name, the associated platform is in a logged-in state; or, The login module is also used to access the associated platform based on the associated platform domain name and log in to the associated platform according to the login information. When accessing the preset platform based on the preset platform domain name, the preset platform is in a logged-in state.
9. An electronic device, characterized in that, The electronic device includes: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the platform login method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the platform login method according to any one of claims 1-7.