The content of the invention
In order to solve the above-mentioned technical problem, this application provides a kind of data for being used to capture five application page
Method, device and terminal.
According to the first aspect of the embodiment of the present application, there is provided a kind of side for being used to capture the data of five application page
Method, methods described is applied to the operating system with predetermined characteristic, and the predetermined characteristic is included to operation system
The attribute output function corresponding to predetermined attribute that description components are modified and defined in system, methods described
Including:
The application program of reception front stage operation is to operating system when scheduled event occurs, and the data of transmission are grabbed
Take request;
In response to data grabber request, the current application page is exported based on the attribute output function
Tentation data, the tentation data of the five application page is the corresponding data of predetermined attribute of five application page;
The tentation data of the derived five application page is stored, and is uploaded to server.
According to the second aspect of the embodiment of the present application, there is provided a kind of dress for being used to capture the data of five application page
Put, described device is applied to the operating system with predetermined characteristic, the predetermined characteristic is included to operation system
The attribute output function corresponding to predetermined attribute that description components are modified and defined in system, described device
Including:
Receiving unit, receives the application program of front stage operation when scheduled event occurs, the data of transmission are grabbed
Take request;
Lead-out unit, for being asked in response to the data grabber, based on attribute output function export
The tentation data of the current application page, the tentation data of the five application page is the predetermined attribute of five application page
Corresponding data;
Memory cell, for the tentation data of the derived five application page to be stored;
Uploading unit, for the tentation data of the derived five application page to be uploaded into server.
According to the third aspect of the embodiment of the present application there is provided a kind of terminal, the terminal applies have predetermined
The operating system of feature, the predetermined characteristic includes modifying to description components in operating system and defining
The attribute output function corresponding to predetermined attribute, the terminal includes:
Processor;Memory for storing the processor-executable instruction;
Wherein, the processor is configured as:
The application program of reception front stage operation is to operating system when scheduled event occurs, and the data of transmission are grabbed
Take request;
In response to data grabber request, the current application page is exported based on the attribute output function
Tentation data, the tentation data of the five application page is the corresponding data of predetermined attribute of five application page;
The tentation data of the derived five application page is stored, and is uploaded to server.
Using above-described embodiment, the application program of front stage operation is received when scheduled event occurs, transmission
Data grabber is asked, and is asked in response to the data grabber, currently should based on attribute output function export
With the corresponding data of the predetermined attribute of the page, derived data are stored, and be uploaded to server.
Therefore, the tentation data of five application page is directly uploaded to server by the embodiment by terminal, without service
Device analogue mobile phone communication protocol sends to mobile phone and asked, without server according still further to different communication protocol
The different packets received are parsed, so as to save resource, crawl five application page are improved
Data efficiency.
It should be appreciated that the general description of the above and detailed description hereinafter are only exemplary and explanatory
, the application can not be limited.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following
When description is related to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous
Key element.Embodiment described in following exemplary embodiment does not represent the institute consistent with the application
There is embodiment.On the contrary, they are only one be described in detail in such as appended claims, the application
The example of the consistent apparatus and method of a little aspects.
It is the purpose only merely for description specific embodiment in term used in this application, and is not intended to be limiting
The application." one kind ", " described " of singulative used in the application and appended claims
It is also intended to "the" including most forms, unless context clearly shows that other implications.It should also manage
Solution, term "and/or" used herein refers to and comprising one or more associated projects of listing
Any or all may be combined.
It will be appreciated that though may describe various using term first, second, third, etc. in the application
Information, but these information should not necessarily be limited by these terms.These terms only be used for by same type of information that
This is distinguished.For example, in the case where not departing from the application scope, the first information can also be referred to as
Two information, similarly, the second information can also be referred to as the first information.Depending on linguistic context, as in this institute
Use word " if " can be construed to " and ... when " or " when ... when " or " response
In it is determined that ".
Referring to Fig. 1, for the exemplary system architecture schematic diagram of application the embodiment of the present application:
As shown in figure 1, system architecture 100 can include terminal device 101,102, the kimonos of network 103
Business device 104.Network 103 is used to provide communication chain between terminal device 101,102 and server 104
The medium on road.Network 103 can include various connection types, such as wired, wireless communication link or
Fiber optic cables etc..
Terminal device 101,102 can be interacted by network 103 with server 104, to receive or send
Request or information etc..Terminal device 101,102 can be various electronic equipments, include but is not limited to intelligence
Mobile phone, tablet personal computer, pocket computer on knee and desktop computer etc..Server 104 can be
The server of various services is provided.Server such as can be stored, be analyzed at the processing to the data received.
It is appreciated that a server can provide one or more services, same service can also be by multiple
Server is provided.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.
According to needs are realized, can have any number of terminal device, network and server.
Based on the system architecture shown in Fig. 1, in the embodiment of the present application, terminal device 101 or terminal device
102 after the page data of application program of front stage operation is obtained, can be by network 103 to service
Device 104 uploads the page data of the above-mentioned application program obtained, and server 104 receives above-mentioned application journey
After the page data of sequence, it can filter out partial data according to specific needs and (e.g., filter out character portion
The data divided, or filter out the data of image section etc.).So as to the data that further application is filtered out
Carry out some statistics or calculating etc..The application is described in detail below in conjunction with specific embodiments.
It is one embodiment flow that the application is used to capture the method for the data of five application page referring to Fig. 2
Figure, the embodiment can apply to terminal, comprise the following steps:
Step 201, the application program of front stage operation is received when scheduled event occurs, and the data of transmission are grabbed
Take request.
Step 202, asked in response to above-mentioned data grabber, it is current based on attribute output function export
The tentation data of five application page, the tentation data of the five application page is corresponding for the predetermined attribute of five application page
Data.
Step 203, the tentation data of the derived five application page is stored, and is uploaded to server.
In the present embodiment, this method can apply in the terminal that operating system is Android system, the behaviour
There is predetermined characteristic as system, predetermined characteristic includes modifying to description components in operating system and defining
The attribute output function corresponding to predetermined attribute.Specifically, before carrying out the method, it is necessary to first
The system framework of Android system is modified, Android system source code translation and compiling environment is then built, will compile
Amended Android system is re-fitted in the terminal for performing this method, so that the terminal is able to carry out above-mentioned side
Method.Android system is amended as follows:
(1) predetermined explain is set in the view component of Android system or the subclass component of view.
In general, the interface of Android system includes the data of many attribute, for example, attribute is word
Data, attribute is the data of image, and attribute is data of color etc..Can a note self-defined first
Solution (predetermined explain), and this note is added into view component (such as View.java) or view
Subclass component (such as TextView.java) inner predetermined attribute (needing the corresponding attribute of data obtained) generation
In code section, to demarcate the attribute.Wherein, explain and be also metadata (data for being used for describing data), be
A kind of other explanation of code level, and class, interface, to enumerate be in same level, it can be stated that bag,
Before class, field, method, local variable, method parameter etc., for being illustrated to these elements,
Annotation.Note is that it will not directly influence the language of program with '@explains name ' present in code
Justice, is intended only as mark and exists, the access that we can be by reflex mechanism programming realization to note.
For example, with reference to following code segment:
@ViewDebug.ExportedProperty (category=" layout ")
Protected int mLeft;
The code segment is the source code section of left coordinate attributes in screen coordinate system described in view component, such as
Fruit needs to obtain the related data of left coordinate attributes in screen coordinate system, then can be with addition in above-mentioned code segment
One self-defined note.Assuming that self-defined explain is@ViewDebug.TestProperty, then by repairing
Code segment after changing is:
@ViewDebug.TestProperty
@ViewDebug.ExportedProperty (category=" layout ")
Protected int mLeft;
(2) view of modification Android system debugs the code of component.
On the one hand, above-mentioned note is added (e.g., in view debugging component (e.g., ViewDebug.java)
@ViewDebug.TestProperty) definition, this definition comprising attribute export order.So as in view
When serviced component calls export (swf) command, the definition of predetermined note can be found out.
For example, it is assumed that above-mentioned predetermined explain is@ViewDebug.TestProperty, then it can be adjusted in view
Following code segment is added in the code for trying component:
@Target({ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public@interface TestProperty{
}
Definition and export (swf) command of the code segment for note@ViewDebug.TestProperty.
On the other hand, the attribute output letter defined in view debugging component (e.g., ViewDebug.java)
Number.So as to after the definition of predetermined note is found out, should according to attribute output command calls in definition
Attribute output function, so as to realize the output of the corresponding data of predetermined attribute.
For example, attribute output function can be defined as:
private static Field[]getTestPropertyFields(Class<>klass){
………………
………………
………………
return fields;
}
When view serviced component calls export (swf) command, the definition of predetermined note is found out, can be called
Attribute output function is stated, the attribute output function is performed, to realize the output of the corresponding data of predetermined attribute.
(3) change call function flow, build export (swf) command so that view serviced component call it is above-mentioned
After export (swf) command, view can be called to debug the attribute output function defined in component.
It will compile after amended Android system is re-fitted in the terminal for performing this method, the terminal is with regard to energy
Enough perform the above method.
First, in step 201, the application program of front stage operation is received when scheduled event occurs, hair
The data grabber request sent.The generation of scheduled event can include following one or more:Application program
Open;The switching of five application page;And the scheduled operation of user.Wherein, operating system can be Android
System.
In one implementation, the generation of scheduled event can be any one application installed in terminal
The unlatching of program, when scheduled event occurs, data are sent from the application program of the unlatching to operating system
Crawl request.For example, when user opens the application program of the baidu browser in terminal, then by hundred
The application program for spending browser sends data grabber request to operating system (e.g., Android system).The reality
Existing mode is suitable for the data of the automatic crawl page.
In another implementation, scheduled event can also be the scheduled operation of user, user
Scheduled operation can be user click in operation interface default data grabber start button operation, or
Person can also carry out predetermined gesture operation etc..It is appreciated that the scheduled operation of user can also be it
Its operation, the application is not limited the concrete form aspect of scheduled operation.When scheduled event occurs,
Data grabber request is sent from the application program of front stage operation to operating system.For example, when user opens
The application program (such as news client) of privacy it is not related in terminal, the user, which thinks now upload, to be answered
With the data of the page, then can perform the operation (e.g., clicking on pre-set button) of turn-on data crawl, then by
The application program of front stage operation sends data grabber request to operating system (e.g., Android system).The reality
Existing mode is suitable for the data of the crawl page manually.
In another implementation, scheduled event can also be the switching of five application page, when pre-
When determining event generation, data grabber request is sent from the application program of front stage operation to operating system.For example,
When front stage operation application program page layout switch to the new page when, from front stage operation application program to
Operating system sends data grabber request.The implementation can be used for the data of the automatic crawl page,
It can be used for the data of the crawl page manually.
Then, in step 202., ask, led based on the attribute output function in response to data grabber
Go out the tentation data of the current application page.In the present embodiment, the tentation data of the five application page is application
The corresponding data of predetermined attribute of the page.Predetermined attribute be by above-mentioned modification (1) in view component or
In advance with the predetermined attribute for explaining demarcation in the subclass component of view.
Specifically, after operating system receives data grabber request, control view serviced component is called
The export (swf) command built in advance by above-mentioned modification (3).In response to the export (swf) command, find out by upper
The definition that the predetermined note set in component is debugged in modification (2) in view in advance is stated, this definition includes attribute
Output order.The attribute output function for calling the definition of predetermined note to indicate, the attribute output function passes through
Above-mentioned modification (2) sets in view debugging component in advance.The attribute output function is called, can be obtained
The corresponding data of predetermined attribute.
Finally, in step 203, the tentation data of the derived five application page is stored, and directly
Connect and be transmitted to server.Server can be arranged and analyzed to these data, filter out the number of needs
According to (data of word segment e.g., are filtered out, or filter out the data of image section etc.).So as to enter
The data that one step application is filtered out carry out some statistics or calculating etc..
Using above-described embodiment, the application program of front stage operation is received when scheduled event occurs, transmission
Data grabber is asked, and is asked in response to the data grabber, currently should based on attribute output function export
With the corresponding data of the predetermined attribute of the page, derived data are stored, and be uploaded to server.
Therefore, the tentation data of five application page is directly uploaded to server by the embodiment by terminal, without service
Device analogue mobile phone communication protocol sends to mobile phone and asked, without server according still further to different communication protocol
The different packets received are parsed, so as to save resource, crawl five application page are improved
Data efficiency.
It should be noted that although the operation of the inventive method is described with particular order in the accompanying drawings,
This does not require that or implied must perform these operations according to the particular order, or have to carry out complete
Operation shown in portion could realize desired result.Held on the contrary, the step of describing in flow chart can change
Row order.Additionally or alternatively, it is convenient to omit some steps, multiple steps are merged into a step
Perform, and/or a step is decomposed into execution of multiple steps.
The embodiment of the method for data with the application for capturing five application page is corresponding, and the application is also carried
The device and the embodiment of terminal of the data for being used to capture five application page are supplied.
The embodiment that the application is used for the device for capturing five application page can be applied in equipment.Device is implemented
Example can be realized by software, can also be realized by way of hardware or software and hardware combining.With software
Exemplified by realization, as the device on a logical meaning, being will be non-easy by the processor of equipment where it
Corresponding computer program instructions read what operation in internal memory was formed in the property lost memory.From hardware view
For, as shown in figure 3, a kind of hardware configuration of equipment where being used for the device of paging query for the application
Figure, in addition to the processor shown in Fig. 3, internal memory, network interface and nonvolatile memory,
Equipment in embodiment where device can also include other hardware generally according to the actual functional capability of the equipment,
No longer shown one by one in Fig. 3.
It is one embodiment block diagram that the application is used to capture the device of five application page referring to Fig. 4.
The device includes:Receiving unit 401, lead-out unit 402, memory cell 403 and uploading unit
404。
Wherein, receiving unit 401, for receiving the application program of front stage operation when scheduled event occurs,
The data grabber request of transmission;
Lead-out unit 402, for being asked in response to the data grabber, based on the attribute output function
The tentation data of the current application page is exported, the tentation data of the five application page is the predetermined of five application page
The corresponding data of attribute;
Memory cell 403, for the tentation data of the derived five application page to be stored;
Uploading unit 404, for the tentation data of the derived five application page to be uploaded into server.
In an optional implementation, the predetermined attribute is view component or the subclass group of view
In advance with the predetermined attribute for explaining demarcation in part.
In another optional implementation, the lead-out unit 402 can include (in Fig. 4 not showing
Go out):
Subelement is controlled, for controlling view serviced component to call the export (swf) command built in advance;
Subelement is searched, in response to the export (swf) command, finding out in advance in view debugging component
The definition of the predetermined note of setting;
Subelement is obtained, the attribute output function that the definition for calling the predetermined note is indicated, to obtain
The corresponding data of the predetermined attribute are taken, the attribute output function is to debug component in the view in advance
In define.
In another optional implementation, the generation of scheduled event includes following one or more:
The unlatching of application program;
The switching of five application page;And
The scheduled operation of user.
In another optional implementation, the operating system is Android system.
The function of unit and the implementation process of effect specifically refer to correspondence in the above method in said apparatus
The implementation process of step, will not be repeated here.
It should be appreciated that said apparatus can be pre-set in the terminal, can also be by modes such as downloads
It is loaded into terminal.Corresponding module unit in said apparatus can be with the modular unit phase interworking in terminal
Close to realize the scheme of the data for capturing five application page.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is joined
See the part explanation of embodiment of the method.Device embodiment described above be only it is schematical,
The wherein described unit illustrated as separating component can be or may not be it is physically separate, make
It can be for the part that unit is shown or may not be physical location, you can with positioned at a place,
Or can also be distributed on multiple NEs.Can select according to the actual needs part therein or
Person's whole modules realize the purpose of application scheme.Those of ordinary skill in the art are not paying creativeness
In the case of work, you can to understand and implement.
Those skilled in the art will readily occur to this after considering specification and putting into practice invention disclosed herein
Other embodiments of application.The application is intended to any modification, purposes or the adaptability of the application
Change, these modifications, purposes or adaptations follow the general principle of the application and including this Shen
Please undocumented common knowledge or conventional techniques in the art.Description and embodiments only by
It is considered as exemplary, the true scope of the application and spirit are pointed out by following claim.
It should be appreciated that the application be not limited to be described above and be shown in the drawings it is accurate
Structure, and various modifications and changes can be being carried out without departing from the scope.Scope of the present application is only by institute
Attached claim is limited.