Skip to content

Commit feae4e2

Browse files
author
pipldev
committed
Merge remote-tracking branch 'origin/dev'
2 parents d20a308 + eee7a8d commit feae4e2

11 files changed

Lines changed: 452 additions & 28 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.pipl.api</groupId>
66
<artifactId>piplapis</artifactId>
7-
<version>4.0.1</version>
7+
<version>5.0.0</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/pipl/api/data/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class Utils {
2525
public static Map<String, String> COUNTRIES = new HashMap<String, String>();
2626
public static Map<String, Map<String, String>> STATES = new HashMap<String, Map<String, String>>();
2727

28-
private static String countryString = "{BD:Bangladesh,WF:\"Wallis And Futuna Islands\",BF:\"Burkina Faso\",PY:Paraguay,BA:\"Bosnia And Herzegovina\",BB:Barbados,BE:Belgium,BM:Bermuda,BN:\"Brunei Darussalam\",BO:Bolivia,BH:Bahrain,BI:Burundi,BJ:Benin,BT:Bhutan,JM:Jamaica,BV:\"Bouvet Island\",BW:Botswana,WS:Samoa,BR:Brazil,BS:Bahamas,JE:Jersey,BY:Belarus,BZ:Belize,RU:\"Russian Federation\",RW:Rwanda,LT:Lithuania,RE:Reunion,TM:Turkmenistan,TJ:Tajikistan,RO:Romania,LS:Lesotho,GW:Guinea-bissau,GU:Guam,GT:Guatemala,GS:\"South Georgia And South Sandwich Islands\",GR:Greece,GQ:\"Equatorial Guinea\",GP:Guadeloupe,JP:Japan,GY:Guyana,GG:Guernsey,GF:\"French Guiana\",GE:Georgia,GD:Grenada,GB:\"Great Britain\",GA:Gabon,GN:Guinea,GM:Gambia,GL:Greenland,GI:Gibraltar,GH:Ghana,OM:Oman,TN:Tunisia,JO:Jordan,HR:Croatia,HT:Haiti,SV:\"El Salvador\",HK:\"Hong Kong\",HN:Honduras,HM:\"Heard And Mcdonald Islands\",AD:Andorra,PR:\"Puerto Rico\",PS:Palestine,PW:Palau,PT:Portugal,SJ:\"Svalbard And Jan Mayen Islands\",VG:\"Virgin Islands, British\",AI:Anguilla,KP:\"North Korea\",PF:\"French Polynesia\",PG:\"Papua New Guinea\",PE:Peru,PK:Pakistan,PH:Philippines,PN:Pitcairn,PL:Poland,PM:\"Saint Pierre And Miquelon\",ZM:Zambia,EH:\"Western Sahara\",EE:Estonia,EG:Egypt,ZA:\"South Africa\",EC:Ecuador,IT:Italy,AO:Angola,KZ:Kazakhstan,ET:Ethiopia,ZW:Zimbabwe,SA:\"Saudi Arabia\",ES:Spain,ER:Eritrea,ME:Montenegro,MD:Moldova,MG:Madagascar,MA:Morocco,MC:Monaco,UZ:Uzbekistan,MM:Myanmar,ML:Mali,MO:Macau,MN:Mongolia,MH:\"Marshall Islands\",US:\"United States\",UM:\"United States Minor Outlying Islands\",MT:Malta,MW:Malawi,MV:Maldives,MQ:Martinique,MP:\"Northern Mariana Islands\",MS:Montserrat,NA:Namibia,IM:\"Isle Of Man\",UG:Uganda,MY:Malaysia,MX:Mexico,IL:Israel,BG:Bulgaria,FR:France,AW:Aruba,AX:\"�land Islands\",FI:Finland,FJ:Fiji,FK:\"Falkland Islands\",FM:Micronesia,FO:\"Faroe Islands\",NI:Nicaragua,NL:Netherlands,NO:Norway,SO:Somalia,NC:\"New Caledonia\",NE:Niger,NF:\"Norfolk Island\",NG:Nigeria,NZ:\"New Zealand\",NP:Nepal,NR:Nauru,NU:Niue,MR:Mauritania,CK:\"Cook Islands\",CI:\"C�te D'Ivoire\",CH:Switzerland,CO:Colombia,CN:China,CM:Cameroon,CL:Chile,CC:\"Cocos (keeling) Islands\",CA:Canada,CG:\"Congo (brazzaville)\",CF:\"Central African Republic\",CD:\"Congo (kinshasa)\",CZ:\"Czech Republic\",CY:Cyprus,CX:\"Christmas Island\",CS:Serbia,CR:\"Costa Rica\",HU:Hungary,CV:\"Cape Verde\",CU:Cuba,SZ:Swaziland,SY:Syria,KG:Kyrgyzstan,KE:Kenya,SR:Suriname,KI:Kiribati,KH:Cambodia,KN:\"Saint Kitts And Nevis\",KM:Comoros,ST:\"Sao Tome And Principe\",SK:Slovakia,KR:\"South Korea\",SI:Slovenia,SH:\"Saint Helena\",KW:Kuwait,SN:Senegal,SM:\"San Marino\",SL:\"Sierra Leone\",SC:Seychelles,SB:\"Solomon Islands\",KY:\"Cayman Islands\",SG:Singapore,SE:Sweden,SD:Sudan,DO:\"Dominican Republic\",DM:Dominica,DJ:Djibouti,DK:Denmark,DE:Germany,YE:Yemen,AT:Austria,DZ:Algeria,MK:Macedonia,UY:Uruguay,YT:Mayotte,MU:Mauritius,TZ:Tanzania,LC:\"Saint Lucia\",LA:Laos,TV:Tuvalu,TW:Taiwan,TT:\"Trinidad And Tobago\",TR:Turkey,LK:\"Sri Lanka\",LI:Liechtenstein,LV:Latvia,TO:Tonga,TL:Timor-leste,LU:Luxembourg,LR:Liberia,TK:Tokelau,TH:Thailand,TF:\"French Southern Lands\",TG:Togo,TD:Chad,TC:\"Turks And Caicos Islands\",LY:Libya,VA:\"Vatican City\",AC:\"Ascension Island\",VC:\"Saint Vincent And The Grenadines\",AE:\"United Arab Emirates\",VE:Venezuela,AG:\"Antigua And Barbuda\",AF:Afghanistan,IQ:Iraq,VI:\"Virgin Islands, U.s.\",IS:Iceland,IR:Iran,AM:Armenia,AL:Albania,VN:Vietnam,AN:\"Netherlands Antilles\",AQ:Antarctica,AS:\"American Samoa\",AR:Argentina,AU:Australia,VU:Vanuatu,IO:\"British Indian Ocean Territory\",IN:India,LB:Lebanon,AZ:Azerbaijan,IE:Ireland,ID:Indonesia,PA:Panama,UA:Ukraine,QA:Qatar,MZ:Mozambique}";
28+
private static String countryString = "{BD:Bangladesh,WF:\"Wallis And Futuna Islands\",BF:\"Burkina Faso\",PY:Paraguay,BA:\"Bosnia And Herzegovina\",BB:Barbados,BE:Belgium,BM:Bermuda,BN:\"Brunei Darussalam\",BO:Bolivia,BH:Bahrain,BI:Burundi,BJ:Benin,BT:Bhutan,JM:Jamaica,BV:\"Bouvet Island\",BW:Botswana,WS:Samoa,BR:Brazil,BS:Bahamas,JE:Jersey,BY:Belarus,BZ:Belize,RU:\"Russian Federation\",RW:Rwanda,LT:Lithuania,RE:Reunion,TM:Turkmenistan,TJ:Tajikistan,RO:Romania,LS:Lesotho,GW:Guinea-bissau,GU:Guam,GT:Guatemala,GS:\"South Georgia And South Sandwich Islands\",GR:Greece,GQ:\"Equatorial Guinea\",GP:Guadeloupe,JP:Japan,GY:Guyana,GG:Guernsey,GF:\"French Guiana\",GE:Georgia,GD:Grenada,GB:\"Great Britain\",GA:Gabon,GN:Guinea,GM:Gambia,GL:Greenland,GI:Gibraltar,GH:Ghana,OM:Oman,TN:Tunisia,JO:Jordan,HR:Croatia,HT:Haiti,SV:\"El Salvador\",HK:\"Hong Kong\",HN:Honduras,HM:\"Heard And Mcdonald Islands\",AD:Andorra,PR:\"Puerto Rico\",PS:Palestine,PW:Palau,PT:Portugal,SJ:\"Svalbard And Jan Mayen Islands\",VG:\"Virgin Islands, British\",AI:Anguilla,KP:\"North Korea\",PF:\"French Polynesia\",PG:\"Papua New Guinea\",PE:Peru,PK:Pakistan,PH:Philippines,PN:Pitcairn,PL:Poland,PM:\"Saint Pierre And Miquelon\",ZM:Zambia,EH:\"Western Sahara\",EE:Estonia,EG:Egypt,ZA:\"South Africa\",EC:Ecuador,IT:Italy,AO:Angola,KZ:Kazakhstan,ET:Ethiopia,ZW:Zimbabwe,SA:\"Saudi Arabia\",ES:Spain,ER:Eritrea,ME:Montenegro,MD:Moldova,MG:Madagascar,MA:Morocco,MC:Monaco,UZ:Uzbekistan,MM:Myanmar,ML:Mali,MO:Macau,MN:Mongolia,MH:\"Marshall Islands\",US:\"United States\",UM:\"United States Minor Outlying Islands\",MT:Malta,MW:Malawi,MV:Maldives,MQ:Martinique,MP:\"Northern Mariana Islands\",MS:Montserrat,NA:Namibia,IM:\"Isle Of Man\",UG:Uganda,MY:Malaysia,MX:Mexico,IL:Israel,BG:Bulgaria,FR:France,AW:Aruba,AX:\"�land Islands\",FI:Finland,FJ:Fiji,FK:\"Falkland Islands\",FM:Micronesia,FO:\"Faroe Islands\",NI:Nicaragua,NL:Netherlands,NO:Norway,SO:Somalia,NC:\"New Caledonia\",NE:Niger,NF:\"Norfolk Island\",NG:Nigeria,NZ:\"New Zealand\",NP:Nepal,NR:Nauru,NU:Niue,MR:Mauritania,CK:\"Cook Islands\",CI:\"C�te D'Ivoire\",CH:Switzerland,CO:Colombia,CN:China,CM:Cameroon,CL:Chile,CC:\"Cocos (keeling) Islands\",CA:Canada,CG:\"Congo (brazzaville)\",CF:\"Central African Republic\",CD:\"Congo (kinshasa)\",CZ:\"Czech Republic\",CY:Cyprus,CX:\"Christmas Island\",CS:Serbia,CR:\"Costa Rica\",HU:Hungary,CV:\"Cape Verde\",CU:Cuba,SZ:Swaziland,SY:Syria,KG:Kyrgyzstan,KE:Kenya,SR:Suriname,KI:Kiribati,KH:Cambodia,KN:\"Saint Kitts And Nevis\",KM:Comoros,ST:\"Sao Tome And Principe\",SK:Slovakia,KR:\"South Korea\",SI:Slovenia,SH:\"Saint Helena\",KW:Kuwait,SN:Senegal,SM:\"San Marino\",SL:\"Sierra Leone\",SC:Seychelles,SB:\"Solomon Islands\",KY:\"Cayman Islands\",SG:Singapore,SE:Sweden,SD:Sudan,DO:\"Dominican Republic\",DM:Dominica,DJ:Djibouti,DK:Denmark,DE:Germany,YE:Yemen,AT:Austria,DZ:Algeria,MK:Macedonia,UY:Uruguay,YT:Mayotte,MU:Mauritius,TZ:Tanzania,LC:\"Saint Lucia\",LA:Laos,TV:Tuvalu,TW:Taiwan,TT:\"Trinidad And Tobago\",TR:Turkey,LK:\"Sri Lanka\",LI:Liechtenstein,LV:Latvia,TO:Tonga,TL:Timor-leste,LU:Luxembourg,LR:Liberia,TK:Tokelau,TH:Thailand,TF:\"French Southern Lands\",TG:Togo,TD:Chad,TC:\"Turks And Caicos Islands\",LY:Libya,VA:\"Vatican City\",AC:\"Ascension Island\",VC:\"Saint Vincent And The Grenadines\",AE:\"United Arab Emirates\",VE:Venezuela,AG:\"Antigua And Barbuda\",AF:Afghanistan,IQ:Iraq,VI:\"Virgin Islands, U.s.\",IS:Iceland,IR:Iran,AM:Armenia,AL:Albania,VN:Vietnam,AN:\"Netherlands Antilles\",AQ:Antarctica,AS:\"American Samoa\",AR:Argentina,AU:Australia,VU:Vanuatu,IO:\"British Indian Ocean Territory\",IN:India,LB:Lebanon,AZ:Azerbaijan,IE:Ireland,ID:Indonesia,PA:Panama,UA:Ukraine,QA:Qatar,MZ:Mozambique, BL:\"Saint Barthélemy\",BQ:\"Caribbean Netherlands\",MF:\"Saint Martin\",SS:\"South Sudan\",SX:\"Sint Maarten\",XK:Kosovo,CW:Curaçao,RS:Serbia}";
2929

3030
static {
3131
Gson gson = new Gson();

src/main/java/com/pipl/api/data/containers/Person.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public class Person extends FieldsContainer {
6666
@Expose
6767
@SerializedName("@search_pointer")
6868
public String searchPointer;
69+
@Expose
70+
@SerializedName("@inferred")
71+
public Boolean inferred;
6972

7073
public Person() {
7174
}
@@ -137,6 +140,12 @@ public void setSearchPointer(String searchPointer) {
137140
this.searchPointer = searchPointer;
138141
}
139142

143+
public boolean isInferred() {
144+
if (inferred==null)
145+
return false;
146+
return inferred;
147+
}
148+
140149
/**
141150
* A shortcut method to generate a search request
142151
* from a possible person that contained a search pointer.

src/main/java/com/pipl/api/data/containers/Relationship.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public class Relationship extends FieldsContainer implements Field {
1515
@SerializedName("@valid_since")
1616
public Date validSince;
1717
@Expose
18+
@SerializedName("@last_seen")
19+
public Date lastSeen;
20+
@Expose
21+
@SerializedName("@current")
22+
public Boolean current;
23+
@Expose
1824
@SerializedName("@inferred")
1925
public Boolean inferred;
2026
@Expose
@@ -37,6 +43,11 @@ public Date getValidSince() {
3743
return validSince;
3844
}
3945

46+
@Override
47+
public Date getLastSeen() {
48+
return lastSeen;
49+
}
50+
4051
@Override
4152
public boolean isInferred() {
4253
if (inferred==null)

src/main/java/com/pipl/api/data/fields/AbstractField.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public abstract class AbstractField implements Serializable, Field {
1616
@SerializedName("@valid_since")
1717
public Date validSince;
1818
@Expose
19+
@SerializedName("@last_seen")
20+
public Date lastSeen;
21+
@Expose
22+
@SerializedName("@current")
23+
public Boolean current;
24+
@Expose
1925
@SerializedName("@inferred")
2026
public Boolean inferred;
2127

@@ -84,6 +90,14 @@ public Date getValidSince() {
8490
return validSince;
8591
}
8692

93+
/* (non-Javadoc)
94+
* @see com.pipl.api.data.fields.Field#getLastSeen()
95+
*/
96+
@Override
97+
public Date getLastSeen() {
98+
return lastSeen;
99+
}
100+
87101
/* (non-Javadoc)
88102
* @see com.pipl.api.data.fields.Field#isInferred()
89103
*/

src/main/java/com/pipl/api/data/fields/Field.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ public interface Field {
1111
*/
1212
public abstract boolean isSearchable();
1313

14+
/**
15+
* @return the date in which this field first appeared to Pipl's crawlers.
16+
*/
1417
public abstract Date getValidSince();
1518

19+
/**
20+
* @return the date in which this field was last seen by Pipl's crawlers.
21+
*/
22+
public abstract Date getLastSeen();
23+
24+
/**
25+
* @return is this field is inferred.
26+
*/
1627
public abstract boolean isInferred();
1728

1829
}

src/main/java/com/pipl/api/data/fields/Image.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import java.text.MessageFormat;
5+
import java.util.regex.Pattern;
56

67
import com.google.gson.annotations.Expose;
78
import com.google.gson.annotations.SerializedName;
@@ -19,6 +20,8 @@ public class Image extends AbstractField {
1920
@Expose
2021
@SerializedName("thumbnail_token")
2122
private String thumbnailToken;
23+
24+
private static Pattern dsidParam = Pattern.compile("&dsid=\\d*");
2225

2326
public Image() {
2427
}
@@ -39,6 +42,22 @@ public String getThumbnailUrl(int height, int width, boolean favicon, boolean de
3942
return MessageFormat.format("{0}://thumb.pipl.com/image?height={1}&width={2}&favicon={3}&zoom_face={4}&token={5}", useHttps ? "https" : "http", height, width, favicon ? 1 : 0, detectFace ? 1 : 0, thumbnailToken);
4043
}
4144

45+
/**
46+
* @param height - the desired height of the thumbnail.
47+
* @param width - the desired width of the thumbnail.
48+
* @param favicon - if true, adds the favicon of the source site in the bottom right corner of the image.
49+
* @param detectFace - if true, attempts to focus the thumbnail to the face in the image.
50+
* @param useHttps - if true, returns an https URL. Otherwise, an HTTP URL.
51+
* @param image1 - the intended image for this thumbnail
52+
* @param image2 - the fall-back image for this thumbnail
53+
* @return A URL to be used in an <img src=""> elements. The URL returns a thumbnail image created from the original image URL.
54+
*/
55+
static public String generateRedundantThumbnailUrl(int height, int width, boolean favicon, boolean detectFace, boolean useHttps, Image image1, Image image2) {
56+
String token1 = dsidParam.matcher(image1.thumbnailToken).replaceAll("");
57+
String token2 = dsidParam.matcher(image2.thumbnailToken).replaceAll("");
58+
return MessageFormat.format("{0}://thumb.pipl.com/image?height={1}&width={2}&favicon={3}&zoom_face={4}&tokens={5},{6}", useHttps ? "https" : "http", height, width, favicon ? 1 : 0, detectFace ? 1 : 0, token1, token2);
59+
}
60+
4261
@Override
4362
public String toString() {
4463
return url;
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
package com.pipl.api.search;
2+
3+
import java.io.Serializable;
4+
5+
import com.google.gson.annotations.Expose;
6+
import com.google.gson.annotations.SerializedName;
7+
8+
public class AvailableData implements Serializable {
9+
private static final long serialVersionUID = 1L;
10+
@Expose
11+
public FieldCount basic;
12+
@Expose
13+
public FieldCount premium;
14+
15+
/**
16+
* A summary of the data within an API response
17+
*
18+
*/
19+
public static class FieldCount implements Serializable {
20+
private static final long serialVersionUID = 1L;
21+
@Expose
22+
public int names;
23+
@Expose
24+
public int addresses;
25+
@Expose
26+
public int phones;
27+
@Expose
28+
public int emails;
29+
@Expose
30+
public int jobs;
31+
@Expose
32+
public int educations;
33+
@Expose
34+
public int images;
35+
@Expose
36+
public int usernames;
37+
@Expose
38+
@SerializedName("user_ids")
39+
public int userIds;
40+
@Expose
41+
public int languages;
42+
@Expose
43+
public int ethnicities;
44+
@Expose
45+
@SerializedName("origin_countries")
46+
public int originCountries;
47+
@Expose
48+
public int urls;
49+
@Expose
50+
public int relationships;
51+
@Expose
52+
public int dobs;
53+
@Expose
54+
public int genders;
55+
@Expose
56+
@SerializedName("social_profiles")
57+
public int socialProfiles;
58+
59+
public FieldCount() {
60+
}
61+
62+
public int getNames() {
63+
return names;
64+
}
65+
66+
public int getAddresses() {
67+
return addresses;
68+
}
69+
70+
public int getPhones() {
71+
return phones;
72+
}
73+
74+
public int getEmails() {
75+
return emails;
76+
}
77+
78+
public int getJobs() {
79+
return jobs;
80+
}
81+
82+
public int getEducations() {
83+
return educations;
84+
}
85+
86+
public int getImages() {
87+
return images;
88+
}
89+
90+
public int getUsernames() {
91+
return usernames;
92+
}
93+
94+
public int getUserIds() {
95+
return userIds;
96+
}
97+
98+
public int getLanguages() {
99+
return languages;
100+
}
101+
102+
public int getEthnicities() {
103+
return ethnicities;
104+
}
105+
106+
public int getOriginCountries() {
107+
return originCountries;
108+
}
109+
110+
public int getUrls() {
111+
return urls;
112+
}
113+
114+
public int getRelationships() {
115+
return relationships;
116+
}
117+
118+
public int getDobs() {
119+
return dobs;
120+
}
121+
122+
public int getGenders() {
123+
return genders;
124+
}
125+
126+
/**
127+
* @return the number of social profile sources
128+
*/
129+
public int getSocialProfiles() {
130+
return socialProfiles;
131+
}
132+
}
133+
134+
public AvailableData() {
135+
}
136+
137+
public FieldCount getBasic() {
138+
return basic;
139+
}
140+
141+
public FieldCount getPremium() {
142+
return premium;
143+
}
144+
}

0 commit comments

Comments
 (0)