mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Removed unavailable url shortener
This commit is contained in:
parent
83b56cf088
commit
7cb460a814
5 changed files with 3 additions and 66 deletions
|
@ -38,7 +38,7 @@ public sealed class BitlyURLShortener : URLShortener
|
||||||
private const string URLAccessToken = URLAPI + "oauth/access_token";
|
private const string URLAccessToken = URLAPI + "oauth/access_token";
|
||||||
private const string URLShorten = URLAPI + "v3/shorten";
|
private const string URLShorten = URLAPI + "v3/shorten";
|
||||||
|
|
||||||
public OAuth2Info AuthInfo { get; set; }
|
public OAuth2Info AuthInfo { get; private set; }
|
||||||
|
|
||||||
public BitlyURLShortener(OAuth2Info oauth)
|
public BitlyURLShortener(OAuth2Info oauth)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ public override UploadResult ShortenURL(string url)
|
||||||
|
|
||||||
result.Response = SendGetRequest(URLShorten, arguments);
|
result.Response = SendGetRequest(URLShorten, arguments);
|
||||||
|
|
||||||
BitlyShorten shorten = JsonConvert.DeserializeObject<BitlyShorten>(result.Response);
|
BitlyShortenResponse shorten = JsonConvert.DeserializeObject<BitlyShortenResponse>(result.Response);
|
||||||
|
|
||||||
if (shorten != null && shorten.data != null && !string.IsNullOrEmpty(shorten.data.url))
|
if (shorten != null && shorten.data != null && !string.IsNullOrEmpty(shorten.data.url))
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ public class BitlyShortenData
|
||||||
public string url { get; set; }
|
public string url { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BitlyShorten
|
public class BitlyShortenResponse
|
||||||
{
|
{
|
||||||
public BitlyShortenData data { get; set; }
|
public BitlyShortenData data { get; set; }
|
||||||
public int status_code { get; set; }
|
public int status_code { get; set; }
|
||||||
|
|
|
@ -182,11 +182,8 @@ public override UploadResult ShortenURL(string url)
|
||||||
public class GoogleURLShortenerResponse
|
public class GoogleURLShortenerResponse
|
||||||
{
|
{
|
||||||
public string kind { get; set; }
|
public string kind { get; set; }
|
||||||
|
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
public string longUrl { get; set; }
|
public string longUrl { get; set; }
|
||||||
|
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,58 +0,0 @@
|
||||||
#region License Information (GPL v3)
|
|
||||||
|
|
||||||
/*
|
|
||||||
ShareX - A program that allows you to take screenshots and share any file type
|
|
||||||
Copyright (C) 2008-2013 ShareX Developers
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endregion License Information (GPL v3)
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UploadersLib.HelperClasses;
|
|
||||||
|
|
||||||
namespace UploadersLib.URLShorteners
|
|
||||||
{
|
|
||||||
public sealed class ThreelyURLShortener : URLShortener
|
|
||||||
{
|
|
||||||
private const string APIURL = "http://3.ly";
|
|
||||||
|
|
||||||
private string APIKey;
|
|
||||||
|
|
||||||
public ThreelyURLShortener(string key)
|
|
||||||
{
|
|
||||||
APIKey = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override UploadResult ShortenURL(string url)
|
|
||||||
{
|
|
||||||
UploadResult result = new UploadResult { URL = url };
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(url))
|
|
||||||
{
|
|
||||||
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
|
||||||
arguments.Add("api", APIKey);
|
|
||||||
arguments.Add("u", url);
|
|
||||||
|
|
||||||
result.Response = result.ShortenedURL = SendGetRequest(APIURL, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -40,7 +40,6 @@ public override UploadResult ShortenURL(string url)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
||||||
arguments.Add("url", url);
|
arguments.Add("url", url);
|
||||||
// arguments.Add("tag", settings.Tag);
|
|
||||||
|
|
||||||
result.Response = SendGetRequest(APIURL, arguments);
|
result.Response = SendGetRequest(APIURL, arguments);
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,6 @@
|
||||||
<Compile Include="URLShorteners\CustomURLShortener.cs" />
|
<Compile Include="URLShorteners\CustomURLShortener.cs" />
|
||||||
<Compile Include="URLShorteners\GoogleURLShortener.cs" />
|
<Compile Include="URLShorteners\GoogleURLShortener.cs" />
|
||||||
<Compile Include="URLShorteners\IsgdURLShortener.cs" />
|
<Compile Include="URLShorteners\IsgdURLShortener.cs" />
|
||||||
<Compile Include="URLShorteners\ThreelyURLShortener.cs" />
|
|
||||||
<Compile Include="URLShorteners\TinyURLShortener.cs" />
|
<Compile Include="URLShorteners\TinyURLShortener.cs" />
|
||||||
<Compile Include="URLShorteners\TurlURLShortener.cs" />
|
<Compile Include="URLShorteners\TurlURLShortener.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue