CN108830268A - Content acquisition method, device, terminal and storage medium - Google Patents

Content acquisition method, device, terminal and storage medium Download PDF

Info

Publication number
CN108830268A
CN108830268A CN201810525031.7A CN201810525031A CN108830268A CN 108830268 A CN108830268 A CN 108830268A CN 201810525031 A CN201810525031 A CN 201810525031A CN 108830268 A CN108830268 A CN 108830268A
Authority
CN
China
Prior art keywords
content
callback interface
object content
dynamic proxy
party
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810525031.7A
Other languages
Chinese (zh)
Inventor
常群
龙海
余丽芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201810525031.7A priority Critical patent/CN108830268A/en
Publication of CN108830268A publication Critical patent/CN108830268A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the present disclosure provides a kind of content acquisition method, device, terminal and storage medium, is related to field of computer technology, this method includes:Reception content obtains signal;Determine content callback interface corresponding with object content;According to content callback interface, dynamic proxy object is set;When object content is called by the operating systems, object content is intercepted and captured by dynamic proxy object.It is extracted in destination application after obtaining object content, since the object content can be invoked into content callback interface, the disclosure passes through setting dynamic proxy object, object content needs to be forwarded to content callback interface by dynamic proxy object, also object content can be intercepted and captured by dynamic proxy object, the problem of identifying that caused calculation amount is excessive due to OCR, weaken system performance is avoided, while also avoiding OCR identification and there is a problem of identification mistake.

Description

Content acquisition method, device, terminal and storage medium
Technical field
This disclosure relates to field of computer technology, in particular to a kind of content acquisition method, device, terminal and storage are situated between Matter.
Background technique
During using mobile terminal, it usually needs obtained the word content in user interface to realize it His function, since in third party's browser for installing on mobile phone, the interface for obtaining the word content in webpage is not opened, eventually Hold operating system that can not obtain the word content of webpage by the interface of the word content in the acquisition webpage.
In the related technology by carrying out OCR (Optical Character for user interface as image Recognition, optical character identification) mode, obtain the word content in user interface.
Summary of the invention
The embodiment of the present disclosure provides a kind of content of text acquisition methods, device, terminal and storage medium, can solve logical It crosses OCR identification to know otherwise the word content in user interface, the treating capacity of data is larger, influences the performance of system And the problem of OCR identification mistake is not can avoid.The technical solution is as follows:
According to the disclosure in a first aspect, provide a kind of content acquisition method, applied in the operating system of terminal, institute The method of stating includes:
Reception content obtains signal, the content obtain signal be used for the target text content in destination application into Row obtains;
Determine content callback interface corresponding with the object content, the content callback interface is for answering the target It is called with the object content in program;
Dynamic proxy object is set according to the content callback interface, the dynamic proxy object is for answering the target The content callback interface is forwarded to the object content being called in program;
When the object content is called by the operating system, intercepted and captured in the target by the dynamic proxy object Hold.
In an alternative embodiment, described when the object content is called by the operating system, by described Dynamic proxy object intercepts and captures the object content, including:
Determine that content corresponding with the object content shows control, the content display control in the destination application Part is for showing the object content;
Show that control extracts the object content by the content;
The object content is passed through into the dynamic proxy object reference to the content callback interface, the dynamic proxy Object is for intercepting and capturing the object content in calling process.
In an alternative embodiment, the destination application is third party's browser application;
It is described to show that control extracts the object content by the content, including:
Show that control extracts the mesh from the content by third party's kernel of third party's browser application Mark content.
In an alternative embodiment, the object content is the content in target webpage;
Third party's kernel by third party's browser application shows that control extracts according to the content The object content, including:
Reflection calls the content to show the corresponding script execution of control, injects contents extraction to the target webpage Script, the contents extraction script is for extracting the object content;
The contents extraction script is executed by third party's kernel, extraction obtains the object content.
In an alternative embodiment, determination content callback interface corresponding with object content, including:
The corresponding content callback interface of the object content is hooked up by Hook Technique.
According to the second aspect of the disclosure, a kind of content acquisition unit is provided, applied in the operating system of terminal, institute Stating device includes:
Receiving module is configured as reception content and obtains signal, and the content obtains signal and is configured as to target application Object content in program is obtained;
Determining module is configured to determine that content callback interface corresponding with the object content, the content readjustment connect Mouth is configured as being called the object content in the destination application;
Setup module is configured as that dynamic proxy object, the dynamic proxy pair is arranged according to the content callback interface As being configured as the object content being called in the destination application being forwarded to the content callback interface;
Interception module is configured as passing through the dynamic proxy when the object content is called by the operating system Object intercepts and captures the object content.
In an alternative embodiment, the interception module, including:
It determines submodule, is configured to determine that in the destination application that content corresponding with the object content is shown Control, the content show that control is configured as showing the object content;
Extracting sub-module is configured as showing that control extracts the object content by the content;
Submodule is called, is configured as returning the object content by the dynamic proxy object reference to the content Interface is adjusted, the dynamic proxy object is configured as in calling process intercepting and capturing the object content.
In an alternative embodiment, the destination application is third party's browser application;
The extracting sub-module is additionally configured to through third party's kernel of third party's browser application from institute It states content and shows that control extracts the object content.
In an alternative embodiment, the object content is the content in target webpage;
The extracting sub-module is additionally configured to reflection and the content is called to show the corresponding script execution device of control, Contents extraction script is injected to the target webpage, the contents extraction script is configured as mentioning the object content It takes;
The extracting sub-module is additionally configured to execute the contents extraction script by third party's kernel, extract Obtain the object content.
In an alternative embodiment, the determining module is additionally configured to through Hook Technique in the target Hold corresponding content callback interface to be hooked up.
According to the third aspect of the disclosure, a kind of terminal is provided, the terminal includes processor and memory, described to deposit At least one instruction is stored in reservoir, described instruction is loaded by the processor and executed to realize that the above-mentioned disclosure such as is implemented Any method for extracting content in the first aspect and its alternative embodiment of example.
According to the fourth aspect of the disclosure, a kind of computer readable storage medium is provided, is stored in the storage medium Have at least one instruction, described instruction loaded by processor and executed with realize as the above-mentioned embodiment of the present disclosure first aspect and Any method for extracting content in its alternative embodiment.
The beneficial effect for the technical solution that the embodiment of the present disclosure provides includes at least:
It extracts in destination application after obtaining object content, is connect since the object content can be invoked into content readjustment Mouthful, by the way that dynamic proxy object is arranged, object content needs to be forwarded to content callback interface by dynamic proxy object, also To be intercepted and captured by dynamic proxy object to object content, avoids since OCR identifies that caused calculation amount is excessive, weaken system The problem of performance of uniting, while also avoiding OCR identification and there is a problem of identification mistake.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure Example, and consistent with the instructions for explaining the principles of this disclosure.
Fig. 1 is the structural block diagram for the terminal that one exemplary embodiment of the disclosure provides;
Fig. 2 is the flow chart for the content of text acquisition methods that one exemplary embodiment of the disclosure provides;
Fig. 3 is the flow chart for the content of text acquisition methods that another exemplary embodiment of the disclosure provides;
Fig. 4 is the flow chart for the content of text acquisition methods that another exemplary embodiment of the disclosure provides;
Fig. 5 is the structural block diagram for the content of text acquisition device that one exemplary embodiment of the disclosure provides;
Fig. 6 is the structural block diagram for the terminal that one exemplary embodiment of the disclosure provides.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
During using mobile terminal, it usually needs obtained the content of text in user interface to realize it His function, such as:It obtains the content of text in user interface and content of text is searched for automatically, or obtain in user interface Content of text, and to content of text carry out participle operation obtain multiple independent vocabulary, user can be to multiple independent Vocabulary such as is replicated, is searched for, being translated at the operation.Schematically, the word segment in user to user interface carries out long press operation, Operating system obtains the content of text of the word segment in the user interface according to the long press operation first, then in the text Hold and carries out word segmentation processing.
Operating system is shown in what terminal carried when obtaining to the content of text in user interface, with content of text For in browser application, operating system can be by the port that the kernel of the browser application provides in webpage Content of text is obtained.However, user would generally install at the terminal third party's browser carry out using, and third party browse Third party's kernel of device can't usually open the interface for actively obtaining the content of text in webpage, i.e., the operating system of terminal without Method obtains the content of text in the webpage shown in third party's browser application in such a way that active is called, also can not be right Content of text in webpage carries out further operating.
Firstly, noun involved in the disclosure is introduced:
Content callback interface:Refer to the interface to be called in application program to content of text or picture material.It is optional Ground, the content callback interface are usually callback interface corresponding with the kernel of application program, such as:Third party's browser application Third party's kernel be corresponding with a callback interface as the content callback interface.Optionally, which can be with The content or interface of other forms are called, such as:Audio is called, interface is called.Optionally, it answers It can internally be held by the content callback interface with program or interface carries out intrinsic call, can also adjusted back and be connect by the content Mouth carries out external call between application program and the operating system for being equipped with the application program.Optionally, when the application program Kernel when not opening the interface obtained to content of text, operating system can not be by way of calling directly in text Appearance is obtained, but content of text actively can be sent to operating system by content callback interface by the kernel of application program.
Dynamic proxy object:Refer to and the content being called in application program is carried out acting on behalf of received object, schematically, After the corresponding content callback interface setting dynamic proxy object of kernel of application program A, when in the text in application program A When appearance is called as parameter, it is sent to dynamic proxy object, the content of text that dynamic proxy object can will receive first It retransmits to content callback interface.
Reflection is called:It is the mechanism of dynamic acquisition information and dynamic call method in a kind of Java language that reflection, which is called, The reflection call-by mechanism refers to that application program in operating status, for any one class, can obtain the attribute of this class And method can call the method and attribute of this object for any one object.
Fig. 1 is the structural block diagram for the terminal 100 that one exemplary embodiment of the disclosure provides, as shown in Figure 1, the terminal 100 include:Processor 11, memory 12, communication component 13 and display screen 14;
Processor 11 includes one or more processing core.
Memory 12 is configured as executing the journey in memory 12 for storing program instruction and/or data, processor 11 Sequence instruction, to realize various function application and data processing.Optionally, the program instruction stored in memory 12 is performed When the content of text acquisition methods that are provided for realizing each embodiment of the disclosure in the step of being executed by server.Memory 12 May include high-speed random access memory, can also include nonvolatile memory, a for example, at least disk memory, Flush memory device or other volatile solid-state parts.
For communication component 13 for realizing the communication function of terminal 100, communication component 13 can be wireless communication components, such as RF (Radio Frequency, radio frequency) circuit, Mobile Communication Chip, WiFi communication chip;Communication component 13 can also be wired Communication component, for example, optical fiber interface, RJ45 network interface card and interface etc..
Display screen 14 is for showing user interface and receiving externally input touch operation.Optionally, display screen 14 is touching Screen is touched, which can collect the touch operation of user on it or nearby.Optionally, touch screen is to support suspension touch control Touch screen, and/or, the touch screen of support pressure touch-control.
Optionally, it is stored with operating system 120 in memory 12, includes inner nuclear layer 140 and application layer in the operating system 160.Application layer 160 is located on inner nuclear layer 140, and application layer 160 includes at least one application program, and is wrapped in application layer 160 Native applications program included when terminal factory is included, also may include be downloaded that the third party manufacturer of installation provides the later period the Tripartite's application program.Schematically, application layer 160 includes:Application program A and application program B, wherein application program A includes interior Core a, application program B include kernel b, and kernel a is also known as the rendering engine of application program A, and kernel b is also known as application program B's Rendering engine.Optionally, application program includes but is not limited to:Browser, instant messaging class application program, news category application journey At least one of sequence, navigation type application program, comment class application program, social category application program, blog class application program.
Above structure is only to schematically illustrate to terminal, and those skilled in the art could be aware that, terminal can also include Components more more or fewer than above-mentioned signal, for example, terminal can also include loudspeaker, microphone, input/output (I/O) group Part, power supply etc..
Fig. 2 is the content of text acquisition methods flow chart that one exemplary embodiment of the disclosure provides, as shown in Fig. 2, with Text content acquisition method is applied to be illustrated in operating system 120 as shown in Figure 1, the content acquisition method packet It includes:
Step 201, reception content obtains signal.
The content obtains signal for obtaining to the object content in destination application.
Optionally, which, which obtains signal, can be user by carrying out operation generation to terminal, be also possible to operate System is generated according to pre-set timer, and the generating mode for obtaining signal to content in the embodiment of the present disclosure does not limit It is fixed.
Optionally, user can carry out long press operation in the user interface of the terminal and generate content acquisition signal, work as terminal Display screen be pressure touch display screen when, user can also carry out in the user interface pressure touch generate content obtain letter Number;When the terminal is desktop computer, portable lap-top laptop, user can be by the input of external equipment generation Hold and obtain signal, such as:User can generate content keyboard in a manner of inputting shortcut key and obtain signal.
Step 202, content callback interface corresponding with object content is determined.
Optionally, the content callback interface is for being called the object content in destination application.Optionally, should And the corresponding content callback interface of object content is content callback interface corresponding with the kernel of above-mentioned destination application.It can Selection of land, when being installed in terminal there are two the corresponding kernel of application program is the same kernel, which can be right The same content callback interface is answered, a content callback interface can also be respectively corresponded.Schematically, with browser application For be illustrated, the corresponding kernel of browser application A be kernel a, the corresponding kernel of browser application B be kernel The corresponding kernel of b, browser application C is kernel a, then kernel a corresponding content callback interface 1, kernel b corresponding content readjustment Interface 2, then, when object content is the content shown in application program A or application program C, corresponding content callback interface For content callback interface 1, when object content is the content shown in application program B, corresponding content callback interface is content Callback interface 2.
Step 203, dynamic proxy object is arranged according to content callback interface.
Optionally, which is used to for the object content being called in destination application to be forwarded to content and return Adjust interface.
Optionally, the dynamic proxy object be terminal operating system for the content callback interface setting for realizing The object of dynamic proxy.
Optionally, which is that the operating system of terminal is used to adjust according to what the content callback interface was arranged With the object for intercepting and capturing object content in the process.
Step 204, when object content is called by the operating systems, object content is intercepted and captured by dynamic proxy object.
Optionally, the acquisition signal in above-mentioned steps 201 may be considered the request that user obtains object content, When the object content is sent to content callback interface, object content is intercepted and captured by dynamic proxy object.
Optionally, when the kernel of destination application does not support external call object content, i.e. operating system can not pass through When the mode of invocation target content actively obtains object content, object content is intercepted and captured by dynamic proxy object, i.e., it is logical Dynamic proxy object is crossed, the object content is obtained in a manner of indirect gain.
In conclusion content acquisition method provided in this embodiment, by the way that dynamic proxy object is arranged, object content needs It is forwarded to content callback interface by dynamic proxy object, object content can also be cut by dynamic proxy object It obtains, avoids the problem of identifying that caused calculation amount is excessive due to OCR, weaken system performance, while also avoiding OCR identification and depositing In the problem of identification mistake.
In an alternative embodiment, operating system 120 shown in FIG. 1 is during obtaining target text content, Show that control extracts target text content firstly the need of by the corresponding content of text of the target text content, such as Fig. 3 Shown, Fig. 3 is the content of text acquisition methods flow chart that another exemplary embodiment of the disclosure provides, and is obtained with text content Method is taken to be applied in operating system 120 as shown in Figure 1, using object content as target text content, content obtains signal and is Text is illustrated for obtaining signal, and text content acquisition method includes:
Step 301, it receives text and obtains signal.
The text obtains signal for obtaining to the target text content in destination application.
Optionally, the text, which obtains signal, can be user by carrying out operation generation to terminal, be also possible to operate System is generated according to pre-set timer, and the generating mode for obtaining signal to text in the embodiment of the present disclosure does not limit It is fixed.
Schematically, when it is that user is generated by carrying out operation to terminal that text, which obtains signal, user is in user interface In to the corresponding region of target text content carry out long-pressing selection operation, thus generate text obtain signal.
Step 302, content callback interface corresponding with target text content is determined.
Optionally, the content callback interface is for being called the target text content in destination application.It is optional Ground, should and the corresponding content callback interface of target text content be that content corresponding with the kernel of above-mentioned destination application is returned Adjust interface.
Step 303, dynamic proxy object is arranged according to content callback interface.
Optionally, in which is used to for the target text content being called in destination application being forwarded to Hold callback interface.
Optionally, the dynamic proxy object be terminal operating system for the content callback interface setting for realizing The object of dynamic proxy.
Optionally, which is that the operating system of terminal is used to adjust according to what the content callback interface was arranged With the object for intercepting and capturing target text content in the process.
Step 304, determine that content of text corresponding with target text content shows control in destination application.
Optionally, text content shows that control is used for displaying target content of text.Schematically, when target text content When for content of text in webpage, text content shows that control is the web displaying control (English in browser: webview).Schematically, the webview control is determined in destination application.
It is worth noting that, the destination application can be clear when target text content is the content of text in webpage It lookes at device application program, is also possible to other application programs that can open webpage.
Step 305, show that control extracts target text content by content of text.
Optionally, operating system can be by directly requesting to the kernel sending information contents extraction of the destination application Mode target text content is extracted, can also reflection call by way of target text content is extracted.
It is worth noting that, after having executed above-mentioned steps 301, step 302 to step 303 and step 304 to step 305 It may be performed simultaneously, step 302 can also be first carried out and execute step 304 again to step 303 to step 305, can also be first carried out Step 304 executes step 302 to step 305 to step 303 again, wherein step 302 to step 303 be also possible to before from What content of text had been executed and continuously carried out during showing control acquisition content of text, i.e., the dynamic proxy object has been arranged It crosses, and persistently exists.
Step 306, target text content is passed through into dynamic proxy object reference to content callback interface.
Optionally, the dynamic proxy object is for intercepting and capturing target text content in calling process.
Optionally, after the kernel of destination application extracts to obtain the target text content, by the target text content Content callback interface is sent to be called.
Schematically, it when needing target text content active transmission to operating system, is then connect by content readjustment Mouthful by the target text content active transmission to operating system;When need to the target text content in destination application into When row intrinsic call, then intrinsic call is carried out to the target text content by the content callback interface;When operating system passes through When the mode that reflection is called is extracted to obtain target text content from kernel, then pass through content callback interface for the target text content It is back to operating system, that is, no matter which kind of calls situation, which requires to be adjusted by content callback interface With.
And it needs since target text content is sent to content callback interface through dynamic proxy object, i.e. the dynamic proxy Object can first intercept and capture target text content during calling, then the target text content is forwarded to content tune With interface, and the target text content is sent to operating system after intercepting and capturing the target text content by dynamic proxy object.
It is worth noting that, above content, which can also substitute, is embodied as picture material, audio content, video content etc..
In conclusion content of text acquisition methods provided in this embodiment, by the way that dynamic proxy object, target text is arranged Content needs to be forwarded to content callback interface by dynamic proxy object, also can be by dynamic proxy object to target text Content is intercepted and captured, and avoids the problem of being identified that caused calculation amount is excessive due to OCR, weakened system performance, while also avoiding OCR identification has that identification is wrong.
In an alternative embodiment, which is third party's browser application, and the third party is clear Device application program of looking at is corresponding with third party's kernel, as shown in figure 4, Fig. 4 is the text that another exemplary embodiment of the disclosure provides This content acquisition method flow chart is applied in operating system 120 as shown in Figure 1, with mesh with text content acquisition method Mark content is target text content, and it is to be illustrated for text obtains signal that content, which obtains signal, text content acquisition side Method includes:
Step 401, it receives text and obtains signal.
The text obtains signal for obtaining to the target text content in third party's browser application.It is optional Ground, the content in webpage which can show in third party's browser application.
It is worth noting that, third party's browser application can be third party's browser, it is also possible to third party It can be realized the application program of browser function.Such as:Some instant messaging application program can be realized browser function to webpage It is browsed, then the instant messaging application program is also third party's browser application.
Optionally, the text, which obtains signal, can be user by carrying out operation generation to terminal, be also possible to operate System is generated according to pre-set timer, and the generating mode for obtaining signal to text in the embodiment of the present disclosure does not limit It is fixed.
Step 402, the corresponding content callback interface of target text content is hooked up by Hook Technique.
Optionally, the Hook Technique (English:Hook) it is a kind of pair of interface or mechanism that method is hooked up.It is optional Ground, the hook be in the nature function calling, the corresponding content callback interface of the target text content can be hooked up by hook.
Optionally, the content callback interface is for being called the target text content in destination application.It is optional Ground, should and the corresponding content callback interface of target text content be that content corresponding with the kernel of above-mentioned destination application is returned Adjust interface.
Step 403, dynamic proxy object is arranged according to content callback interface.
Optionally, in which is used to for the target text content being called in destination application being forwarded to Hold callback interface.
Optionally, the dynamic proxy object be terminal operating system for the content callback interface setting for realizing The object of dynamic proxy.
Optionally, which is that the operating system of terminal is used to adjust according to what the content callback interface was arranged With the object for intercepting and capturing target text content in the process.
Optionally, when should be by dynamic proxy mode hook above content callback interface, the available dynamic proxy Object.Schematically, by dynamic proxy mode hook content callback interface onReceiveValue (), dynamic proxy is obtained Object is mProxySubject.
Step 404, determine that content of text corresponding with target text content shows control in destination application.
Optionally, text content shows that control is used for displaying target content of text.Schematically, when target text content When for content of text in webpage, text content shows that control is the web displaying control (English in browser: webview).Schematically, the webview control is determined in destination application.
It is worth noting that, the destination application can be clear when target text content is the content of text in webpage It lookes at device application program, is also possible to other application programs that can open webpage.
Step 405, show that control extracts according to content of text by third party's kernel of third party's browser application Target text content.
Optionally, operating system can be by directly requesting to the kernel sending information contents extraction of the destination application Mode target text content is extracted, can also reflection call by way of target text content is extracted.
By target text content is extracted by way of reflecting calling and target text content be target webpage In content of text for be illustrated, schematically, operating system reflect invocation target webpage in content of text show control The corresponding script execution of part (English:EvaluateJavaScript) method extracts script to target webpage injection content of text, Wherein, text contents extraction script is for extracting target text content;It is executed in the text by third party's kernel Hold and extract script, extraction obtains target text content.
Schematically, above-mentioned steps 405 are illustrated in conjunction with specific code, obtain the target text content pair first The webview control answered, reflection call the evaluateJavaScript method of the webview control to inject text to target webpage This contents extraction script, the content for script of text contents extraction script are " document.body.innerText ", wherein Document indicates that document, body indicate the main part of webview control, and innerText indicates the text in webview control This content, i.e. text contents extraction script represenation extract the content of text in the webview control, text contents extraction foot Originally after being injected into target webpage, verification text contents extraction script is executed in third party, and extracts and obtain in text Hold, the content of text extracted can be back to callback interface by the interface call-back manner of third party's kernel OnReceiveValue (), the code being called to the target text content are " mMethodEvaluateJavascript.invoke (webview, new Object [] script, mProxySubject});" wherein, mMethodEvaluateJavascript is to reflect to obtain EvaluateJavascript method Method object, mProxySubject are the dynamic proxy pair of returned content callback interface As invoke is to call, and new Object [] is the parameter in calling.
Step 406, target text content is passed through into dynamic proxy object reference to content callback interface.
Optionally, the dynamic proxy object is for intercepting and capturing target text content in calling process.
Optionally, after the kernel of destination application extracts to obtain the target text content, by the target text content Content callback interface is sent to be called.
Schematically, it when needing target text content active transmission to operating system, is then connect by content readjustment Mouthful by the target text content active transmission to operating system;When need to the target text content in destination application into When row intrinsic call, then intrinsic call is carried out to the target text content by the content callback interface;When operating system passes through When the mode that reflection is called is extracted to obtain target text content from kernel, then pass through content callback interface for the target text content It is back to operating system, that is, no matter which kind of calls situation, which requires to be adjusted by content callback interface With.
And it needs since target text content is sent to content callback interface through dynamic proxy object, i.e. the dynamic proxy Object can first intercept and capture target text content during calling, then the target text content is forwarded to content tune With interface, and the target text content is sent to operating system after intercepting and capturing the target text content by dynamic proxy object.
Optionally, after operating system obtains the target text content, which can further be grasped Make, such as:The target text content is scanned for, participle operation etc. is carried out by default participle rule to the target text content.
It is worth noting that, above content, which can also substitute, is embodied as picture material, audio content, video content etc..
In conclusion content acquisition method provided in this embodiment, by the way that dynamic proxy object, target text content is arranged It needs to be forwarded to content callback interface by dynamic proxy object, it also can be by dynamic proxy object to target text content It is intercepted and captured, avoids the problem of identifying that caused calculation amount is excessive due to OCR, weaken system performance, while also avoiding OCR There is identification mistake in identification.
Content acquisition method provided in this embodiment extracts target text content in such a way that reflection is called, I.e. no matter whether the target text content is hidden in destination application, can be extracted to obtain, avoid by Cause target text content not extractible in the not open interface for extracting target text content of the kernel of destination application Problem.
Fig. 5 is the content acquisition unit that one exemplary embodiment of the disclosure provides, applied in the operating system of terminal, The device includes:Receiving module 51, determining module 52, setup module 53 and interception module 54;
Receiving module 51 is configured as reception content and obtains signal, and the content obtains signal and is configured as answering target It is obtained with the object content in program;
Determining module 52 is configured to determine that content callback interface corresponding with the object content, the content readjustment Interface is configured as being called the object content in the destination application;
Setup module 53 is configured as that dynamic proxy object, the dynamic proxy is arranged according to the content callback interface Object is configured as the object content being called in the destination application being forwarded to the content callback interface;
Interception module 54 is configured as passing through the dynamic generation when the object content is called by the operating system It manages object and intercepts and captures the object content.
In an alternative embodiment, the interception module 54, including:
It determines submodule, is configured to determine that in the destination application that content corresponding with the object content is shown Control, the content show that control is configured as showing the object content;
Extracting sub-module is configured as showing that control extracts the object content by the content;
Submodule is called, is configured as returning the object content by the dynamic proxy object reference to the content Interface is adjusted, the dynamic proxy object is configured as in calling process intercepting and capturing the object content.
In an alternative embodiment, the destination application is third party's browser application;
The extracting sub-module is additionally configured to through third party's kernel of third party's browser application from institute It states content and shows that control extracts the object content.
In an alternative embodiment, the object content is the content in target webpage;
The extracting sub-module is additionally configured to reflection and the content is called to show the corresponding script execution device of control, Contents extraction script is injected to the target webpage, the contents extraction script is configured as mentioning the object content It takes;
The extracting sub-module is additionally configured to execute the contents extraction script by third party's kernel, extract Obtain the object content.
In an alternative embodiment, the determining module 52, is additionally configured to through Hook Technique to the target The corresponding content callback interface of content is hooked up
Fig. 6 is a kind of structural block diagram of the terminal shown according to another exemplary embodiment.For example, the terminal 600 can be with It is at least one of mobile phone, tablet computer, desktop computer, above-knee laptop.
Referring to Fig. 6, which may include following one or more components:Processing component 602, memory 604, electricity Source component 606, multimedia component 608, audio component 610, the interface 612 of input/output (I/O), sensor module 614, with And communication component 616.
The integrated operation of the usual controlling terminal 600 of processing component 602, such as with display, telephone call, data communication, phase Machine operation and record operate associated operation.Processing component 602 may include that one or more processors 618 refer to execute It enables, to perform all or part of the steps of the methods described above.In addition, processing component 602 may include one or more modules, just Interaction between processing component 602 and other assemblies.For example, processing component 602 may include multi-media module, it is more to facilitate Interaction between media component 608 and processing component 602.
Memory 604 is configured as storing operation of various types of data to support the terminal 600.These data are shown Example includes the instruction of any application or method for operating in terminal 600, contact data, and telephone book data disappears Breath, picture, video etc..Memory 604 can be by any kind of volatibility or non-volatile memory device or their group It closes and realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash Device, disk or CD.
Power supply module 606 provides electric power for the various assemblies of terminal 600.Power supply module 606 may include power management system System, one or more power supplys and other with for terminal 600 generate, manage, and distribute the associated component of electric power.
Multimedia component 608 includes the screen of one output interface of offer between the terminal 600 and user.One In a little embodiments, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen Curtain may be implemented as touch screen, to receive input signal from the user.Touch panel includes one or more touch sensings Device is to sense the gesture on touch, slide, and touch panel.The touch sensor can not only sense touch or sliding action Boundary, but also detect duration and pressure associated with the touch or slide operation.In some embodiments, more matchmakers Body component 608 includes a front camera and/or rear camera.When terminal 600 is in operation mode, such as screening-mode or When video mode, front camera and/or rear camera can receive external multi-medium data.Each front camera and Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio component 610 is configured as output and/or input audio signal.For example, audio component 610 includes a Mike Wind (MIC), when terminal 600 is in operation mode, when such as call mode, recording mode, and voice recognition mode, microphone is matched It is set to reception external audio signal.The received audio signal can be further stored in memory 604 or via communication set Part 616 is sent.In some embodiments, audio component 610 further includes a loudspeaker, is used for output audio signal.
I/O interface 412 provides interface between processing component 602 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include, but are not limited to:Home button, volume button, start button and lock Determine button.
Sensor module 614 includes one or more sensors, and the state for providing various aspects for terminal 600 is commented Estimate.For example, sensor module 614 can detecte the state that opens/closes of terminal 600, and the relative positioning of component, for example, it is described Component is the display and keypad of terminal 600, and sensor module 614 can also detect 600 1 components of terminal 600 or terminal Position change, the existence or non-existence that user contacts with terminal 600,600 orientation of terminal or acceleration/deceleration and terminal 600 Temperature change.Sensor module 614 may include proximity sensor, be configured to detect without any physical contact Presence of nearby objects.Sensor module 614 can also include optical sensor, such as CMOS or ccd image sensor, at As being used in application.In some embodiments, which can also include acceleration transducer, gyro sensors Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 616 is configured to facilitate the communication of wired or wireless way between terminal 600 and other equipment.Terminal 600 can access the wireless network based on communication standard, such as Wi-Fi, 2G, 3G or 4G or their combination.It is exemplary at one In embodiment, communication component 616 receives broadcast singal or broadcast correlation from external broadcasting management system via broadcast channel Information.In one exemplary embodiment, the communication component 616 further includes near-field communication (NFC) module, to promote short distance logical Letter.For example, radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) can be based in NFC module Technology, bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, terminal 600 can be believed by one or more application specific integrated circuit (ASIC), number Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instruction, example are additionally provided It such as include the memory 604 of instruction, above-metioned instruction can be executed by the processor 618 of terminal 600 to complete the above method.For example, The non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk With optical data storage devices etc..
A kind of non-transitorycomputer readable storage medium, when the instruction in the storage medium is by the processing of terminal 600 When device executes, so that terminal 600 is able to carry out the above method.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure Its embodiment.The disclosure is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Person's adaptive change follows the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure Or conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by following Claim is pointed out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the accompanying claims.

Claims (12)

1. a kind of content acquisition method, which is characterized in that applied in the operating system of terminal, the method includes:
Reception content obtains signal, and the content obtains signal for obtaining to the object content in destination application;
Determine that content callback interface corresponding with the object content, the content callback interface are used for the target application journey The object content in sequence is called;
Dynamic proxy object is set according to the content callback interface, the dynamic proxy object is used for the target application journey The object content being called in sequence is forwarded to the content callback interface;
When the object content is called by the operating system, the object content is intercepted and captured by the dynamic proxy object.
2. the method according to claim 1, wherein described when the object content is called by the operating system When, the object content is intercepted and captured by the dynamic proxy object, including:
Determine that content corresponding with the object content shows control in the destination application, the content shows that control is used In the display object content;
Show that control extracts the object content by the content;
The object content is passed through into the dynamic proxy object reference to the content callback interface, the dynamic proxy object For being intercepted and captured in calling process to the object content.
3. according to the method described in claim 2, it is characterized in that, the destination application is third party's browser application journey Sequence;
It is described to show that control extracts the object content by the content, including:
Show that control extracts in the target from the content by third party's kernel of third party's browser application Hold.
4. according to the method described in claim 3, it is characterized in that, the object content is the content in target webpage;
Third party's kernel by third party's browser application is according to content display control extraction Object content, including:
Reflection calls the content to show the corresponding script execution of control, injects contents extraction foot to the target webpage This, the contents extraction script is for extracting the object content;
The contents extraction script is executed by third party's kernel, extraction obtains the object content.
5. method according to any one of claims 1 to 4, which is characterized in that determination content corresponding with object content Callback interface, including:
The corresponding content callback interface of the object content is hooked up by Hook Technique.
6. a kind of content acquisition unit, which is characterized in that applied in the operating system of terminal, described device includes:
Receiving module is configured as reception content and obtains signal, and the content obtains signal and is configured as to destination application In object content obtained;
Determining module is configured to determine that content callback interface corresponding with the object content, the content callback interface quilt It is configured to be called the object content in the destination application;
Setup module is configured as that dynamic proxy object, the dynamic proxy object quilt is arranged according to the content callback interface It is configured to the object content being called in the destination application being forwarded to the content callback interface;
Interception module is configured as passing through the dynamic proxy object when the object content is called by the operating system Intercept and capture the object content.
7. device according to claim 6, which is characterized in that the interception module, including:
It determines submodule, is configured to determine that content display control corresponding with the object content in the destination application Part, the content show that control is configured as showing the object content;
Extracting sub-module is configured as showing that control extracts the object content by the content;
Submodule is called, is configured as connecing the object content by the dynamic proxy object reference to content readjustment Mouthful, the dynamic proxy object is configured as in calling process intercepting and capturing the object content.
8. device according to claim 7, which is characterized in that the destination application is third party's browser application journey Sequence;
The extracting sub-module is additionally configured to through third party's kernel of third party's browser application from described interior Hold display control and extracts the object content.
9. device according to claim 8, which is characterized in that the object content is the content in target webpage;
The extracting sub-module is additionally configured to reflection and the content is called to show the corresponding script execution device of control, to institute Target webpage injection contents extraction script is stated, the contents extraction script is configured as extracting the object content;
The extracting sub-module is additionally configured to execute the contents extraction script by third party's kernel, and extraction obtains The object content.
10. according to any device of claim 6 to 9, which is characterized in that the determining module is additionally configured to pass through Hook Technique hooks up the corresponding content callback interface of the object content.
11. a kind of terminal, which is characterized in that the terminal includes processor and memory, is stored at least in the memory One instruction, described instruction are loaded by the processor and are executed to realize contents extraction as claimed in claim 1 to 5 Method.
12. a kind of computer readable storage medium, which is characterized in that be stored at least one instruction, institute in the storage medium Instruction is stated to be loaded by processor and executed to realize method for extracting content as claimed in claim 1 to 5.
CN201810525031.7A 2018-05-28 2018-05-28 Content acquisition method, device, terminal and storage medium Pending CN108830268A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810525031.7A CN108830268A (en) 2018-05-28 2018-05-28 Content acquisition method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810525031.7A CN108830268A (en) 2018-05-28 2018-05-28 Content acquisition method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN108830268A true CN108830268A (en) 2018-11-16

Family

ID=64146405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810525031.7A Pending CN108830268A (en) 2018-05-28 2018-05-28 Content acquisition method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN108830268A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110147334A (en) * 2019-05-08 2019-08-20 北京百度网讯科技有限公司 A kind of storage method and terminal of content of edit
CN114816558A (en) * 2022-03-07 2022-07-29 深圳开源互联网安全技术有限公司 Script injection method and device and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160301774A1 (en) * 2015-04-09 2016-10-13 Microscan Systems, Inc. Web enabled interface for an embedded server
CN106502703A (en) * 2016-10-27 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN107220083A (en) * 2017-05-22 2017-09-29 韩皓 Exempt from the method and system of installation and operation application program in a kind of Android system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160301774A1 (en) * 2015-04-09 2016-10-13 Microscan Systems, Inc. Web enabled interface for an embedded server
CN106502703A (en) * 2016-10-27 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN107220083A (en) * 2017-05-22 2017-09-29 韩皓 Exempt from the method and system of installation and operation application program in a kind of Android system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YYANJUN: "《Android中webview填坑系列——向webview注入本地js文件》", 《HTTPS://BLOG.CSDN.NET/YYANJUN/ARTICLE/DETAILS/80353766》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110147334A (en) * 2019-05-08 2019-08-20 北京百度网讯科技有限公司 A kind of storage method and terminal of content of edit
CN114816558A (en) * 2022-03-07 2022-07-29 深圳开源互联网安全技术有限公司 Script injection method and device and computer readable storage medium
CN114816558B (en) * 2022-03-07 2023-06-30 深圳市九州安域科技有限公司 Script injection method, equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
JP2022163060A (en) Notification processing method, electronic device, and program
CN106055246B (en) A kind of mobile terminal and its operating method
CN105843615B (en) Notification message processing method and device
US9553974B2 (en) Media/voice binding protocol and related user interfaces
CN107066172B (en) File transmission method and device of mobile terminal
US11204681B2 (en) Program orchestration method and electronic device
KR101962774B1 (en) Method and apparatus for processing new messages associated with an application
CN109600303B (en) Content sharing method and device and storage medium
EP3561692A1 (en) Method and device for displaying web page content
CN107391063A (en) Method for information display, device and computer-readable recording medium
CN104462296B (en) File management method and device and terminal
CN106775202B (en) Information transmission method and device
CN109525652B (en) Information sharing method, device, equipment and storage medium
CN104363205A (en) Application login method and device
CN110945467B (en) Disturbance-free method and terminal
CN106537288B (en) The method and device of self-starting is applied in control
CN107590137A (en) Interpretation method, device and computer-readable recording medium
CN108830268A (en) Content acquisition method, device, terminal and storage medium
CN105468606B (en) Webpage saving method and device
CN107632835A (en) Using installation method and device
CN112667852B (en) Video-based searching method and device, electronic equipment and storage medium
CN105159181A (en) Control method and device for intelligent equipment
CN107066420A (en) Search for the electronic equipment and method of data record
CN106126246B (en) Item display method and device
CN105912367B (en) Prevent installation kit from missing method for down loading

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181116