Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: naturegirl/BiscuitSpy
base: 26a2fca8ba
...
head fork: naturegirl/BiscuitSpy
compare: ccba7f0c4c
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 79 additions and 0 deletions.
  1. +79 −0 src/com/BiscuitSpy/cookies/definitions/Id.java
View
79 src/com/BiscuitSpy/cookies/definitions/Id.java
@@ -0,0 +1,79 @@
+package com.BiscuitSpy.cookies.definitions;
+
+import java.util.StringTokenizer;
+
+import com.BiscuitSpy.cookies.CookieUtils;
+
+public class Id {
+
+ // cookie name: id (only from *.doubleclick.net domain)
+ // id cookie structure:
+ // fields separated by '|' where *apart from the first 2 fields* each field has structure key=value
+ // i.e.: 22ffdcab7e02005f||t=1389303219|et=730|cs=002213fd4891bd21ca8019cd30
+
+ final static String DELIM = "|";
+ final static int FIELD_COUNT = 5;
+
+ String adnumbers; // second field of format a/b/c/... believe it's saying something about which ads to show
+ String timestamp;
+ String et; // meaning?
+ String cs; // meaning?
+
+ public Id(String id_string) {
+ if (id_string == null || id_string == "") {
+ System.out.println("Error in Id(): id_string is empty");
+ return;
+ }
+ StringTokenizer st = new StringTokenizer(id_string, DELIM);
+
+ if (st.countTokens() != FIELD_COUNT && st.countTokens() != FIELD_COUNT-1) {
+ System.out.println("Error in Id(): wordpress cookie tokens count incorrect");
+ return;
+ }
+
+ if (st.countTokens() == FIELD_COUNT) {
+ st.nextToken();
+ adnumbers = st.nextToken();
+ timestamp = CookieUtils.convertTimestamp(
+ CookieUtils.getFieldValue(st.nextToken()));
+ et = CookieUtils.getFieldValue(st.nextToken());
+ cs = CookieUtils.getFieldValue(st.nextToken());
+ }
+
+ // sometimes the second field is empty. Not able to parse empty field, so I'm handling it seperately.
+ else if (st.countTokens() == FIELD_COUNT-1) {
+ st.nextToken();
+ timestamp = CookieUtils.convertTimestamp(
+ CookieUtils.getFieldValue(st.nextToken()));
+ et = CookieUtils.getFieldValue(st.nextToken());
+ cs = CookieUtils.getFieldValue(st.nextToken());
+ }
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public String getAdnumbers() {
+ return adnumbers;
+ }
+
+ public String getET() {
+ return et;
+ }
+
+ public String getCS() {
+ return cs;
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ String id_string = "22ffdcab7e02005f||t=1389303219|et=730|cs=002213fd4891bd21ca8019cd30";
+ String test2 = "22ffdcab7e02005f|1293907/680770/16080|t=1389303219|et=730|cs=002213fd4891bd21ca8019cd30";
+ Id id = new Id(test2);
+ System.out.println("breakpoint");
+ }
+
+}

No commit comments for this range

Something went wrong with that request. Please try again.