mirror of https://github.com/Jackett/Jackett
Add GetArgumentFromQueryString()
This commit is contained in:
parent
2ea2bf53b3
commit
64ae9cb0d5
|
@ -1,5 +1,6 @@
|
|||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
|
||||
namespace Jackett.Utils
|
||||
{
|
||||
|
@ -74,6 +75,16 @@ namespace Jackett.Utils
|
|||
return long.TryParse(NormalizeNumber(str), NumberStyles.Any, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
|
||||
public static string GetArgumentFromQueryString(string url, string argument)
|
||||
{
|
||||
if (url == null || argument == null)
|
||||
return null;
|
||||
var qsStr = url.Split(new char[] { '?' }, 2)[1];
|
||||
qsStr = qsStr.Split(new char[] { '#' }, 2)[0];
|
||||
var qs = HttpUtility.ParseQueryString(qsStr);
|
||||
return qs.Get(argument);
|
||||
}
|
||||
|
||||
public static long? GetLongFromString(string str)
|
||||
{
|
||||
if (str == null)
|
||||
|
|
Loading…
Reference in New Issue