Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions DiffbotApi/Diffbot.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using System.Xml.Serialization;
namespace DiffbotApi
{
public class Diffbot
Expand All @@ -31,7 +29,11 @@ public Frontpage Frontpage(string url)
{
using (WebClient wc = new WebClient())
{
wc.Proxy = _proxy;
if (_proxy != null)
{
wc.Proxy = _proxy;
}

wc.Encoding = Encoding.UTF8;
string xmlString = wc.DownloadString(getQueryUrl(FRONTPAGE_API_SUFFIX, url));
XmlSerializer ser = new XmlSerializer(typeof(Frontpage));
Expand All @@ -57,7 +59,11 @@ public Article Article(string url, bool comments = false, bool html = false, boo
if (tags)
args.Add(new OptionalParameter() { Name = "tags", Value = "true" });

wc.Proxy = _proxy;
if (_proxy != null)
{
wc.Proxy = _proxy;
}

wc.Encoding = Encoding.UTF8;
string jsonString = wc.DownloadString(getQueryUrl(ARTICLE_API_SUFFIX, url, args.ToArray()));
return new Article(jsonString);
Expand Down