tracking stuff

This commit is contained in:
2019-12-26 05:03:41 +00:00
parent add7f637ee
commit fcfff0be06
756 changed files with 158214 additions and 7 deletions
@@ -0,0 +1,130 @@
using Newtonsoft.Json.Linq;
using RefererParser;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Xunit;
namespace RefererParser.Tests
{
public class ParserTests
{
[Fact]
public void LoadCatalog()
{
Assert.True(Referers.Catalog["test"] == null);
}
[Fact]
public void TestReferers()
{
var set = from test in JArray.Parse(File.ReadAllText(@"referer-tests.json"))
let testObj = ((JObject)test)
select new {
Name = testObj["spec"].ToString(),
Uri = testObj["uri"].ToString(),
Medium = (RefererMedium)Enum.Parse(typeof(RefererMedium), testObj["medium"].ToString(), true),
Source = testObj["source"].ToString(),
Term = testObj["term"].ToString(),
Known = testObj["known"].ToString(),
};
foreach (var sample in set)
{
var result = Parser.Parse(new Uri(sample.Uri), "www.snowplowanalytics.com");
Assert.NotNull(result);
Assert.Equal(sample.Medium, result.Medium);
Assert.Equal(sample.Source, result.Source ?? string.Empty);
Assert.Equal(sample.Term, result.Term ?? string.Empty);
}
}
[Fact]
public void TestUnknownReferer()
{
var set = new[]
{
new
{
Name = "Unknown referer #1",
Url = "http://www.behance.net/gallery/psychicbazaarcom/2243272",
Source = string.Empty,
},
new
{
Name = "Unknown referer #2",
Url = "http://www.wishwall.me/home",
Source = string.Empty,
},
new
{
Name = "Unknown referer #3",
Url = "http://www.spyfu.com/domain.aspx?d=3897225171967988459",
Source = string.Empty,
},
new
{
Name = "Unknown referer #4",
Url = "http://seaqueen.wordpress.com/",
Source = string.Empty,
},
new
{
Name = "Non-search Yahoo! site",
Url = "http://finance.yahoo.com",
Source = "Yahoo!",
},
};
foreach (var sample in set)
{
var result = Parser.Parse(new Uri(sample.Url), "www.snowplowanalytics.com");
Assert.NotNull(result);
Assert.Equal(sample.Source, result.Source ?? string.Empty);
}
}
[Fact]
public void TestFalsePositivies()
{
var set = new[]
{
new
{
Name = "Unknown Google service",
Url = "http://xxx.google.com",
Medium = RefererMedium.Search,
Source = "Google",
Term = string.Empty
},
new
{
Name = "Unknown Yahoo! service",
Url = "http://yyy.yahoo.com",
Medium = RefererMedium.Search,
Source = "Yahoo!",
Term = string.Empty
},
new
{
Name = "Non-search Google Drive link",
Url = "http://www.google.com/url?q=http://www.whatismyreferer.com/&sa=D&usg=ALhdy2_qs3arPmg7E_e2aBkj6K0gHLa5rQ",
Medium = RefererMedium.Search,
Source = "Google",
Term = "http://www.whatismyreferer.com/",
},
};
foreach (var sample in set)
{
var result = Parser.Parse(new Uri(sample.Url), "www.snowplowanalytics.com");
Assert.NotNull(result);
Assert.Equal(sample.Source, result.Source ?? string.Empty);
}
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RefererParser.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RefererParser.Tests")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e1c431b9-7ca1-47bc-ad91-9f8f76710e6d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{518417C7-060B-4C04-8F1B-ECEC85D443F0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RefererParser.Tests</RootNamespace>
<AssemblyName>RefererParser.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit">
<HintPath>..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ParserTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RefererParser\RefererParser.csproj">
<Project>{e27751f2-dcfa-4c92-bd14-f8515862fcfa}</Project>
<Name>RefererParser</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="referer-tests.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net40" />
<package id="xunit" version="1.9.1" targetFramework="net40" />
</packages>
@@ -0,0 +1,234 @@
[
{
"spec": "Google Images search",
"uri": "http://www.google.fr/imgres?q=Ogham+the+celtic+oracle&hl=fr&safe=off&client=firefox-a&hs=ZDu&sa=X&rls=org.mozilla:fr-FR:unofficial&tbm=isch&prmd=imvnsa&tbnid=HUVaj-o88ZRdYM:&imgrefurl=http://www.psychicbazaar.com/oracles/101-ogham-the-celtic-oracle-set.html&docid=DY5_pPFMliYUQM&imgurl=http://mdm.pbzstatic.com/oracles/ogham-the-celtic-oracle-set/montage.png&w=734&h=250&ei=GPdWUIePCOqK0AWp3oCQBA&zoom=1&iact=hc&vpx=129&vpy=276&dur=827&hovh=131&hovw=385&tx=204&ty=71&sig=104115776612919232039&page=1&tbnh=69&tbnw=202&start=0&ndsp=26&ved=1t:429,r:13,s:0,i:114&biw=1272&bih=826",
"medium": "search",
"source": "Google Images",
"term": "Ogham the celtic oracle",
"known": true
},
{
"spec": "Yahoo! Images search",
"uri": "http://it.images.search.yahoo.com/images/view;_ylt=A0PDodgQmGBQpn4AWQgdDQx.;_ylu=X3oDMTBlMTQ4cGxyBHNlYwNzcgRzbGsDaW1n?back=http%3A%2F%2Fit.images.search.yahoo.com%2Fsearch%2Fimages%3Fp%3DEarth%2BMagic%2BOracle%2BCards%26fr%3Dmcafee%26fr2%3Dpiv-web%26tab%3Dorganic%26ri%3D5&w=1064&h=1551&imgurl=mdm.pbzstatic.com%2Foracles%2Fearth-magic-oracle-cards%2Fcard-1.png&rurl=http%3A%2F%2Fwww.psychicbazaar.com%2Foracles%2F143-earth-magic-oracle-cards.html&size=2.8+KB&name=Earth+Magic+Oracle+Cards+-+Psychic+Bazaar&p=Earth+Magic+Oracle+Cards&oid=f0a5ad5c4211efe1c07515f56cf5a78e&fr2=piv-web&fr=mcafee&tt=Earth%2BMagic%2BOracle%2BCards%2B-%2BPsychic%2BBazaar&b=0&ni=90&no=5&ts=&tab=organic&sigr=126n355ib&sigb=13hbudmkc&sigi=11ta8f0gd&.crumb=IZBOU1c0UHU",
"medium": "search",
"source": "Yahoo! Images",
"term": "Earth Magic Oracle Cards",
"known": true
},
{
"spec": "Powered by Google",
"uri": "http://isearch.avg.com/pages/images.aspx?q=tarot+card+change&sap=dsp&lang=en&mid=209215200c4147d1a9d6d1565005540b-b0d4f81a8999f5981f04537c5ec8468fd5234593&cid=%7B50F9298B-C111-4C7E-9740-363BF0015949%7D&v=12.1.0.21&ds=AVG&d=7%2F23%2F2012+10%3A31%3A08+PM&pr=fr&sba=06oENya4ZG1YS6vOLJwpLiFdjG91ICt2YE59W2p5ENc2c4w8KvJb5xbvjkj3ceMjnyTSpZq-e6pj7GQUylIQtuK4psJU60wZuI-8PbjX-OqtdX3eIcxbMoxg3qnIasP0ww2fuID1B-p2qJln8vBHxWztkpxeixjZPSppHnrb9fEcx62a9DOR0pZ-V-Kjhd-85bIL0QG5qi1OuA4M1eOP4i_NzJQVRXPQDmXb-CpIcruc2h5FE92Tc8QMUtNiTEWBbX-QiCoXlgbHLpJo5Jlq-zcOisOHNWU2RSHYJnK7IUe_SH6iQ.%2CYT0zO2s9MTA7aD1mNjZmZDBjMjVmZDAxMGU4&snd=hdr&tc=test1",
"medium": "search",
"source": "Google",
"term": "tarot card change",
"known": true
},
{
"spec": "Google search #1",
"uri": "http://www.google.com/search",
"medium": "search",
"source": "Google",
"term": null,
"known": true
},
{
"spec": "Google search #2",
"uri": "http://www.google.com/search?q=gateway+oracle+cards+denise+linn&hl=en&client=safari",
"medium": "search",
"source": "Google",
"term": "gateway oracle cards denise linn",
"known": true
},
{
"spec": "Yahoo! search",
"uri": "http://es.search.yahoo.com/search;_ylt=A7x9QbwbZXxQ9EMAPCKT.Qt.?p=BIEDERMEIER+FORTUNE+TELLING+CARDS&ei=utf-8&type=685749&fr=chr-greentree_gc&xargs=0&pstart=1&b=11",
"medium": "search",
"source": "Yahoo!",
"term": "BIEDERMEIER FORTUNE TELLING CARDS",
"known": true
},
{
"spec": "PriceRunner search",
"uri": "http://www.pricerunner.co.uk/search?displayNoHitsMessage=1&q=wild+wisdom+of+the+faery+oracle",
"medium": "search",
"source": "PriceRunner",
"term": "wild wisdom of the faery oracle",
"known": true
},
{
"spec": "Bing Images search",
"uri": "http://www.bing.com/images/search?q=psychic+oracle+cards&view=detail&id=D268EDDEA8D3BF20AF887E62AF41E8518FE96F08",
"medium": "search",
"source": "Bing Images",
"term": "psychic oracle cards",
"known": true
},
{
"spec": "IXquick search",
"uri": "https://s3-us3.ixquick.com/do/search",
"medium": "search",
"source": "IXquick",
"term": null,
"known": true
},
{
"spec": "AOL search",
"uri": "http://aolsearch.aol.co.uk/aol/search?s_chn=hp&enabled_terms=&s_it=aoluk-homePage50&q=pendulums",
"medium": "search",
"source": "AOL",
"term": "pendulums",
"known": true
},
{
"spec": "AOL search.com",
"uri": "http://www.aolsearch.com/search?s_pt=hp&s_gl=NL&query=voorbeeld+cv+competenties&invocationType=tb50hpcnnbie7-nl-nl",
"medium": "search",
"source": "AOL",
"term": "voorbeeld cv competenties",
"known": true
},
{
"spec": "Ask search",
"uri": "http://uk.search-results.com/web?qsrc=1&o=1921&l=dis&q=pendulums&dm=ctry&atb=sysid%3D406%3Aappid%3D113%3Auid%3D8f40f651e7b608b5%3Auc%3D1346336505%3Aqu%3Dpendulums%3Asrc%3Dcrt%3Ao%3D1921&locale=en_GB",
"medium": "search",
"source": "Ask",
"term": "pendulums",
"known": true
},
{
"spec": "Mail.ru search",
"uri": "http://go.mail.ru/search?q=Gothic%20Tarot%20Cards&where=any&num=10&rch=e&sf=20",
"medium": "search",
"source": "Mail.ru",
"term": "Gothic Tarot Cards",
"known": true
},
{
"spec": "Yandex search",
"uri": "http://images.yandex.ru/yandsearch?text=Blue%20Angel%20Oracle%20Blue%20Angel%20Oracle&noreask=1&pos=16&rpt=simage&lr=45&img_url=http%3A%2F%2Fmdm.pbzstatic.com%2Foracles%2Fblue-angel-oracle%2Fbox-small.png",
"medium": "search",
"source": "Yandex Images",
"term": "Blue Angel Oracle Blue Angel Oracle",
"known": true
},
{
"spec": "Ask toolbar search",
"uri": "http://search.tb.ask.com/search/GGmain.jhtml?cb=AYY&pg=GGmain&p2=%5EAYY%5Exdm071%5EYYA%5Eid&n=77fdaa55&qid=c2678d9147654034bb8b16daa7bfb48c&ss=sub&st=hp&ptb=F9FC6C22-EAE6-4D1E-8126-A70119B6E02F&si=flvrunner&tpr=hst&searchfor=CARA+MEMASAK+CUMI+CUMI&ots=1219016089614",
"medium": "search",
"source": "Ask Toolbar",
"term": "CARA MEMASAK CUMI CUMI",
"known": true
},
{
"spec": "Ask toolbar search #2",
"uri": "http://search.tb.ask.com/search/GGmain.jhtml?&st=hp&p2=%5EZU%5Exdm458%5EYYA%5Eus&n=77fda1bd&ptb=F0B68CA5-4791-4376-BFCC-5F0100329FB6&si=CMKg9-nX07oCFSjZQgodcikACQ&tpr=hpsbsug&searchfor=test",
"medium": "search",
"source": "Ask Toolbar",
"term": "test",
"known": true
},
{
"spec": "Voila search",
"uri": "http://search.ke.voila.fr/?module=voila&bhv=web_fr&kw=test",
"medium": "search",
"source": "Voila",
"term": "test",
"known": true
},
{
"spec": "Dale search",
"uri": "http://www.dalesearch.com/?q=+lego.nl+%2Fclub&s=web&as=0&rlz=0&babsrc=HP_ss",
"medium": "search",
"source": "Dalesearch",
"term": " lego.nl /club",
"known": true
},
{
"spec": "Twitter redirect",
"uri": "http://t.co/chrgFZDb",
"medium": "social",
"source": "Twitter",
"term": null,
"known": true
},
{
"spec": "Facebook social",
"uri": "http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.psychicbazaar.com&h=yAQHZtXxS&s=1",
"medium": "social",
"source": "Facebook",
"term": null,
"known": true
},
{
"spec": "Facebook mobile",
"uri": "http://m.facebook.com/l.php?u=http%3A%2F%2Fwww.psychicbazaar.com%2Fblog%2F2012%2F09%2Fpsychic-bazaar-reviews-tarot-foundations-31-days-to-read-tarot-with-confidence%2F&h=kAQGXKbf9&s=1",
"medium": "social",
"source": "Facebook",
"term": null,
"known": true
},
{
"spec": "Odnoklassniki",
"uri": "http://www.odnoklassniki.ru/dk?cmd=logExternal&st._aid=Conversations_Openlink&st.name=externalLinkRedirect&st.link=http%3A%2F%2Fwww.psychicbazaar.com%2Foracles%2F187-blue-angel-oracle.html",
"medium": "social",
"source": "Odnoklassniki",
"term": null,
"known": true
},
{
"spec": "Tumblr social #1",
"uri": "http://www.tumblr.com/dashboard",
"medium": "social",
"source": "Tumblr",
"term": null,
"known": true
},
{
"spec": "Tumblr w subdomain",
"uri": "http://psychicbazaar.tumblr.com/",
"medium": "social",
"source": "Tumblr",
"term": null,
"known": true
},
{
"spec": "Yahoo! Mail",
"uri": "http://36ohk6dgmcd1n-c.c.yom.mail.yahoo.net/om/api/1.0/openmail.app.invoke/36ohk6dgmcd1n/11/1.0.35/us/en-US/view.html/0",
"medium": "email",
"source": "Yahoo! Mail",
"term": null,
"known": true
},
{
"spec": "Outlook.com mail",
"uri": "http://co106w.col106.mail.live.com/default.aspx?rru=inbox",
"medium": "email",
"source": "Outlook.com",
"term": null,
"known": true
},
{
"spec": "Orange Webmail",
"uri": "http://webmail1m.orange.fr/webmail/fr_FR/read.html?FOLDER=SF_INBOX&IDMSG=8594&check=&SORTBY=31",
"medium": "email",
"source": "Orange Webmail",
"term": null,
"known": true
},
{
"spec": "Internal HTTP",
"uri": "http://www.snowplowanalytics.com/about/team",
"medium": "internal",
"source": null,
"term": null,
"known": false
},
{
"spec": "Internal HTTPS",
"uri": "https://www.snowplowanalytics.com/account/profile",
"medium": "internal",
"source": null,
"term": null,
"known": false
}
]